-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Closed
Labels
Description
@zhunzhong07 @fmassa
https://github.com/pytorch/vision/blob/master/torchvision/transforms/transforms.py#L1256-L1263
Here, you assume that img_h < img_w implictly, which is true for most images. However, for some images img_h > img_w.
if h < img_h and w < img_w:This line of code equals to:
h/w <(ratio0~ratio1)/(scale0~scale1)
where the right falls in the range of (ratio0/scale1, ratio1/scale0), here is (0.9, 16.7). Then when h is more than 17 times of w, the loop runs forever.
If the user sets custom ratio and scale, this may happen more frequenently. At least, more checks are deserved to add. Or maybe give warnings if this probablity is high.