def graph_fn(): keypoints = tf.constant([[[0.1, 0.1], [0.2, 0.2], [0.3, 0.3]], [[0.4, 0.4], [0.5, 0.5], [0.6, 0.6]]]) expected_keypoints = tf.constant([ [[0.1, 0.9], [0.2, 0.8], [0.3, 0.7]], [[0.4, 0.6], [0.5, 0.5], [0.6, 0.4]], ]) output = keypoint_ops.flip_horizontal(keypoints, 0.5) return output, expected_keypoints
def graph_fn(): keypoints = tf.constant([[[0.1, 0.1], [0.2, 0.2], [0.3, 0.3]], [[0.4, 0.4], [0.5, 0.5], [0.6, 0.6]]]) flip_permutation = [0, 2, 1] expected_keypoints = tf.constant([ [[0.1, 0.9], [0.3, 0.7], [0.2, 0.8]], [[0.4, 0.6], [0.6, 0.4], [0.5, 0.5]], ]) output = keypoint_ops.flip_horizontal(keypoints, 0.5, flip_permutation) return output, expected_keypoints
def test_flip_horizontal(self): keypoints = tf.constant([[[0.1, 0.1], [0.2, 0.2], [0.3, 0.3]], [[0.4, 0.4], [0.5, 0.5], [0.6, 0.6]]]) flip_permutation = [0, 2, 1] expected_keypoints = tf.constant([ [[0.1, 0.9], [0.3, 0.7], [0.2, 0.8]], [[0.4, 0.6], [0.6, 0.4], [0.5, 0.5]], ]) output = keypoint_ops.flip_horizontal(keypoints, 0.5, flip_permutation) with self.test_session() as sess: output_, expected_keypoints_ = sess.run( [output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
def test_flip_horizontal(self): keypoints = tf.constant([ [[0.1, 0.1], [0.2, 0.2], [0.3, 0.3]], [[0.4, 0.4], [0.5, 0.5], [0.6, 0.6]] ]) flip_permutation = [0, 2, 1] expected_keypoints = tf.constant([ [[0.1, 0.9], [0.3, 0.7], [0.2, 0.8]], [[0.4, 0.6], [0.6, 0.4], [0.5, 0.5]], ]) output = keypoint_ops.flip_horizontal(keypoints, 0.5, flip_permutation) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)