add non-fixed path option to coco's instances_val2017.json (#11860)

add non-fixed path option fo coco annotations
This commit is contained in:
malashinroman authored and GitHub committed 2023-07-23 03:51:12 +02:00
1 parent 485da42273
commit 52d96222bb
1 file changed
+2
+2
View File
@@ -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: