From 52d96222bbfa1b1b5a6d4f1086ae9d07b914879f Mon Sep 17 00:00:00 2001 From: malashinroman <30839152+malashinroman@users.noreply.github.com> Date: Sun, 23 Jul 2023 04:51:12 +0300 Subject: [PATCH] add non-fixed path option to coco's instances_val2017.json (#11860) add non-fixed path option fo coco annotations --- val.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/val.py b/val.py index 71268651d29b..8da3ef7667aa 100644 --- a/val.py +++ b/val.py @@ -304,6 +304,8 @@ def run( if save_json and len(jdict): w = Path(weights[0] if isinstance(weights, list) else weights).stem if weights is not None else '' # weights anno_json = str(Path('../datasets/coco/annotations/instances_val2017.json')) # annotations + if not os.path.exists(anno_json): + anno_json = os.path.join(data['path'], 'annotations', 'instances_val2017.json') pred_json = str(save_dir / f'{w}_predictions.json') # predictions LOGGER.info(f'\nEvaluating pycocotools mAP... saving {pred_json}...') with open(pred_json, 'w') as f: