Deep-Image-Matting
Deep-Image-Matting copied to clipboard
Need add missed files from matting_deconv.py + usage guide
model_path = './vgg16_weights.npz' log_dir = './tensor_log' dataset_RGB = '/data/gezheng/data-matting/comp_RGB' dataset_alpha = './alpha_final' dataset_FG = './FG_final' dataset_BG = '/data/gezheng/data-matting/BG'
Thank you. Vgg model can be found here: "https://www.cs.toronto.edu/~frossard/post/vgg16/" I'm sorry that the training data is owned by the company. I'll publish the model and usage ASAP. Because lot's of implementing details are vague in paper, so this code is shared for showing my understanding about it. Different ideas and discussion are welcomed!
This is tensorflow implementation for paper "Deep Image Matting".
need add link on WP
Thank you for sharing your data_structure! But I still have some questions。 1.How do you abtain the eps? 2.In your BG_folder, is the 100 background images in each folder the same? 3.How much is your GPU memory, and how much time usually requires for training?
- eps is from real world. (manually collected and use PS to get corresponding mask)
- BGs are not same. for example, if there is 900 eps, and there will totally 90000 different BGs separated in 900 folders. BGs come from 'pascal voc' and 'coco'
- mini_batch size is 1. So it doesn't really take too much GPU space. I don't know the minimum space requirement, but in my case, 5G is allocated and it's enough. Generally, 10 hours of training is enough I think.
Thank you very much for your reply!It helps me understand the paper and your excellent codes.
Thank you for the excellent code.
I have a question about alpha mask generation. What strategy do you use to generate multiple copies of the same object's alpha? For instance, are you randomly scaling the alpha image? Or is the aspect ratio randomly determined ?
@longbuild Do u mean different size in alpha_image.png file? If so, actually the alpha in those images are same size. They look different is because alpha is padding to different size(which is the corresponding size in the same path under BG folder). So basically, one alpha will never change size, but the size after padding depends on corresponding background image. e.g. BG/0/0.png shares same size with alpha1280/0/0.png BG/0/1.png shares same size with alpha1280/0/1.png the alpha part in this two images are same, they look different because the are padded in different size of background.
If you are talking about data augmentation, then just randomly crop like the paper mentioned.
@Joker316701882
Yes, thank you for clarifying that! Are the corresponding images in alpha/ and BG/ the exact same size or are the alpha images scaled down to 640px as mentioned in your blog post?
Edit: Oops never mind. The alpha part is scaled to 640px but padded to match the size of the background. I get it now!
@longbuild
You are welcome.
By the way, just like the second method to prepare training data which is mentioned in my blog. We can directly center pad alpha into bg without resize bg ( which is the author's way I think). The code can be seen here:
and call this function here:
then we don't need to resize bg's minimum side as 1280.