Yaoyi-Li / GCA-Matting

Official repository for Natural Image Matting via Guided Contextual Attention
MIT License
390 stars 62 forks source link

About sample unknown point in the RandomCrop function #11

Closed yucornetto closed 4 years ago

yucornetto commented 4 years ago

Thanks for the great work and code :) Your implementation is really elegant and impressive. However, I found that some part in the RandomCrop function is a little bit confusing:

https://github.com/Yaoyi-Li/GCA-Matting/blob/92c40b02f3f7c5dced6aed0eaf4de6eae6546c2d/dataloader/data_generator.py#L296

Based on this line, I assume that you are sampling unknown point as the center of the crop patch (based on that you deal with the border at 4 sides)

However, the later code using the sampled unknown point seems to treat it as the left-top point of the crop patch: https://github.com/Yaoyi-Li/GCA-Matting/blob/92c40b02f3f7c5dced6aed0eaf4de6eae6546c2d/dataloader/data_generator.py#L306

Am I misunderstanding something? Thanks!

Yaoyi-Li commented 4 years ago

Hi, thanks for your interest. This is not a bug. left_top is not the index of the selected unknown pixel, there is an offset inside. You can print it out to check it.

yucornetto commented 4 years ago

Hi, thanks for your interest. This is not a bug. left_top is not the index of the selected unknown pixel, there is an offset inside. You can print it out to check it.

I see, thanks for your explanation!