Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ def process_batch(self, detections, labels):
Returns:
None, updates confusion matrix accordingly
"""
if detections is None:
gt_classes = labels.int()
for i, gc in enumerate(gt_classes):
self.matrix[self.nc, gc] += 1 # background FN
return

detections = detections[detections[:, 4] > self.conf]
gt_classes = labels[:, 0].int()
detection_classes = detections[:, 5].int()
Expand Down
2 changes: 2 additions & 0 deletions val.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ def run(
if npr == 0:
if nl:
stats.append((correct, *torch.zeros((2, 0), device=device), labels[:, 0]))
if plots:
confusion_matrix.process_batch(detections=None, labels=labels[:, 0])
continue

# Predictions
Expand Down