anirudhacharya commented on a change in pull request #12831: Add imresize to 
mxnet.image documentation
URL: https://github.com/apache/incubator-mxnet/pull/12831#discussion_r225623296
 
 

 ##########
 File path: tests/python/unittest/test_image.py
 ##########
 @@ -118,6 +118,22 @@ 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)
 
+    def test_imresize(self):
+        try:
+            import cv2
+        except ImportError:
+            return
+        for img in TestImage.IMAGES:
+            cv_img = cv2.imread(img)
+            mx_img = mx.nd.array(cv_img[:, :, (2, 1, 0)])
+            for _ in range(3):
+                new_h = np.random.randint(1, 1000)
+                new_w = np.random.randint(1, 1000)
+                for interp in range(0, 2):
+                    cv_resized = cv2.resize(cv_img, (new_w, new_h), 
interpolation=interp)
+                    mx_resized = mx.image.imresize(mx_img, new_w, new_h, 
interp)
+                    assert_almost_equal(mx_resized.asnumpy()[:, :, (2, 1, 0)], 
cv_resized, atol=3)
 
 Review comment:
   yes, we need to have because there is also image interpolation here. See a 
similar test in line 100 called `test_resize_short`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to