This commit is contained in:
Glenn Jocher 2020-01-11 20:13:29 -08:00
parent 4b56a370e6
commit 77034467f6
1 changed files with 2 additions and 1 deletions

View File

@ -515,7 +515,8 @@ def load_image(self, index):
h0, w0 = img.shape[:2] # orig hw h0, w0 = img.shape[:2] # orig hw
r = self.img_size / max(h0, w0) # resize image to img_size r = self.img_size / max(h0, w0) # resize image to img_size
if r < 1 or (self.augment and (r != 1)): # always resize down, only resize up if training with augmentation if r < 1 or (self.augment and (r != 1)): # always resize down, only resize up if training with augmentation
img = cv2.resize(img, (int(w0 * r), int(h0 * r)), interpolation=cv2.INTER_LINEAR) # _LINEAR fastest interp = cv2.INTER_LINEAR if self.augment else cv2.INTER_AREA # LINEAR for training, AREA for testing
img = cv2.resize(img, (int(w0 * r), int(h0 * r)), interpolation=interp)
return img, (h0, w0), img.shape[:2] # img, hw_original, hw_resized return img, (h0, w0), img.shape[:2] # img, hw_original, hw_resized
else: else:
return self.imgs[index], self.img_hw0[index], self.img_hw[index] # img, hw_original, hw_resized return self.imgs[index], self.img_hw0[index], self.img_hw[index] # img, hw_original, hw_resized