xyupeng / ContrastiveCrop

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

A question about pseudocode #18

Open yafangna opened 1 year ago

yafangna commented 1 year ago

What does Bx0 and Bx1 stand for in pseudocode

xyupeng commented 1 year ago

Hi, B is defined in Eq. (2) as the bounding box, and B{x0}/B{x1} is the x coordinate of the left/right side of B.

yafangna commented 1 year ago

Thank you for your reply

Wenqi-Wang27 commented 1 year ago

Thanks for the source code! What do lines 44 to 47 of the code stand for in "datasets.transforms.ContrastiveCrop.py" ?

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

16 & #17

xyupeng commented 1 year ago

Thanks for the source code! What do lines 44 to 47 of the code stand for in "datasets.transforms.ContrastiveCrop.py" ?

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

16 & #17

These lines generate the operable region for box center. ch0 is the minimum h, ch1 is the maximum h, and similar for cw0, cw1. min(max(...)) is to ensure the whole box is fully inside the image.

Wenqi-Wang27 commented 1 year ago

Thank you for your reply!

Thanks for the source code! What do lines 44 to 47 of the code stand for in "datasets.transforms.ContrastiveCrop.py" ?

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

16 & #17

These lines generate the operable region for box center. ch0 is the minimum h, ch1 is the maximum h, and similar for cw0, cw1. min(max(...)) is to ensure the whole box is fully inside the image.

Thank you for your reply!