Fix confusion matrix update when no predictions are made (#8748)
* Fix confusion matrix update when no predictions are made * Update metrics.py * Simply confusion matrix changes * Simply confusion matrix fix Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>pull/8782/head
parent
587a3a37c5
commit
567397d67a
|
@ -139,6 +139,12 @@ class ConfusionMatrix:
|
|||
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()
|
||||
|
|
Loading…
Reference in New Issue