From 2cf23c4aee2917793f2b1a0a7b5b71cb3bad4b0a Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 10 Apr 2020 18:58:34 -0700 Subject: [PATCH] add MixConv2d() layer --- utils/datasets.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/datasets.py b/utils/datasets.py index 1755b177..e2af1aae 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -507,8 +507,9 @@ def load_image(self, index): assert img is not None, 'Image Not Found ' + img_path h0, w0 = img.shape[:2] # orig hw 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 - img = cv2.resize(img, (int(w0 * r), int(h0 * r)), interpolation=cv2.INTER_LINEAR) + if r < 1 or (self.augment and 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 + 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: return self.imgs[index], self.img_hw0[index], self.img_hw[index] # img, hw_original, hw_resized