Skip to content

Commit

Permalink
test: update test
Browse files Browse the repository at this point in the history
Signed-off-by: ktro2828 <[email protected]>
  • Loading branch information
ktro2828 committed Jan 1, 2024
1 parent 25553f0 commit b45762b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions perception_eval/test/matching/test_objects_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b45762b

Please sign in to comment.