Skip to content

Commit

Permalink
support single greater/less key
Browse files Browse the repository at this point in the history
  • Loading branch information
ly015 committed Jun 15, 2021
1 parent 07d56e5 commit a99f30d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mmcv/runner/hooks/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from torch.nn.modules.batchnorm import _BatchNorm
from torch.utils.data import DataLoader

from mmcv.utils import is_list_of
from mmcv.utils import is_seq_of
from .hook import Hook


Expand Down Expand Up @@ -118,13 +118,17 @@ def __init__(self,
if greater_keys is None:
self.greater_keys = self._default_greater_keys
else:
assert is_list_of(greater_keys, str)
if not isinstance(greater_keys, (list, tuple)):
greater_keys = (greater_keys, )
assert is_seq_of(greater_keys, str)
self.greater_keys = greater_keys

if less_keys is None:
self.less_keys = self._default_less_keys
else:
assert is_list_of(less_keys, str)
if not isinstance(less_keys, (list, tuple)):
less_keys = (less_keys, )
assert is_seq_of(less_keys, str)
self.less_keys = less_keys

if self.save_best is not None:
Expand Down

0 comments on commit a99f30d

Please sign in to comment.