Closed FantasyJXF closed 4 years ago
1,show your dialate and erode code pls. 2,can you share your adobe dataset to me ?
@FantasyJXF thks, my email is : bd@wonxing.com , or you can contact me via wechat : Freedom110620
Thank you for sharing the dataset. I meet the same problem. And many mistakes were found in the "matting" images when I checked up the data. I guess they are not the standard alpha mattes.
@FantasyJXF 请问你最后用这个数据集去训练Semantic_Human_Matting的代码了吗?你是怎么做的,我看那个代码的训练需要alpha图和trimap图作为输入,他的trimap是从01的mask图生成出来的。
@Neptuneer This dataset is definitely NOT for alpha matting, since they are not precise enough, and has many flaws if you look into the images.
@Jason-xin Yes, I trained the SHM model with this dataset several times, it took me 3 days training with all the images, still couldn't get a useful model. As for the trimap, try to get mask image from alpha image, and then generate trimap image, maybe you could find a better way.
@Neptuneer This dataset is definitely NOT for alpha matting, since they are not precise enough, and has many flaws if you look into the images.
@Jason-xin Yes, I trained the SHM model with this dataset several times, it took me 3 days training with all the images, still couldn't get a useful model. As for the trimap, try to get mask image from alpha image, and then generate trimap image, maybe you could find a better way.
@FantasyJXF try to get mask image from alpha image? Just set 255 for all larger than 126 and set 0 for all smaller than 126?? And the trimap like this for your referred image(1803232244-00000372.png), You think this is awful trimap?
And In Section 4.5 of Semantic_Human_Matting's paper, it said "generate the trimap ground truth by dilating the groundtruth alpha mattes" on T-Net pre-train
As you can see, the trimap I generated is awful, as for your trimap, I think it's Okay
@FantasyJXF But I just convert alpha image to binary mask image (set 255 for all larger than 126 and set 0 for all smaller than 126), then run this code like you。。。
if possible, can you add me wechat "jasonxin8"? Thanks a lot!
@Jason-xin The pixels values of unknown regions in alpha mattes are (0, 255), while the pixels in foreground and background regions are fixed to 255 and 0, respectively. Your operation might miss so many pixels in unknown region. Code as follow may help you. BTW, this dataset is NOT a alpha dataset. DO NOT use it to train a alpha matting model.
def gen_trimap(alpha): k_size = random.choice(range(1, 5)) iterations = np.random.randint(1, 20) kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (k_size, k_size)) dilated = cv2.dilate(alpha, kernel, iterations) eroded = cv2.erode(alpha, kernel, iterations) trimap = np.zeros(alpha.shape) trimap.fill(128) trimap[eroded >= 255] = 255 trimap[dilated <= 0] = 0 return trimap
@Neptuneer From pytorch-dim? HaHa.
I think the k_size could be larger.
So do you have any other alpha matting dataset, except for Adobe?
@aisegmentcn
@FantasyJXF Yes(with a shy face). I guess k_size is too small when it is set to 1, but did you get a better result when you enlarge the k_size? The trimaps look worse visually when I enlarge the k_size. I have sent e-mails to the authors of Deep Automatic Portrait Matting and Semantic Human Matting for datasets, but haven't got any reply for a long time.
@Jason-xin 建议根据128做二值化,然后膨胀获得未知区域;alpha可以设置一个最大最小阈值做一次截断。另外,这是我们去年初整理的能公开的数据集,因为图片来自互联网。更大更高质量的训练数据集无法公开,但可以论文合作的形式单独合作,也是免费的。
@ @Neptuneer did you have get Deep Automatic Portrait Matting and Semantic Human Matting dataset?
@hexiangquan Not yet.
I download the
matting_hunman_half
dataset and extract the alpha image with the method you provided.The alpha image seems Okay, but when I use alpha image to generate trimap image, do the dialate and erode or something, the result is strange
This is strange
This is Adobe
I have another question, the fg image in adobe dataset has shaow outside the object border, what's it?