Fix `is_coco` on missing `data['val']` key (#4642)

pull/4645/head
Glenn Jocher 2021-09-01 16:30:14 +02:00 committed by GitHub
parent 234e8ae6fa
commit fad57c29cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

2
val.py
View File

@ -134,7 +134,7 @@ def run(data,
# Configure
model.eval()
is_coco = type(data['val']) is str and data['val'].endswith('coco/val2017.txt') # COCO dataset
is_coco = isinstance(data.get('val'), str) and data['val'].endswith('coco/val2017.txt') # COCO dataset
nc = 1 if single_cls else int(data['nc']) # number of classes
iouv = torch.linspace(0.5, 0.95, 10).to(device) # iou vector for mAP@0.5:0.95
niou = iouv.numel()