updates
This commit is contained in:
parent
6a05cf56c2
commit
93c348f353
|
@ -425,7 +425,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
|||
# Letterbox
|
||||
h, w = img.shape[:2]
|
||||
shape = self.batch_shapes[self.batch[index]] if self.rect else self.img_size # final letterboxed shape
|
||||
img, ratio, pad = letterbox(img, shape, auto=False)
|
||||
img, ratio, pad = letterbox(img, shape, auto=False, scaleup=self.augment)
|
||||
|
||||
# Load labels
|
||||
labels = []
|
||||
|
@ -609,16 +609,16 @@ def load_mosaic(self, index):
|
|||
return img4, labels4
|
||||
|
||||
|
||||
def letterbox(img, new_shape=(416, 416), color=(128, 128, 128), auto=True, scaleFill=False, interp=cv2.INTER_AREA):
|
||||
def letterbox(img, new_shape=(416, 416), color=(128, 128, 128),
|
||||
auto=True, scaleFill=False, scaleup=True, interp=cv2.INTER_AREA):
|
||||
# Resize image to a 32-pixel-multiple rectangle https://github.com/ultralytics/yolov3/issues/232
|
||||
shape = img.shape[:2] # current shape [height, width]
|
||||
if isinstance(new_shape, int):
|
||||
new_shape = (new_shape, new_shape)
|
||||
|
||||
# Scale ratio (new / old)
|
||||
scaleup_ok = True
|
||||
r = max(new_shape) / max(shape)
|
||||
if not scaleup_ok: # only scale down
|
||||
if not scaleup: # only scale down, do not scale up (for better test mAP)
|
||||
r = min(r, 1.0)
|
||||
|
||||
# Compute padding
|
||||
|
|
Loading…
Reference in New Issue