`cv2.resize` interpolation fix (#7903)
Fix for https://github.com/ultralytics/yolov5/discussions/7901
This commit is contained in:
parent
43569d53da
commit
a9a92aec5c
|
|
@ -663,7 +663,7 @@ class LoadImagesAndLabels(Dataset):
|
||||||
h0, w0 = im.shape[:2] # orig hw
|
h0, w0 = im.shape[:2] # orig hw
|
||||||
r = self.img_size / max(h0, w0) # ratio
|
r = self.img_size / max(h0, w0) # ratio
|
||||||
if r != 1: # if sizes are not equal
|
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)
|
im = cv2.resize(im, (int(w0 * r), int(h0 * r)), interpolation=interp)
|
||||||
return im, (h0, w0), im.shape[:2] # im, hw_original, hw_resized
|
return im, (h0, w0), im.shape[:2] # im, hw_original, hw_resized
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue