Skip to content

Commit

Permalink
don't resize up in load_image if augmenting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshSong authored and glenn-jocher committed Apr 21, 2021
1 parent f7bc685 commit 6ba3c84
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,8 @@ def load_image(self, index):
assert img is not None, 'Image Not Found ' + path
h0, w0 = img.shape[:2] # orig hw
r = self.img_size / max(h0, w0) # resize image to img_size
if r != 1: # always resize down, only resize up if training with augmentation
interp = cv2.INTER_AREA if r < 1 and not self.augment else cv2.INTER_LINEAR
if r < 1 or (r > 1 and not self.augment): # always resize down, only resize up if training with augmentation
interp = cv2.INTER_AREA if r < 1 else cv2.INTER_LINEAR
img = cv2.resize(img, (int(w0 * r), int(h0 * r)), interpolation=interp)
return img, (h0, w0), img.shape[:2] # img, hw_original, hw_resized
else:
Expand Down

0 comments on commit 6ba3c84

Please sign in to comment.