From b45762b321c32fdaa4524b0cb182504af9883ee5 Mon Sep 17 00:00:00 2001 From: ktro2828 Date: Mon, 1 Jan 2024 11:06:05 +0900 Subject: [PATCH] test: update test Signed-off-by: ktro2828 --- .../test/matching/test_objects_filter.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/perception_eval/test/matching/test_objects_filter.py b/perception_eval/test/matching/test_objects_filter.py index 1358ebef..85271416 100644 --- a/perception_eval/test/matching/test_objects_filter.py +++ b/perception_eval/test/matching/test_objects_filter.py @@ -24,6 +24,7 @@ from perception_eval.common.label import AutowareLabel from perception_eval.common.label import SemanticLabel from perception_eval.matching import MatchingMode +from perception_eval.matching import MatchingPolicy from perception_eval.matching.objects_filter import divide_objects from perception_eval.matching.objects_filter import divide_objects_to_num from perception_eval.matching.objects_filter import divide_tp_fp_objects @@ -189,12 +190,7 @@ def test_get_positive_objects(self) -> None: # TP: (Est[0], GT[0]), (Est[1], GT[1]), (Est[2], GT[2]), (Est[3], GT[3]) # FP: # Given no diff_distance, all estimated_objects are tp. - ( - 0.0, - np.array([(0, 0), (1, 1), (2, 2), (3, 3)]), - np.array([]), - {}, - ), + (0.0, np.array([(0, 0), (1, 1), (2, 2), (3, 3)]), np.array([]), {}), # (2) # TP: (Est[1], GT[1]), (Est[2], GT[2]) # FP: (Est[0], None), (Est[3], None) @@ -267,6 +263,7 @@ def test_get_positive_objects(self) -> None: evaluation_task=self.evaluation_task, estimated_objects=estimated_objects, ground_truth_objects=self.dummy_ground_truth_objects, + matching_policy=MatchingPolicy(label_policy="ALLOW_UNKNOWN"), ) tp_results, fp_results = get_positive_objects( object_results, @@ -473,6 +470,7 @@ def test_divide_tp_fp_objects(self): evaluation_task=self.evaluation_task, estimated_objects=estimated_objects, ground_truth_objects=self.dummy_ground_truth_objects, + matching_policy=MatchingPolicy(label_policy="ALLOW_UNKNOWN"), ) tp_results, fp_results = divide_tp_fp_objects( object_results, @@ -485,7 +483,7 @@ def test_divide_tp_fp_objects(self): self.assertEqual( len(tp_results), len(ans_tp_pair_idx), - f"Number of elements are not same, out: {len(tp_results)}, ans: {len(ans_fp_pair_idx)}", + f"[{n + 1}]: Number of elements are not same, out: {len(tp_results)}, ans: {len(ans_tp_pair_idx)}", ) for i, tp_result_ in enumerate(tp_results): self.assertIn( @@ -504,7 +502,7 @@ def test_divide_tp_fp_objects(self): self.assertEqual( len(fp_results), len(ans_fp_pair_idx), - f"Number of elements are not same, out: {len(fp_results)}, ans: {len(ans_fp_pair_idx)}", + f"[{n + 1}]: Number of elements are not same, out: {len(fp_results)}, ans: {len(ans_fp_pair_idx)}", ) for j, fp_result_ in enumerate(fp_results): self.assertIn( @@ -644,6 +642,7 @@ def test_get_fn_objects_for_different_label(self): evaluation_task=self.evaluation_task, estimated_objects=estimated_objects, ground_truth_objects=self.dummy_ground_truth_objects, + matching_policy=MatchingPolicy(label_policy="ALLOW_UNKNOWN"), ) tp_results, _ = divide_tp_fp_objects( object_results,