-
Notifications
You must be signed in to change notification settings - Fork 21
feat(T4Metric): fix incorrect matching of ground truths #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug in T4Metric where ground truth annotations were loaded directly from JSON files without considering preprocessing steps like truck-trailer merging. The fix loads ground truths from the preprocessed _test_info.pkl file instead, ensuring consistency with how annotations are handled during training. Additionally, the PR significantly improves performance by reducing redundant JSON file loading operations, achieving a 2-3x speedup in metric computation time.
Key changes:
- Ground truths now loaded from preprocessed info files rather than raw JSON annotations
- Boxes are loaded in sensor coordinates and reprojected to global coordinates for evaluation
- Evaluation pipeline restructured to eliminate redundant file loading operations
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| autoware_ml/detection3d/evaluation/t4metric/t4metric.py | Core metric implementation updated to load GTs from info files, add box statistics logging, and restructure evaluation pipeline |
| autoware_ml/detection3d/evaluation/t4metric/loading.py | Removed deprecated GT/prediction loading functions that read from JSON files |
| projects/CenterPoint/configs/t4dataset/Centerpoint/second_secfpn_4xb16_121m_j6gen2_base_amp_t4metric_v2.py | Updated config to provide required metadata for T4MetricV2 |
| projects/CenterPoint/configs/t4dataset/Centerpoint/second_secfpn_4xb16_121m_j6gen2_base_amp.py | Extended Pack3DDetInputs meta_keys to include required transformation matrices |
| projects/CenterPoint/configs/t4dataset/Centerpoint/second_secfpn_4xb16_121m_base_amp_t4metric_v2.py | Updated config to provide required metadata for T4MetricV2 |
| projects/CenterPoint/configs/t4dataset/Centerpoint/second_secfpn_4xb16_121m_base_amp.py | Extended Pack3DDetInputs meta_keys to include required transformation matrices |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
projects/CenterPoint/configs/t4dataset/Centerpoint/second_secfpn_4xb16_121m_j6gen2_base_amp.py
Show resolved
Hide resolved
vividf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
This PR fixes a bug in T4Metric that it doesn't consider the ground truth case of merging truck and trailer. Before this PR,
T4Metricloads ground truths directly from annotations without considering some preprocessing.Since annotations are projected to the sensor coordinate in an info file,
T4Metricwill reproject annotations back to global coordinates when computing metrics. Therefore, it introduces slightly offset, as a result of that, only few boxes (1-2) might get filtered out compared to the previous results, especially,carandtruck.However, it doesn't significantly impact mAP overall.
This PR also significantly reduces inference time for metric computing about 1.5-2 times since we remove repeating loading
.jsonfiles inT4Metric.Change point
_test_info.pklinstead fromjsonfiles [1]t4_evaluate_all_scenes, where it doesn't need a for-loop [4]t4_evaluateto_evaluate_scenes, and call_load_eval_boxesto load Gts and Preds [5]_load_eval_boxestoT4Metricto load Gts and Preds [6]format_result[7]_format_gt_lidar_bboxto format Gt bboxes [8]T4MetricV2[9], [10], [11], [12]Test performed
2025/12/21 02:17:23 - mmengine - INFO - ==== GT boxes info after filtering in evaluation ====
2025/12/21 02:17:23 - mmengine - INFO - class: car: 23898
2025/12/21 02:17:23 - mmengine - INFO - class: pedestrian: 4556
2025/12/21 02:17:23 - mmengine - INFO - class: bus: 957
2025/12/21 02:17:23 - mmengine - INFO - class: truck: 1534
2025/12/21 02:17:23 - mmengine - INFO - class: bicycle: 163
2025/12/21 02:17:23 - mmengine - INFO - ===== End of GT Boxes info ====
2025/12/21 02:17:23 - mmengine - INFO - ==== Est boxes info after filtering in evaluation ====
2025/12/21 02:17:23 - mmengine - INFO - class: pedestrian: 15504
2025/12/21 02:17:23 - mmengine - INFO - class: car: 36363
2025/12/21 02:17:23 - mmengine - INFO - class: bicycle: 302
2025/12/21 02:17:23 - mmengine - INFO - class: truck: 4033
2025/12/21 02:17:23 - mmengine - INFO - class: bus: 1464
2025/12/21 02:17:23 - mmengine - INFO - ===== End of Est Boxes info ====
2025/12/21 02:17:45 - mmengine - INFO - ==== 30 scenes ====
2025/12/21 02:17:45 - mmengine - INFO -
Total mAP: 0.734
mmengine - INFO - Elapsed time: 4183.9590 seconds
2025/12/21 13:05:56 - mmengine - INFO - ==== GT boxes info after filtering in evaluation ====
2025/12/21 13:05:56 - mmengine - INFO - class: car: 23897
2025/12/21 13:05:56 - mmengine - INFO - class: pedestrian: 4556
2025/12/21 13:05:56 - mmengine - INFO - class: bus: 957
2025/12/21 13:05:56 - mmengine - INFO - class: truck: 1548
2025/12/21 13:05:56 - mmengine - INFO - class: bicycle: 163
2025/12/21 13:05:56 - mmengine - INFO - ===== End of GT Boxes info ====
2025/12/21 13:05:56 - mmengine - INFO - ==== Est boxes info after filtering in evaluation ====
2025/12/21 13:05:56 - mmengine - INFO - class: pedestrian: 15504
2025/12/21 13:05:56 - mmengine - INFO - class: car: 36363
2025/12/21 13:05:56 - mmengine - INFO - class: bicycle: 302
2025/12/21 13:05:56 - mmengine - INFO - class: truck: 4033
2025/12/21 13:05:56 - mmengine - INFO - class: bus: 1464
2025/12/21 13:05:56 - mmengine - INFO - ===== End of Est Boxes info ====
2025/12/21 13:06:16 - mmengine - INFO - ==== 30 scenes ====
2025/12/21 13:06:16 - mmengine - INFO -
Total mAP: 0.761
mmengine - INFO - Elapsed time: 2379.7419 seconds
Summary:
mAP: 0.7618, mAPH: 0.7116 (Center Distance BEV)
Elapsed time: 6353.7182 seconds