From 34ddceea899defdc2e9b397cffb2fbf9d428aedf Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 17 Jul 2019 14:00:50 +0200 Subject: [PATCH] updates --- utils/datasets.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/datasets.py b/utils/datasets.py index 13ab07fc..8587c539 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -277,7 +277,11 @@ class LoadImagesAndLabels(Dataset): # for training/testing if img is None: img = cv2.imread(img_path) # BGR assert img is not None, 'File Not Found ' + img_path - if self.n < 1001: + if self.n < 2001: + r = self.img_size / max(img.shape) # ratio + if r < 1: # downsize image and cache in RAM for future + h, w, _ = img.shape + img = cv2.resize(img, (int(w*r), int(h*r)), interpolation=cv2.INTER_AREA) # resized, no border self.imgs[index] = img # cache image into memory # Augment colorspace