Esempio n. 1
0
 def test_box_size_regression_loss_on_voxel_tensors_relative(self):
     (inputs, outputs1,
      outputs2) = self._get_dictionaries_for_distance_loss_relative()
     inputs[standard_fields.InputDataFields.num_valid_voxels] = tf.constant(
         [1], dtype=tf.int32)
     loss1 = box_prediction_losses.box_size_regression_loss_on_voxel_tensors(
         inputs=inputs, outputs=outputs1, loss_type='huber')
     loss2 = box_prediction_losses.box_size_regression_loss_on_voxel_tensors(
         inputs=inputs, outputs=outputs2, loss_type='huber')
     self.assertGreater(loss2.numpy(), loss1.numpy())
Esempio n. 2
0
 def test_box_size_regression_loss_on_voxel_tensors_empty_inputs(self):
     inputs = self._get_empty_inputs()
     outputs = {
         standard_fields.DetectionResultFields.object_length_voxels:
         tf.zeros([1, 0, 3], dtype=tf.float32),
         standard_fields.DetectionResultFields.object_height_voxels:
         tf.zeros([1, 0, 3], dtype=tf.float32),
         standard_fields.DetectionResultFields.object_width_voxels:
         tf.zeros([1, 0, 3], dtype=tf.float32),
     }
     loss = box_prediction_losses.box_size_regression_loss_on_voxel_tensors(
         inputs=inputs, outputs=outputs, loss_type='huber')
     self.assertAllClose(loss.numpy(), 0.0)
Esempio n. 3
0
 def test_box_size_regression_loss_on_voxel_tensors_correct_prediction(
         self):
     inputs = self._get_random_inputs()
     inputs[standard_fields.InputDataFields.num_valid_voxels] = tf.constant(
         [100], dtype=tf.int32)
     outputs = {
         standard_fields.DetectionResultFields.object_length_voxels:
         inputs[standard_fields.InputDataFields.object_length_voxels],
         standard_fields.DetectionResultFields.object_height_voxels:
         inputs[standard_fields.InputDataFields.object_height_voxels],
         standard_fields.DetectionResultFields.object_width_voxels:
         inputs[standard_fields.InputDataFields.object_width_voxels],
     }
     loss = box_prediction_losses.box_size_regression_loss_on_voxel_tensors(
         inputs=inputs, outputs=outputs, loss_type='huber')
     self.assertAllClose(loss.numpy(), 0.0)