Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
update test_rotate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Sep 16, 2018
1 parent d029d21 commit 3da3657
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/transforms_tests/image_tests/test_rotate.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import random
import unittest

import numpy as np

from chainer import testing
from chainercv.transforms import flip
from chainercv.transforms import rotate


@testing.parameterize(*testing.product({
'k': [0, 1, 2, 3]
}))
class TestRotate(unittest.TestCase):

def test_rotate(self):
img = np.random.uniform(size=(3, 32, 24))
angle = random.uniform(0, 180)

out = rotate(img, self.k)
out = rotate(out, 4 - self.k)
out = rotate(img, angle)
expected = flip(img, x_flip=True)
expected = rotate(expected, -1 * angle)
expected = flip(expected, x_flip=True)

np.testing.assert_equal(img, out)
np.testing.assert_almost_equal(out, expected, decimal=6)


testing.run_module(__name__, __file__)

0 comments on commit 3da3657

Please sign in to comment.