glenn-jocher commited on
Commit
25d1f29
1 Parent(s): 7d6af69

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

Browse files
Files changed (1) hide show
  1. models/common.py +1 -1
models/common.py CHANGED
@@ -311,7 +311,7 @@ class Detections:
311
  n = (pred[:, -1] == c).sum() # detections per class
312
  str += f"{n} {self.names[int(c)]}{'s' * (n > 1)}, " # add to string
313
  if show or save or render or crop:
314
- for *box, conf, cls in pred: # xyxy, confidence, class
315
  label = f'{self.names[int(cls)]} {conf:.2f}'
316
  if crop:
317
  save_one_box(box, im, file=save_dir / 'crops' / self.names[int(cls)] / self.files[i])
 
311
  n = (pred[:, -1] == c).sum() # detections per class
312
  str += f"{n} {self.names[int(c)]}{'s' * (n > 1)}, " # add to string
313
  if show or save or render or crop:
314
+ for *box, conf, cls in reversed(pred): # xyxy, confidence, class
315
  label = f'{self.names[int(cls)]} {conf:.2f}'
316
  if crop:
317
  save_one_box(box, im, file=save_dir / 'crops' / self.names[int(cls)] / self.files[i])