Plot `AutoShape()` detections in ascending order ()

pull/3845/head
Glenn Jocher 2021-06-30 15:10:40 +02:00 committed by GitHub
parent 7d6af69638
commit 25d1f2932c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
models

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])