MODNet
MODNet copied to clipboard
Full scripts for training
Hello,could u please provide a few samples of your training data and the full scripts for training? Thanks
Hi, thanks for your attention. Releasing of our full scripts for training is scheduled after this paper is accepted.
I read the training code. Method supervised_training_iter takes image, trimap and gt_matte.
To generate trimap I wrote next code:
def makeEdgeMask(mask, width):
kernel = np.ones((width,width), np.uint8)
erosion = cv2.erode(mask, kernel, iterations = 1)
dilation = cv2.dilate(mask, kernel, iterations = 1)
return dilation - erosion
def makeTrimap(mask, width = 5):
edgeMask = makeEdgeMask(mask, width)
trimap = mask.astype(np.float)
trimap[edgeMask == 1] = 0.5
return trimap
@lrjj, may be that will help you.
In my case code training technically works - semantic, detail and matte losses become very low:
But generated masks are incorrect.
As training data I took 640x480 CocoDataset images.
I read the training code. Method supervised_training_iter takes image, trimap and gt_matte.
To generate trimap I wrote next code:
def makeEdgeMask(mask, width): kernel = np.ones((width,width), np.uint8) erosion = cv2.erode(mask, kernel, iterations = 1) dilation = cv2.dilate(mask, kernel, iterations = 1) return dilation - erosion def makeTrimap(mask, width = 5): edgeMask = makeEdgeMask(mask, width) trimap = mask.astype(np.float) trimap[edgeMask == 1] = 0.5 return trimap
@lrjj, may be that will help you.
In my case code training technically works - semantic, detail and matte losses become very low:
But generated masks are incorrect.
As training data I took 640x480 CocoDataset images.
Hello, if it is convenient, could you please send me a copy of your training script?Thank you very much.
哈喽 我实现了一个完整的训练代码 用的是bg的数据 效果不好 欢迎一起探讨一下