def graph_fn(): keypoints = tf.constant([[[10., 30.], [30., 45.]], [[20., 0.], [40., 60.]]]) output = keypoint_ops.to_normalized_coordinates(keypoints, 40, 60) expected_keypoints = tf.constant([[[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]]]) return output, expected_keypoints
def test_to_normalized_coordinates_already_normalized(self): keypoints = tf.constant([[[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]]]) output = keypoint_ops.to_normalized_coordinates(keypoints, 40, 60) with self.test_session() as sess: with self.assertRaisesOpError('assertion failed'): sess.run(output)
def test_to_normalized_coordinates(self): keypoints = tf.constant([[[10., 30.], [30., 45.]], [[20., 0.], [40., 60.]]]) output = keypoint_ops.to_normalized_coordinates(keypoints, 40, 60) expected_keypoints = tf.constant([[[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]]]) with self.test_session() as sess: output_, expected_keypoints_ = sess.run( [output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
def test_to_normalized_coordinates_already_normalized(self): keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) output = keypoint_ops.to_normalized_coordinates( keypoints, 40, 60) with self.test_session() as sess: with self.assertRaisesOpError('assertion failed'): sess.run(output)
def test_to_normalized_coordinates(self): keypoints = tf.constant([ [[10., 30.], [30., 45.]], [[20., 0.], [40., 60.]] ]) output = keypoint_ops.to_normalized_coordinates( keypoints, 40, 60) expected_keypoints = tf.constant([ [[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]] ]) with self.test_session() as sess: output_, expected_keypoints_ = sess.run([output, expected_keypoints]) self.assertAllClose(output_, expected_keypoints_)
def graph_fn(): keypoints = tf.constant([[[0.25, 0.5], [0.75, 0.75]], [[0.5, 0.0], [1.0, 1.0]]]) output = keypoint_ops.to_normalized_coordinates(keypoints, 40, 60) return output