Unverified Commit 7c9bbf5b authored by Francisco Massa's avatar Francisco Massa Committed by GitHub
Browse files

Fix randomresized params flaky (#1282)

* Fix flakiness of test_randomresized_params

* Real fix

* Reduce number of iters
parent a44a1630
......@@ -141,8 +141,9 @@ class Tester(unittest.TestCase):
img = to_pil_image(img)
size = 100
epsilon = 0.05
min_scale = 0.25
for _ in range(10):
scale_min = round(random.random(), 2)
scale_min = max(round(random.random(), 2), min_scale)
scale_range = (scale_min, scale_min + round(random.random(), 2))
aspect_min = max(round(random.random(), 2), epsilon)
aspect_ratio_range = (aspect_min, aspect_min + round(random.random(), 2))
......
......@@ -645,7 +645,7 @@ class RandomResizedCrop(object):
w = int(round(math.sqrt(target_area * aspect_ratio)))
h = int(round(math.sqrt(target_area / aspect_ratio)))
if w <= img.size[0] and h <= img.size[1]:
if 0 < w <= img.size[0] and 0 < h <= img.size[1]:
i = random.randint(0, img.size[1] - h)
j = random.randint(0, img.size[0] - w)
return i, j, h, w
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment