xyupeng / ContrastiveCrop

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

Question about the cropping candidate regions #17

Closed yanzipei closed 2 years ago

yanzipei commented 2 years ago

In the ContrastiveCrop.py file: Line 44 to 47:

ch0 = max(int(height * h0) - h//2, 0)
ch1 = min(int(height * h1) - h//2, height - h)
cw0 = max(int(width * w0) - w//2, 0)
cw1 = min(int(width * w1) - w//2, width - w)

the upper bounds ch1 and cw1 may be wrong? It should be the addition instead of the subtraction? From my understanding, it ch1 and cw1 give the upper bounds (the maximum of the cropping region). Or I misunderstand the cropping candidate regions.

···
ch1 = min(int(height * h1) + h//2, height - h)
···
cw1 = min(int(width * w1) + w//2, width - w)

Thanks in advance.