[Fix] Fix bug in `1-benchmark_valid.py` if checkpoint_root is None. (#489)

pull/467/head
Ma Zerun 2021-10-25 12:01:03 +08:00 committed by GitHub
parent 77a3834531
commit 08bf04e5ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -182,12 +182,13 @@ def main(args):
if args.checkpoint_root is not None:
root = Path(args.checkpoint_root)
checkpoint = root / model_info.Weights[len(http_prefix):]
checkpoint = str(checkpoint)
else:
checkpoint = None
try:
# build the model from a config file and a checkpoint file
result = inference(MMCLS_ROOT / config, str(checkpoint),
result = inference(MMCLS_ROOT / config, checkpoint,
classes_map[dataset], args)
result['valid'] = 'PASS'
except Exception as e: