xyupeng / ContrastiveCrop

[CVPR 2022 Oral] Crafting Better Contrastive Views for Siamese Representation Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The cropping may have some issues

SY-Xuan opened this issue · comments

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.

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?

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.

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

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