159 lines
7.9 KiB
YAML
Executable File
159 lines
7.9 KiB
YAML
Executable File
# Evaluation Configuration
|
|
# This configuration file maps to command-line arguments in eval.py
|
|
# All settings can be overridden by command-line arguments
|
|
|
|
# Dataset paths (--det-path, --gt-path)
|
|
# dataset:
|
|
# det_path: "/data1/dongying/Mono3d/G1M3/inference_results/yolov5s-300w-newdata/evalset_roi0" # Root directory containing case folders with txt_results
|
|
# gt_path: "/data1/xdzhu/Testdata_0129" # Root directory containing case folders with labels
|
|
# path_depth: 1 # Directory depth: 1 = det_path/case/txt_results, 2 = det_path/level1/case/txt_results
|
|
|
|
# CNCAP gt_path: "/mnt/mono3d/xdzhu_data/Mono3d/Mono3d_4face_2m_g1m3/driving_png/G1M3_AFS1616"
|
|
|
|
dataset:
|
|
det_path: "/data1/dongying/Mono3d/G1Q3/model_inference/KPI/DL_KPI_SCENE/model_20260403" # Root directory containing case folders with txt_results
|
|
gt_path: "/data1/dongying/Mono3d/G1Q3/dataset_for_evaluation/DL_KPI_SCENE" # Root directory containing case folders with labels
|
|
path_depth: 1 # Directory depth: 1 = det_path/case/txt_results, 2 = det_path/level1/case/txt_results
|
|
det_format: "json" # Detection file format: "auto" (probe json_results/ then txt_results/), "json", or "txt"
|
|
gt_format: "json" # Ground truth file format: "auto" (probe labels_json/ then labels/), "json", or "txt"
|
|
det_subdir: "predictions/roi0" # Relative to each case directory; used before generic json_results/predictions probing
|
|
det_roi_filter: "0" # Only evaluate detections with roi_id="0"; set to null (or remove) to evaluate all ROIs together
|
|
|
|
# Image properties (--img-width, --img-height)
|
|
image:
|
|
width: 1920 # Default: 1920
|
|
height: 1080 # Default: 1080
|
|
|
|
# Model configuration for GT filtering
|
|
model:
|
|
input_size: 768 # Model input width (used for GT min box size calculation)
|
|
min_box_size_at_input_scale: 8 # Minimum box size at model input scale
|
|
#
|
|
# GT filtering threshold is automatically calculated as:
|
|
# min_box_size = min_box_size_at_input_scale * roi_width / model_input_size
|
|
#
|
|
# Examples:
|
|
# - ROI0 (1920->704): 8 * 1920 / 704 ≈ 21.8 pixels at original scale
|
|
# - ROI1 (704->704): 8 * 704 / 704 = 8.0 pixels at original scale
|
|
|
|
# Performance settings
|
|
performance:
|
|
num_workers: 32 # Number of parallel workers (null = auto-detect, 1 = single process)
|
|
# Command-line: --num-workers
|
|
# Recommended: 4-8 for typical workloads
|
|
|
|
# ROI Ground Truth Processing (NEW!)
|
|
roi_gt:
|
|
enabled: true # Enable ROI processing for ground truth
|
|
calib_root: "/data1/dongying/Mono3d/G1Q3/dataset_for_evaluation/DL_KPI_SCENE" # Root path to calibration files (camera4.json)
|
|
roi_config: [1920, 880] # ROI configuration (matches training config)
|
|
roi_bottom_offset: 0 # Pixels to trim from ROI bottom edge (matches training roi_bottom_offset)
|
|
# roi_config can be:
|
|
# - [width, height]: ROI size mode (center crop based on vanishing point)
|
|
# - [x1, y1, x2, y2]: ROI bounds mode (fixed bounds)
|
|
# - dict: {'mode': 'size', 'width': 1920, 'height': 960} or
|
|
# {'mode': 'bounds', 'x1': 0, 'y1': 120, 'x2': 1920, 'y2': 1080}
|
|
#
|
|
# IMPORTANT: This should match the ROI configuration used during training!
|
|
# For ROI0: [1920, 960] with roi_bottom_offset matching training config
|
|
# For ROI1: [704, 352] with roi_bottom_offset: 0
|
|
|
|
# Class definitions
|
|
classes:
|
|
3d_classes: [0, 1, 2, 3, 4, 5, 6, 7, 8] # vehicle, bus, truck, tanker, unknown, pedestrian, bicycle, motorcyclist, tricycle
|
|
2d_classes: [9, 10, 11, 12] # traffic_sign, wheel, plate, face
|
|
class_names:
|
|
0: "vehicle"
|
|
1: "bus"
|
|
2: "truck"
|
|
3: "tanker"
|
|
4: "unknown"
|
|
5: "pedestrian"
|
|
6: "bicycle"
|
|
7: "motorcyclist"
|
|
8: "tricycle"
|
|
9: "traffic_sign"
|
|
10: "wheel"
|
|
11: "plate"
|
|
12: "face"
|
|
# Matching parameters (--iou-threshold)
|
|
matching:
|
|
iou_threshold: 0.5 # Default: 0.5, IoU threshold for 2D matching
|
|
|
|
# 2D metrics configuration (--eval-2d-only, --conf-threshold, --ap-method)
|
|
metrics_2d:
|
|
enabled: true # Set to false with --eval-3d-only
|
|
conf_threshold: 0.27 # Default: 0.5, confidence threshold for precision/recall
|
|
ap_method: "voc2010" # Default: "voc2010", choices: ["voc2010", "coco"]
|
|
# voc2010: 11-point interpolation
|
|
# coco: all-point interpolation
|
|
distance_ranges: # Optional: distance-wise 2D evaluation (in metres, z3d).
|
|
# Only applies to 3D-capable classes (vehicle/pedestrian/bicycle/rider)
|
|
# that carry a ground-truth z3d depth value.
|
|
# Independent from metrics_3d.distance_ranges — use coarser bins here
|
|
# so the per-range GT counts are large enough to be statistically meaningful.
|
|
- [0, 30] # Near range
|
|
- [30, 60] # Mid range
|
|
- [60, 100] # Far range
|
|
- [100, 999] # Extreme range
|
|
lateral_roi: [-15, 15] # Optional: lateral ROI pre-filter (metres, x3d).
|
|
# When set, produces a second evaluation view that restricts all
|
|
# counts (TP/FP/FN/GT) to objects within this lateral range.
|
|
# e.g. [-15, 15] keeps only objects within 15 m of the centre line.
|
|
|
|
# 3D metrics configuration (--eval-3d-only)
|
|
metrics_3d:
|
|
enabled: true # Set to false with --eval-2d-only
|
|
coordinate_system: "camera" # 3D evaluation coordinate system: "camera" or "ego"
|
|
# camera: use GT 3d_ori / Det xyzlhwyaw
|
|
# ego: use GT 3d_ori_ego / Det xyzlhwyaw_ego
|
|
# Note: ego mode requires JSON GT/Det inputs
|
|
heading_tolerance: "both" # Heading error calculation mode (--heading-tolerance)
|
|
# "strict": Standard calculation (default)
|
|
# "relaxed": Consider 180° symmetry for symmetric objects
|
|
# "both": Calculate and report both strict and relaxed metrics
|
|
# Relaxed mode: for errors close to 180°, use min(error, π - error)
|
|
distance_ranges: # Optional: distance-wise evaluation (in meters)
|
|
- [0, 10] # Near range
|
|
- [10, 20]
|
|
- [20, 30]
|
|
- [30, 40] # Medium range
|
|
- [40, 50] # Far range
|
|
- [50, 60]
|
|
- [60, 70] # Far range
|
|
- [70, 80]
|
|
- [80, 90]
|
|
- [90, 100]
|
|
- [100, 999] # Very far range
|
|
lateral_distance_ranges: # Optional: lateral distance-wise evaluation (in meters, x-axis)
|
|
- [-50, -40] # Far left
|
|
- [-40, -30] # Medium left
|
|
- [-30, -20] # Near left far
|
|
- [-20, -10] # Near left medium
|
|
- [-10, 0] # Near left
|
|
- [0, 10] # Near right
|
|
- [10, 20] # Medium right
|
|
- [20, 30] # Near right far
|
|
- [30, 40] # Medium right far
|
|
- [40, 50] # Far right
|
|
|
|
# Output configuration (--output-dir)
|
|
output:
|
|
save_path: "eval_results_multiprocess/yolov5s/{timestamp}" # {timestamp} will be auto-replaced
|
|
formats: ["json", "txt"] # Available: json, txt, csv
|
|
print_details: true # Print detailed per-class metrics
|
|
per_case_reports: true # Generate per-case detailed reports
|
|
|
|
# Command-line override examples:
|
|
# 1. Override paths:
|
|
# python eval_tools/eval.py --config eval_config.yaml --det-path /new/path
|
|
#
|
|
# 2. Override workers:
|
|
# python eval_tools/eval.py --config eval_config.yaml --num-workers 8
|
|
#
|
|
# 3. 2D only evaluation:
|
|
# python eval_tools/eval.py --config eval_config.yaml --eval-2d-only
|
|
#
|
|
# 4. Custom thresholds:
|
|
# python eval_tools/eval.py --config eval_config.yaml --iou-threshold 0.7 --conf-threshold 0.3
|