Exemplo n.º 1
0
 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
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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_)
Exemplo n.º 4
0
  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)
Exemplo n.º 5
0
  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_)
Exemplo n.º 6
0
 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