Update minimum stride to 32 (#2266)
This commit is contained in:
1 parent
095d2c11d8
commit
e27ca0d845
2 files changed
+4
-3
No files matched your search
@@ -52,7 +52,8 @@ def test(data,
|
|||||||
|
|
||||||
# Load model
|
# Load model
|
||||||
model = attempt_load(weights, map_location=device) # load FP32 model
|
model = attempt_load(weights, map_location=device) # load FP32 model
|
||||||
imgsz = check_img_size(imgsz, s=model.stride.max()) # check img_size
|
gs = max(int(model.stride.max()), 32) # grid size (max stride)
|
||||||
|
imgsz = check_img_size(imgsz, s=gs) # check img_size
|
||||||
|
|
||||||
# Multi-GPU disabled, incompatible with .half() https://github.com/ultralytics/yolov5/issues/99
|
# Multi-GPU disabled, incompatible with .half() https://github.com/ultralytics/yolov5/issues/99
|
||||||
# if device.type != 'cpu' and torch.cuda.device_count() > 1:
|
# if device.type != 'cpu' and torch.cuda.device_count() > 1:
|
||||||
@@ -85,7 +86,7 @@ def test(data,
|
|||||||
if device.type != 'cpu':
|
if device.type != 'cpu':
|
||||||
model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters()))) # run once
|
model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters()))) # run once
|
||||||
path = data['test'] if opt.task == 'test' else data['val'] # path to val/test images
|
path = data['test'] if opt.task == 'test' else data['val'] # path to val/test images
|
||||||
dataloader = create_dataloader(path, imgsz, batch_size, model.stride.max(), opt, pad=0.5, rect=True,
|
dataloader = create_dataloader(path, imgsz, batch_size, gs, opt, pad=0.5, rect=True,
|
||||||
prefix=colorstr('test: ' if opt.task == 'test' else 'val: '))[0]
|
prefix=colorstr('test: ' if opt.task == 'test' else 'val: '))[0]
|
||||||
|
|
||||||
seen = 0
|
seen = 0
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ def train(hyp, opt, device, tb_writer=None, wandb=None):
|
|||||||
del ckpt, state_dict
|
del ckpt, state_dict
|
||||||
|
|
||||||
# Image sizes
|
# Image sizes
|
||||||
gs = int(model.stride.max()) # grid size (max stride)
|
gs = max(int(model.stride.max()), 32) # grid size (max stride)
|
||||||
nl = model.model[-1].nl # number of detection layers (used for scaling hyp['obj'])
|
nl = model.model[-1].nl # number of detection layers (used for scaling hyp['obj'])
|
||||||
imgsz, imgsz_test = [check_img_size(x, gs) for x in opt.img_size] # verify imgsz are gs-multiples
|
imgsz, imgsz_test = [check_img_size(x, gs) for x in opt.img_size] # verify imgsz are gs-multiples
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user