Skip to content

Commit

Permalink
[Fix] cannot to save the best checkpoint when the key_score is None (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
huang-jesse authored and ZwwWayne committed Jul 19, 2022
1 parent 82980ae commit a089d00
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mmdet/core/evaluation/eval_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def _do_evaluate(self, runner):
results = single_gpu_test(runner.model, self.dataloader, show=False)
runner.log_buffer.output['eval_iter_num'] = len(self.dataloader)
key_score = self.evaluate(runner, results)
if self.save_best:
# the key_score may be `None` so it needs to skip the action to save
# the best checkpoint
if self.save_best and key_score:
self._save_ckpt(runner, key_score)


Expand Down Expand Up @@ -122,5 +124,7 @@ def _do_evaluate(self, runner):
runner.log_buffer.output['eval_iter_num'] = len(self.dataloader)
key_score = self.evaluate(runner, results)

if self.save_best:
# the key_score may be `None` so it needs to skip
# the action to save the best checkpoint
if self.save_best and key_score:
self._save_ckpt(runner, key_score)

0 comments on commit a089d00

Please sign in to comment.