lorenmt / reco

The implementation of "Bootstrapping Semantic Segmentation with Regional Contrast" [ICLR 2022].
https://shikun.io/projects/regional-contrast
Other
162 stars 25 forks source link

`Reflect' when filling the cropped images? #9

Closed Haochen-Wang409 closed 2 years ago

Haochen-Wang409 commented 2 years ago

Hi, thanks for your great work in combining contrastive learning and semi-supervised semantic segmentation!

I'm a littble bit confused about your code: https://github.com/lorenmt/reco/blob/main/build_data.py#L38 The images are filled in the reflect mode including the test stage. Is this fare when comparing with previous state-of-the-art methods where the images are filled in the constant mode with value of 0?

lorenmt commented 2 years ago

Hello!

Yes this is fine, it's an arbitrary choice anyway. Because those reflected pixels were not counted during evaluation, they were padded to make sure all images were in the same size.

Haochen-Wang409 commented 2 years ago

Thanks for your answer!

It is true that the padded pixels will not be counted during evaluation. But I am afraid that the context information provided by padded pixels may help the model in testing, which could lead to a better performance.

Haochen-Wang409 commented 2 years ago

Besides, I run your code and train a model, whose mIoU is 77.31 when the images were padded in the reflect mode. However, its mIoU dropped to 76.55 when the images were filled with 0. All weights of the model are the same.

lorenmt commented 2 years ago

Strictly speaking, yes you are right. That's one of the reasons that most of the baselines were reimplemented by ourselves using the code in this repo, to have a fair comparison. I emphasized this in the Section 4.1.

In the original semi-supervised baselines such as CUTMIX, CLASSMIX, S4GAN, they also used stopping batchnorm parameters, and other tricks which hard to completely follow to have a consistent training strategy. So we also provide experimental results in the appendix, to compare the performance from the original publication, based on the gap to the fully-supervised result. This is probably the only viable way to compare the other semi-supervised performances.

Haochen-Wang409 commented 2 years ago

Thanks for your patience!