Joker316701882 / Deep-Image-Matting

This is tensorflow implementation for paper "Deep Image Matting"
626 stars 188 forks source link

why resize input image to 320x320 #17

Open xiranwang opened 6 years ago

xiranwang commented 6 years ago

Based on the paper, I think you want to crop the entire image into 320x320 patches and then feed those with uncertain pixels into the neural network, but your code seems to just resize the entire input image into a single 320x320 image and feed into the neural network. This is totally different from what is done by the paper, which might explain why your results differ from theirs.

Joker316701882 commented 6 years ago

Thank you for your suggestion! But I remember that crop has been down in this code, see funtion 'prreprocessing_single' in matting.py.

xiranwang commented 6 years ago

For line 25 and 26 in test.py, are you resizing the input images into size of 320x320 then feeding them into the neural network to predict the alpha matte? You probably cropped training images into patches for training, but for testing you are supposed to do the same by cropping test images into patches and feeding them to the neural network. But if I'm understanding your code correctly, you just resize the whole image into a patch and feed it into the neural network. Instead, you should crop the test image into patches then feed each of them into neural network one by one then put the resultant alpha matte patches back into a complete alpha matte for the entire image.

My thinking is that if the neural network is trained to find alpha matte for a patch of a image, then you are supposed to use it to find the alpha matte of a patch only.

Joker316701882 commented 6 years ago

@xiranwang Sorry for late reply! Yeah, you are absolutely right about this: )

xiranwang commented 6 years ago

Looking forward to your update :)