glenn-jocher
commited on
Commit
•
e27ca0d
1
Parent(s):
095d2c1
Update minimum stride to 32 (#2266)
Browse files
test.py
CHANGED
@@ -52,7 +52,8 @@ def test(data,
|
|
52 |
|
53 |
# Load model
|
54 |
model = attempt_load(weights, map_location=device) # load FP32 model
|
55 |
-
|
|
|
56 |
|
57 |
# Multi-GPU disabled, incompatible with .half() https://github.com/ultralytics/yolov5/issues/99
|
58 |
# if device.type != 'cpu' and torch.cuda.device_count() > 1:
|
@@ -85,7 +86,7 @@ def test(data,
|
|
85 |
if device.type != 'cpu':
|
86 |
model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters()))) # run once
|
87 |
path = data['test'] if opt.task == 'test' else data['val'] # path to val/test images
|
88 |
-
dataloader = create_dataloader(path, imgsz, batch_size,
|
89 |
prefix=colorstr('test: ' if opt.task == 'test' else 'val: '))[0]
|
90 |
|
91 |
seen = 0
|
|
|
52 |
|
53 |
# Load model
|
54 |
model = attempt_load(weights, map_location=device) # load FP32 model
|
55 |
+
gs = max(int(model.stride.max()), 32) # grid size (max stride)
|
56 |
+
imgsz = check_img_size(imgsz, s=gs) # check img_size
|
57 |
|
58 |
# Multi-GPU disabled, incompatible with .half() https://github.com/ultralytics/yolov5/issues/99
|
59 |
# if device.type != 'cpu' and torch.cuda.device_count() > 1:
|
|
|
86 |
if device.type != 'cpu':
|
87 |
model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters()))) # run once
|
88 |
path = data['test'] if opt.task == 'test' else data['val'] # path to val/test images
|
89 |
+
dataloader = create_dataloader(path, imgsz, batch_size, gs, opt, pad=0.5, rect=True,
|
90 |
prefix=colorstr('test: ' if opt.task == 'test' else 'val: '))[0]
|
91 |
|
92 |
seen = 0
|
train.py
CHANGED
@@ -161,7 +161,7 @@ def train(hyp, opt, device, tb_writer=None, wandb=None):
|
|
161 |
del ckpt, state_dict
|
162 |
|
163 |
# Image sizes
|
164 |
-
gs = int(model.stride.max()) # grid size (max stride)
|
165 |
nl = model.model[-1].nl # number of detection layers (used for scaling hyp['obj'])
|
166 |
imgsz, imgsz_test = [check_img_size(x, gs) for x in opt.img_size] # verify imgsz are gs-multiples
|
167 |
|
|
|
161 |
del ckpt, state_dict
|
162 |
|
163 |
# Image sizes
|
164 |
+
gs = max(int(model.stride.max()), 32) # grid size (max stride)
|
165 |
nl = model.model[-1].nl # number of detection layers (used for scaling hyp['obj'])
|
166 |
imgsz, imgsz_test = [check_img_size(x, gs) for x in opt.img_size] # verify imgsz are gs-multiples
|
167 |
|