From 25d1f2932c37a0b7cf7bf32e8cdcfb14dd5d3657 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 30 Jun 2021 15:10:40 +0200 Subject: [PATCH] Plot `AutoShape()` detections in ascending order (#3843) --- models/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/common.py b/models/common.py index 96d63a07a1b1..5ffb8440b60f 100644 --- a/models/common.py +++ b/models/common.py @@ -311,7 +311,7 @@ def display(self, pprint=False, show=False, save=False, crop=False, render=False 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])