Plot AutoShape() detections in ascending order (#3843)

This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-06-30 15:10:40 +02:00
1 parent 7d6af69638
commit 25d1f2932c
1 file changed
+1 -1
+1 -1
View File
@@ -311,7 +311,7 @@ class Detections:
n = (pred[:, -1] == c).sum() # detections per class
str += f"{n} {self.names[int(c)]}{'s' * (n > 1)}, " # add to string
if show or save or render or crop:
for *box, conf, cls in pred: # xyxy, confidence, class
for *box, conf, cls in reversed(pred): # xyxy, confidence, class
label = f'{self.names[int(cls)]} {conf:.2f}'
if crop:
save_one_box(box, im, file=save_dir / 'crops' / self.names[int(cls)] / self.files[i])