From 06521cf9e8fa33416f5a3f1b9fc1075dbaeba712 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 1 Sep 2021 16:30:14 +0200 Subject: [PATCH] Fix `is_coco` on missing `data['val']` key (#4642) --- val.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/val.py b/val.py index cbee8cf1c026..1aa37d12dfac 100644 --- a/val.py +++ b/val.py @@ -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()