Browse Source

`cv2.resize` interpolation fix (#7903)

Fix for https://github.com/ultralytics/yolov5/discussions/7901
modifyDataloader
Glenn Jocher GitHub 2 years ago
parent
commit
a9a92aec5c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      utils/dataloaders.py

+ 1
- 1
utils/dataloaders.py View File

@@ -663,7 +663,7 @@ class LoadImagesAndLabels(Dataset):
h0, w0 = im.shape[:2] # orig hw
r = self.img_size / max(h0, w0) # ratio
if r != 1: # if sizes are not equal
interp = cv2.INTER_LINEAR if self.augment else cv2.INTER_AREA # random.choice(self.rand_interp_methods)
interp = cv2.INTER_LINEAR if (self.augment or r > 1) else cv2.INTER_AREA
im = cv2.resize(im, (int(w0 * r), int(h0 * r)), interpolation=interp)
return im, (h0, w0), im.shape[:2] # im, hw_original, hw_resized
else:

Loading…
Cancel
Save