xyupeng / ContrastiveCrop

[CVPR 2022 Oral] Crafting Better Contrastive Views for Siamese Representation Learning
MIT License
284 stars 27 forks source link

The cropping may have some issues #16

Closed SY-Xuan closed 2 years ago

SY-Xuan commented 2 years ago

ch0 = max(int(height * h0) - h//2, 0) ch1 = min(int(height * h1) - h//2, height - h) In your implementation, ch0 can be larger than ch1. For example, ch0 and ch1 are both near 1.0. I think this situation may cause some errors.

xyupeng commented 2 years ago

Hi @SY-Xuan, thank you for pointing out the problem. I will try to restrict int(height * h0) - h//2 and int(height * h1) - h//2 within [0, height - h] and rerun some main experiments. And did you catch such errors in your training?

SY-Xuan commented 2 years ago

Yeah! If you use the uniform sampling like 'i = torch.randint(ch0, ch1 + 1, size=(1,)).item()' There can be some issues. *ch0 = int(height h0) - h//2 can be larger than ch1 = height - h**. I think you did not catch the issue because you use the Beta distribution to sample here. Even though the ch0 > ch1, it will not have an issue. This situation may produce some unknown behaviors.

xyupeng commented 2 years ago

Already fixed. If any further question, feel free to reopen the issue.

SY-Xuan commented 2 years ago

Thanks for your kindly replying. One more thing, I wonder if there is any improvement in the performance after fixing this bug?