示例#1
0
 def testTransformPointsRotation(self):
     batch_size, num_points = 10, 8
     points = tf.random_uniform((batch_size, num_points, 3))
     transforms = self._MakeTransformTestRotationMatrices(batch_size)
     points_transformed = geometry.TransformPoints(points, transforms)
     with self.session() as sess:
         actual_points, actual_points_transformed = sess.run(
             (points, points_transformed))
     # Points are the same on the z-axis (no rotation).
     self.assertAllClose(actual_points[:, :, 2],
                         actual_points_transformed[:, :, 2])
     # Points are transformed, and different.
     self.assertNotAllClose(actual_points, actual_points_transformed)
示例#2
0
 def testTransformBBoxes3DConsistentWithPoints(self):
   num_boxes, num_points = 20, 100
   points = tf.random_uniform((num_points, 3))
   bboxes_3d = tf.random_uniform((num_boxes, 7))
   in_bboxes = geometry.IsWithinBBox3D(points, bboxes_3d)
   transforms = self._MakeTransformTestTranslationMatrices(1)[0]
   points_transformed = geometry.TransformPoints(points, transforms)
   bboxes_3d_transformed = geometry.TransformBBoxes3D(bboxes_3d, transforms)
   in_bboxes_transformed = geometry.IsWithinBBox3D(points_transformed,
                                                   bboxes_3d_transformed)
   with self.session() as sess:
     actual_in_bboxes, actual_in_bboxes_transformed = sess.run(
         (in_bboxes, in_bboxes_transformed))
   self.assertAllEqual(actual_in_bboxes, actual_in_bboxes_transformed)
示例#3
0
 def testTransformPointsTranslation(self):
   batch_size, num_points = 10, 8
   points = tf.random_uniform((batch_size, num_points, 3))
   transforms = self._MakeTransformTestTranslationMatrices(batch_size)
   points_transformed = geometry.TransformPoints(points, transforms)
   with self.session() as sess:
     actual_points, actual_points_transformed, actual_transforms = sess.run(
         (points, points_transformed, transforms))
   # Points are transformed, and different.
   self.assertNotAllClose(actual_points, actual_points_transformed)
   # Manually transform points and check that they are as expected.
   actual_translation = actual_transforms[:, :3, 3]
   self.assertAllClose(actual_points + actual_translation[:, np.newaxis, :],
                       actual_points_transformed)