Replace enumerate + index with zip() (#14574)

This commit is contained in:
Kayzwer 2024-07-22 00:01:17 +08:00 committed by GitHub
parent 68f1f326f5
commit e59376b55f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 15 deletions

View file

@ -52,9 +52,7 @@ class NASPredictor(BasePredictor):
orig_imgs = ops.convert_torch2numpy_batch(orig_imgs)
results = []
for i, pred in enumerate(preds):
orig_img = orig_imgs[i]
for pred, orig_img, img_path in zip(preds, orig_imgs, self.batch[0]):
pred[:, :4] = ops.scale_boxes(img.shape[2:], pred[:, :4], orig_img.shape)
img_path = self.batch[0][i]
results.append(Results(orig_img, path=img_path, names=self.model.names, boxes=pred))
return results