单目3D初始代码
This commit is contained in:
106
eval_tools/class_config.py
Executable file
106
eval_tools/class_config.py
Executable file
@@ -0,0 +1,106 @@
|
||||
"""
|
||||
Class configuration for the eval_tools evaluation framework.
|
||||
|
||||
This is the single source of truth for all class definitions.
|
||||
To adapt the evaluator to a different class taxonomy, only edit this file.
|
||||
|
||||
Current taxonomy matches ultralytics/cfg/datasets/mono3d_ground.yaml class_map.
|
||||
"""
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ID → display name (used by GT parser, reports, logging)
|
||||
# Keep this aligned with the first-seen canonical name for each ID in
|
||||
# ultralytics/cfg/datasets/mono3d_ground.yaml:class_map.
|
||||
# ---------------------------------------------------------------------------
|
||||
CLASS_NAMES: dict[int, str] = {
|
||||
0: "car",
|
||||
1: "suv",
|
||||
2: "pickup",
|
||||
3: "medium_car",
|
||||
4: "van",
|
||||
5: "bus",
|
||||
6: "truck",
|
||||
7: "special_vehicle",
|
||||
8: "unknown",
|
||||
9: "pedestrian",
|
||||
10: "bicyclist",
|
||||
11: "bicycle",
|
||||
12: "tricycle",
|
||||
13: "traffic_sign",
|
||||
14: "wheel",
|
||||
15: "plate",
|
||||
16: "face",
|
||||
}
|
||||
|
||||
# Total number of classes
|
||||
NUM_CLASSES: int = len(CLASS_NAMES)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Raw label string → ID (used by detection result parser)
|
||||
# Supports all original annotation names that map to the same ID in
|
||||
# ultralytics/cfg/datasets/mono3d_ground.yaml:class_map.
|
||||
# ---------------------------------------------------------------------------
|
||||
CLASS_NAME_TO_ID: dict[str, int] = {
|
||||
"car": 0,
|
||||
"suv": 1,
|
||||
"pickup": 2,
|
||||
"medium_car": 3,
|
||||
"van": 4,
|
||||
"bus": 5,
|
||||
"truck": 6,
|
||||
"tanker": 6,
|
||||
"large_truck": 6,
|
||||
"construction_vehicle": 6,
|
||||
"special_vehicle": 7,
|
||||
"unknown": 8,
|
||||
"pedestrian": 9,
|
||||
"bicyclist": 10,
|
||||
"motorcyclist": 10,
|
||||
"bicycle": 11,
|
||||
"motorcycle": 11,
|
||||
"tricycle": 12,
|
||||
"tricyclist": 12,
|
||||
"traffic_sign": 13,
|
||||
"wheel": 14,
|
||||
"plate": 15,
|
||||
"face": 16,
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 3D-annotated class IDs
|
||||
# face_3d_classes [0-8]: vehicle-like classes with 4-face annotations
|
||||
# (51-col / full JSON face fields)
|
||||
# complete_3d_classes[9-12]: pedestrian / rider / bike / trike classes with
|
||||
# whole-box 3D only (19-col labels)
|
||||
# ---------------------------------------------------------------------------
|
||||
FACE_3D_CLASSES: list[int] = [0, 1, 2, 3, 4, 5, 6, 7, 8]
|
||||
COMPLETE_3D_CLASSES: list[int] = [9, 10, 11, 12]
|
||||
CLASSES_3D: list[int] = FACE_3D_CLASSES + COMPLETE_3D_CLASSES
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Report labels: which 3D classes appear in evaluation reports, and how they
|
||||
# are labelled. vehicle_large / vehicle_small are legacy synthetic keys from
|
||||
# Metrics3D's class-0 size split; under the current taxonomy they are displayed
|
||||
# as CAR_LARGE / CAR_SMALL.
|
||||
# ---------------------------------------------------------------------------
|
||||
REPORT_3D_CLASS_LABELS: dict[str, str] = {
|
||||
"car": "CAR",
|
||||
"vehicle_large": "CAR_LARGE",
|
||||
"vehicle_small": "CAR_SMALL",
|
||||
"suv": "SUV",
|
||||
"pickup": "PICKUP",
|
||||
"medium_car": "MEDIUM_CAR",
|
||||
"van": "VAN",
|
||||
"bus": "BUS",
|
||||
"truck": "TRUCK",
|
||||
"special_vehicle": "SPECIAL_VEHICLE",
|
||||
"unknown": "UNKNOWN",
|
||||
"pedestrian": "PEDESTRIAN",
|
||||
"bicyclist": "BICYCLIST",
|
||||
"bicycle": "BICYCLE",
|
||||
"tricycle": "TRICYCLE",
|
||||
}
|
||||
|
||||
# Ordered list of 3D class keys for iteration in comparison/report scripts.
|
||||
# Includes the legacy size-split sub-buckets immediately after "car".
|
||||
REPORT_3D_CLASS_KEYS: list[str] = list(REPORT_3D_CLASS_LABELS.keys())
|
||||
Reference in New Issue
Block a user