Skip to content

Commit

Permalink
🎨 Exclude some classes from detection evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
atonderski committed Jun 21, 2023
1 parent d23ae77 commit 1ac306a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 7 additions & 1 deletion zod/eval/detection/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@

# Try to evaluate all classes, including subclasses.
all_classes = set(OBJECT_CLASSES + OBJECT_SUBCLASSES)
all_classes -= {"Unclear"}
# Remove classes that
all_classes -= {
"Unclear",
"Vehicle_Other",
"VulnerableVehicle_Other",
"VulnerableVehicle_Wheelchair",
}
EVALUATION_CLASSES = sorted(all_classes)
6 changes: 0 additions & 6 deletions zod/eval/detection/eval_nuscenes_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Callable, Dict

import numpy as np
import tqdm

from zod.eval.detection._nuscenes_eval.common.data_classes import EvalBoxes
from zod.eval.detection._nuscenes_eval.common.utils import center_distance
Expand Down Expand Up @@ -95,24 +94,19 @@ def evaluate_nuscenes_style(
}

evaluated_clses = set(metrics[detection_cfg.dist_ths[0]].keys())
n_eval_steps = len(evaluated_clses) * len(detection_cfg.dist_ths)
pbar = tqdm.tqdm(total=n_eval_steps, desc="Evaluating...", unit="class")
for zod_cls in evaluated_clses:
# They evaluate the ap across all thresholds
for dist_th in detection_cfg.dist_ths:
pbar.set_description(f"Evaluating {zod_cls} AP @ {dist_th:.2f}m...")
detection_metrics.add_label_ap(
detection_name=zod_cls,
dist_th=dist_th,
ap=metrics[dist_th][zod_cls]["ap"],
)
# They evaluate the tp across only one threshold
for metric in VALID_TP_METRICS:
pbar.set_description(f"Evaluating {zod_cls} {metric}...")
detection_metrics.add_label_tp(
zod_cls, metric, metrics[detection_cfg.dist_th_tp][zod_cls][metric]
)
pbar.update(1)

if verbose:
_print_nuscenes_metrics(detection_metrics)
Expand Down

0 comments on commit 1ac306a

Please sign in to comment.