Пример #1
0
        def graph_fn():
            keypoints = tf.constant([[[0.25, 0.5], [0.75, 0.75]],
                                     [[0.5, 0.0], [1.0, 1.0]]])
            window = tf.constant([0.25, 0.25, 0.75, 0.75])

            expected_keypoints = tf.constant([[[0.25, 0.5], [0.75, 0.75]],
                                              [[0.5, 0.25], [0.75, 0.75]]])
            output = keypoint_ops.clip_to_window(keypoints, window)
            return output, expected_keypoints
Пример #2
0
    def test_clip_to_window(self):
        keypoints = tf.constant([[[0.25, 0.5], [0.75, 0.75]],
                                 [[0.5, 0.0], [1.0, 1.0]]])
        window = tf.constant([0.25, 0.25, 0.75, 0.75])

        expected_keypoints = tf.constant([[[0.25, 0.5], [0.75, 0.75]],
                                          [[0.5, 0.25], [0.75, 0.75]]])
        output = keypoint_ops.clip_to_window(keypoints, window)

        with self.test_session() as sess:
            output_, expected_keypoints_ = sess.run(
                [output, expected_keypoints])
            self.assertAllClose(output_, expected_keypoints_)
Пример #3
0
  def test_clip_to_window(self):
    keypoints = tf.constant([
        [[0.25, 0.5], [0.75, 0.75]],
        [[0.5, 0.0], [1.0, 1.0]]
    ])
    window = tf.constant([0.25, 0.25, 0.75, 0.75])

    expected_keypoints = tf.constant([
        [[0.25, 0.5], [0.75, 0.75]],
        [[0.5, 0.25], [0.75, 0.75]]
    ])
    output = keypoint_ops.clip_to_window(keypoints, window)

    with self.test_session() as sess:
      output_, expected_keypoints_ = sess.run([output, expected_keypoints])
      self.assertAllClose(output_, expected_keypoints_)