def test_rms_points_error_empty_point_cloud(self): evaluator = MeshEvaluator(self.submission, self.ground_truth, self.settings) self.submission.elements["57"].points = np.zeros((0, 0), dtype=np.int64) rms_points_error = evaluator.rms_points_error() self.assertTrue(rms_points_error < 0.07)
def test_evaluate_all(self): """ Test the evaluate_all function by running it and checking the resulting metric values. Only a subset of metrics are checked. """ evaluator = MeshEvaluator(self.submission, self.ground_truth, self.settings) metrics = evaluator.evaluate_all() self.assertTrue(metrics["rms_points_error"] < 0.07) self.assertAlmostEqual(metrics["shape_score"], 1, places=1)
def test_shape_similarity(self): """ Verify that the shape similarity measure is producing sane outputs. """ # TODO: Get deepcopy working for ProjectScene and make a simpler # example for faster unit test. evaluator = MeshEvaluator(self.submission, self.ground_truth, self.settings) obj1 = self.submission.elements["1069"] obj2 = self.ground_truth.elements["1069"] # verify no offset gives sim = 1 sim = evaluator._shape_similarity(obj1, obj2) self.assertAlmostEqual(sim, 1, places=1) # verify small offset gives sim between 0 and 1 points_orig = obj2.points obj2.points = obj2.points + np.array([0.2, 0, 0, 0, 0, 0]) sim = evaluator._shape_similarity(obj1, obj2) self.assertTrue(sim < 1 and sim > 0) # verify large offset gives sim = 0 obj2.points = obj2.points + np.array([1, 0, 0, 0, 0, 0]) sim = evaluator._shape_similarity(obj1, obj2) self.assertAlmostEqual(sim, 0) obj2.points = points_orig shape_score = evaluator.shape_score() self.assertAlmostEqual(shape_score, 1, places=1)
def test_rms_color_error(self): evaluator = MeshEvaluator(self.submission, self.ground_truth, self.settings) rms_color_error = evaluator.rms_color_error() self.assertTrue(rms_color_error < 25)
def test_perceptual_score(self): evaluator = MeshEvaluator(self.submission, self.ground_truth, self.settings) perceptual_score = evaluator.perceptual_score() self.assertAlmostEqual(perceptual_score, 1, places=4)
def test_semantics_score(self): evaluator = MeshEvaluator(self.submission, self.ground_truth, self.settings) semantics_score = evaluator.semantics_score() self.assertAlmostEqual(semantics_score, 1, places=1)