Skip to content

Commit

Permalink
When testing my model with tools/test.py, my config will be messed up…
Browse files Browse the repository at this point in the history
… by the "--save-preds" option. (#2052)

* fix tools/test.py

* fix tools/test.py

* Update tools/test.py

---------

Co-authored-by: Tong Gao <[email protected]>
  • Loading branch information
shiyunalex and gaotongxiao authored Jun 2, 2024
1 parent 1d3b1ca commit e9d5b46
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ def main():
if isinstance(cfg.test_evaluator, (list, tuple)):
cfg.test_evaluator = list(cfg.test_evaluator)
cfg.test_evaluator.append(dump_metric)
elif isinstance(cfg.test_evaluator, dict):
if 'metrics' in cfg.test_evaluator:
cfg.test_evaluator['metrics'].append(dump_metric)
else:
cfg.test_evaluator['metrics'] = [dump_metric]
else:
cfg.test_evaluator = [cfg.test_evaluator, dump_metric]

Expand Down

0 comments on commit e9d5b46

Please sign in to comment.