diff --git a/chainercv/transforms/keypoint/flip_keypoint.py b/chainercv/transforms/keypoint/flip_keypoint.py index 76a89befb3..d7788f2ac1 100644 --- a/chainercv/transforms/keypoint/flip_keypoint.py +++ b/chainercv/transforms/keypoint/flip_keypoint.py @@ -22,7 +22,7 @@ def flip_keypoint(keypoint, size, y_flip=False, x_flip=False): H, W = size keypoint = keypoint.copy() if y_flip: - keypoint[:, 0] = H - 1 - keypoint[:, 0] + keypoint[:, 0] = H - keypoint[:, 0] if x_flip: - keypoint[:, 1] = W - 1 - keypoint[:, 1] + keypoint[:, 1] = W - keypoint[:, 1] return keypoint diff --git a/tests/transforms_tests/keypoint_tests/test_flip_keypoint.py b/tests/transforms_tests/keypoint_tests/test_flip_keypoint.py index f059b47567..5dae2f8b6d 100644 --- a/tests/transforms_tests/keypoint_tests/test_flip_keypoint.py +++ b/tests/transforms_tests/keypoint_tests/test_flip_keypoint.py @@ -14,12 +14,12 @@ def test_flip_keypoint(self): out = flip_keypoint(keypoint, size=(34, 32), y_flip=True) keypoint_expected = keypoint.copy() - keypoint_expected[:, 0] = 33 - keypoint[:, 0] + keypoint_expected[:, 0] = 34 - keypoint[:, 0] np.testing.assert_equal(out, keypoint_expected) out = flip_keypoint(keypoint, size=(34, 32), x_flip=True) keypoint_expected = keypoint.copy() - keypoint_expected[:, 1] = 31 - keypoint[:, 1] + keypoint_expected[:, 1] = 32 - keypoint[:, 1] np.testing.assert_equal(out, keypoint_expected)