This is an automated email from the ASF dual-hosted git repository.
apeforest pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 6f01a6f add epsilon for tolerance level (#15098)
6f01a6f is described below
commit 6f01a6ff659e67150185f426dd3df2990164d825
Author: Jake Lee <[email protected]>
AuthorDate: Fri May 31 11:23:51 2019 -0700
add epsilon for tolerance level (#15098)
---
tests/python/unittest/test_image.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/python/unittest/test_image.py
b/tests/python/unittest/test_image.py
index 53c630f..8a276c3 100644
--- a/tests/python/unittest/test_image.py
+++ b/tests/python/unittest/test_image.py
@@ -356,17 +356,18 @@ class TestImage(unittest.TestCase):
pass
@with_seed()
- @unittest.skip('Flaky test. Skipping until a solution can be found.
Tracked by https://github.com/apache/incubator-mxnet/issues/14718')
def test_random_size_crop(self):
# test aspect ratio within bounds
width = np.random.randint(100, 500)
height = np.random.randint(100, 500)
src = np.random.rand(height, width, 3) * 255.
ratio = (0.75, 1)
+ epsilon = 0.05
out, (x0, y0, new_w, new_h) =
mx.image.random_size_crop(mx.nd.array(src), size=(width, height), area=0.08,
ratio=ratio)
_, pts = mx.image.center_crop(mx.nd.array(src), size=(width, height))
if (x0, y0, new_w, new_h) != pts:
- assert ratio[0] <= float(new_w)/new_h <= ratio[1]
+ assert ratio[0] - epsilon <= float(new_w)/new_h <= ratio[1] +
epsilon, \
+ 'ration of new width and height out of the
bound{}/{}={}'.format(new_w, new_h, float(new_w)/new_h)
if __name__ == '__main__':