Skip to content

Commit

Permalink
Fix bugs if a results file has zero TPs
Browse files Browse the repository at this point in the history
  • Loading branch information
holger@nutonomy.com authored and holger@nutonomy.com committed Feb 11, 2019
1 parent 3cc23b6 commit 94544b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python-sdk/nuscenes/eval/nuscenes_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,9 @@ def cummean(x):

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

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

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

Expand Down

0 comments on commit 94544b5

Please sign in to comment.