updates
This commit is contained in:
+7
-6
@@ -277,12 +277,13 @@ 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 < 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
|
||||
r = self.img_size / max(img.shape) # size ratio
|
||||
if r < 1: # downsize is target shape is smaller
|
||||
h, w, _ = img.shape
|
||||
img = cv2.resize(img, (int(w * r), int(h * r)), interpolation=cv2.INTER_AREA)
|
||||
|
||||
if self.n < 3000: # cache images into memory if image count < 3000
|
||||
self.imgs[index] = img
|
||||
|
||||
# Augment colorspace
|
||||
augment_hsv = True
|
||||
|
||||
Reference in New Issue
Block a user