Skip to content

Commit

Permalink
cv2.resize interpolation fix (ultralytics#7903)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored and tdhooghe committed Jun 10, 2022
1 parent 3cf8e8d commit 3d28a0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def load_image(self, i):
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:
Expand Down

0 comments on commit 3d28a0f

Please sign in to comment.