aisegmentcn / matting_human_datasets

人像matting数据集,包含34427张图像和对应的matting结果图。
Other
600 stars 64 forks source link

Questions about matting datasets trimap image #5

Closed FantasyJXF closed 4 years ago

FantasyJXF commented 5 years ago

I download the matting_hunman_half dataset and extract the alpha image with the method you provided.

img = cv2.imread('matting.png', cv2.IMREAD_UNCHANGED)
alpha = img[:,:,3]

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

屏幕快照 2019-07-23 上午10 46 34

This is Adobe

屏幕快照 2019-07-23 上午10 49 08

I have another question, the fg image in adobe dataset has shaow outside the object border, what's it?

aisegmentcn commented 5 years ago

1,show your dialate and erode code pls. 2,can you share your adobe dataset to me ?

FantasyJXF commented 5 years ago

Sorry for the late reply.

  1. The awful trimap is from this file. And I think this one might be better.

  2. pls leave me your email

  3. How did you generate trimaps?

aisegmentcn commented 5 years ago

@FantasyJXF thks, my email is : bd@wonxing.com , or you can contact me via wechat : Freedom110620

Neptuneer commented 5 years ago

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. image

Jason-xin commented 5 years ago

@FantasyJXF 请问你最后用这个数据集去训练Semantic_Human_Matting的代码了吗?你是怎么做的,我看那个代码的训练需要alpha图和trimap图作为输入,他的trimap是从01的mask图生成出来的。

FantasyJXF commented 5 years ago

@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.

Jason-xin commented 5 years ago

@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?? image 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

FantasyJXF commented 5 years ago

As you can see, the trimap I generated is awful, as for your trimap, I think it's Okay

Jason-xin commented 5 years ago

@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!

Neptuneer commented 5 years ago

@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

FantasyJXF commented 5 years ago

@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?

Jason-xin commented 5 years ago

@aisegmentcn image

Neptuneer commented 5 years ago

@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.

aisegmentcn commented 5 years ago

@Jason-xin 建议根据128做二值化,然后膨胀获得未知区域;alpha可以设置一个最大最小阈值做一次截断。另外,这是我们去年初整理的能公开的数据集,因为图片来自互联网。更大更高质量的训练数据集无法公开,但可以论文合作的形式单独合作,也是免费的。

hexiangquan commented 4 years ago

@ @Neptuneer did you have get Deep Automatic Portrait Matting and Semantic Human Matting dataset?

Neptuneer commented 4 years ago

@hexiangquan Not yet.