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