From a35fcc4ab26781dbba1316d95641c28dbbf9517c Mon Sep 17 00:00:00 2001 From: Anirudh Acharya Date: Tue, 16 Oct 2018 14:08:08 -0700 Subject: [PATCH] address comments --- python/mxnet/image/image.py | 2 +- tests/python/unittest/test_image.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/mxnet/image/image.py b/python/mxnet/image/image.py index dece30ecb7f2..c1145578cf44 100644 --- a/python/mxnet/image/image.py +++ b/python/mxnet/image/image.py @@ -88,7 +88,7 @@ def imresize(src, w, h, interp): r"""Resize image with OpenCV. Note: `imread` uses OpenCV (not the CV2 Python library). - MXNet must have been built with USE_OPENCV=1 for `imdecode` to work. + MXNet must have been built with USE_OPENCV=1 for `imresize` to work. Parameters ---------- diff --git a/tests/python/unittest/test_image.py b/tests/python/unittest/test_image.py index 1e780149b427..5113f366cf92 100644 --- a/tests/python/unittest/test_image.py +++ b/tests/python/unittest/test_image.py @@ -84,7 +84,7 @@ def test_imdecode(self): try: import cv2 except ImportError: - return + raise unittest.SkipTest("Unable to import cv2.") for img in TestImage.IMAGES: with open(img, 'rb') as fp: str_image = fp.read() @@ -97,11 +97,12 @@ def test_scale_down(self): assert mx.image.scale_down((360, 1000), (480, 500)) == (360, 375) assert mx.image.scale_down((300, 400), (0, 0)) == (0, 0) + @with_seed() def test_resize_short(self): try: import cv2 except ImportError: - return + raise unittest.SkipTest("Unable to import cv2") for img in TestImage.IMAGES: cv_img = cv2.imread(img) mx_img = mx.nd.array(cv_img[:, :, (2, 1, 0)]) @@ -118,11 +119,12 @@ def test_resize_short(self): mx_resized = mx.image.resize_short(mx_img, new_size, interp) assert_almost_equal(mx_resized.asnumpy()[:, :, (2, 1, 0)], cv_resized, atol=3) + @with_seed() def test_imresize(self): try: import cv2 except ImportError: - return + raise unittest.SkipTest("Unable to import cv2") for img in TestImage.IMAGES: cv_img = cv2.imread(img) mx_img = mx.nd.array(cv_img[:, :, (2, 1, 0)])