remove _get_metric_scope

pull/789/head
HAOCHENYE 2022-12-06 17:09:20 +08:00
parent 60cfe47a13
commit eeb7a8c5ed
1 changed files with 1 additions and 14 deletions

View File

@ -2,7 +2,6 @@
import os.path as osp
import re
import warnings
from collections import OrderedDict
from math import inf
from pathlib import Path
from typing import Callable, Dict, List, Optional, Sequence, Union
@ -297,18 +296,6 @@ class CheckpointHook(Hook):
"""
self._save_best_checkpoint(runner, metrics)
def _get_metric_score(self, metrics, key_indicator):
eval_res = OrderedDict()
if metrics is not None:
eval_res.update(metrics)
if len(eval_res) == 0:
warnings.warn(
'Since `eval_res` is an empty dict, the behavior to save '
'the best checkpoint will be skipped in this evaluation.')
return None
return eval_res[key_indicator]
def _save_checkpoint(self, runner) -> None:
"""Save the current checkpoint and delete outdated checkpoint.
@ -385,7 +372,7 @@ class CheckpointHook(Hook):
# save best logic
# get score from messagehub
for key_indicator, rule in zip(self.key_indicators, self.rules):
key_score = self._get_metric_score(metrics, key_indicator)
key_score = metrics.get(key_indicator, None)
if len(self.key_indicators) == 1:
best_score_key = 'best_score'