Fix for https://github.com/ultralytics/yolov5/discussions/7901modifyDataloader
@@ -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: |