Update val.py `pad = 0.0 if task == speed else 0.5` (#5121)

* Update val.py `pad = 0.0 if task == speed else 0.5`

* Cleanup
pull/5127/head
Glenn Jocher 2021-10-10 23:20:42 -07:00 committed by GitHub
parent ba4b79de8b
commit 7d37b3c52e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

3
val.py
View File

@ -147,8 +147,9 @@ def run(data,
if not training:
if device.type != 'cpu':
model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters()))) # run once
pad = 0.0 if task == 'speed' else 0.5
task = task if task in ('train', 'val', 'test') else 'val' # path to train/val/test images
dataloader = create_dataloader(data[task], imgsz, batch_size, gs, single_cls, pad=0.5, rect=True,
dataloader = create_dataloader(data[task], imgsz, batch_size, gs, single_cls, pad=pad, rect=True,
prefix=colorstr(f'{task}: '))[0]
seen = 0