Skip to content

Commit 94544b5

Browse files
holger@nutonomy.comholger@nutonomy.com
authored andcommitted
Fix bugs if a results file has zero TPs
1 parent 3cc23b6 commit 94544b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python-sdk/nuscenes/eval/nuscenes_eval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,9 @@ def cummean(x):
499499

500500
for metric_name in {key: [] for key in self.metric_names}:
501501
# If no box was predicted for this class, no raw metrics exist and we set secondary metrics to 1.
502+
# Likewise if all predicted boxes are false positives.
502503
metric_vals = raw_metrics[metric_name]
503-
if len(metric_vals) == 0:
504+
if len(metric_vals) == 0 or all(np.isnan(metric_vals)):
504505
tp_metrics[metric_name] = 1
505506
continue
506507

@@ -510,7 +511,6 @@ def cummean(x):
510511

511512
# Normalize and clip metric errors.
512513
metric_bound = self.metric_bounds[metric_name]
513-
assert np.nanmin(metric_vals) >= 0
514514
metric_vals = np.array(metric_vals) / metric_bound # Normalize.
515515
metric_vals = np.minimum(1, metric_vals) # Clip.
516516

0 commit comments

Comments
 (0)