Пример #1
0
    def test_no_points_in_zero_boxes(self):
        # Unit size boxes centered at (center, 0, 2)
        box, _, num_box = test_utils.generate_boxes([0.0], 1)
        box = box[0, 0:num_box[0], :]
        point = tf.constant(
            [
                [5.0, 0.0, 1.5],  # not in
                [20.0, 0.0, 1.6],  # not in
                [20.0, 0.0, 2.6],  # not in
            ],
            dtype=tf.float32)

        point_in_box = box_utils.is_within_box_3d(point, box)

        with self.test_session() as sess:
            point_in_box = sess.run(point_in_box)
            self.assertAllEqual(point_in_box, [[False], [False], [False]])
Пример #2
0
    def test_compute_num_points_in_box_3d(self):
        # Unit size boxes centered at (center, 0, 2)
        box, _, num_box = test_utils.generate_boxes([5.0, 5.5, 19.6, 50], 1)
        box = box[0, 0:num_box[0], :]
        point = tf.constant(
            [
                [5.0, 0.0, 1.5],  # in
                [5.0, 0.0, 2.5],  # in
                [20.0, 0.0, 1.6],  # in
                [20.0, 0.0, 2.6],  # not in
            ],
            dtype=tf.float32)

        num_points_in_box = box_utils.compute_num_points_in_box_3d(point, box)

        with self.test_session() as sess:
            num_points_in_box = sess.run(num_points_in_box)
            self.assertAllEqual(num_points_in_box, [2, 2, 1, 0])