mmaction2 icon indicating copy to clipboard operation
mmaction2 copied to clipboard

[Bug] Can‘t use Confusion Matrix as evaluator

Open Aidenxu0305 opened this issue 1 year ago • 0 comments

Branch

main branch (1.x version, such as v1.0.0, or dev-1.x branch)

Prerequisite

Environment

Hello,I am attempting to use the confusion matrix as an output in the model training process.But an error occurred with the checkpoint hook.Please tell me the solution about that,thanks a lot.

Describe the bug

Traceback (most recent call last): File "D:\xzy\mmaction2\tools\train.py", line 135, in main() File "D:\xzy\mmaction2\tools\train.py", line 131, in main runner.train() File "D:\Anaconda\envs\workxzy\lib\site-packages\mmengine\runner\runner.py", line 1749, in train model = self.train_loop.run() # type: ignore File "D:\Anaconda\envs\workxzy\lib\site-packages\mmengine\runner\loops.py", line 102, in run self.runner.val_loop.run() File "D:\Anaconda\envs\workxzy\lib\site-packages\mmengine\runner\loops.py", line 367, in run self.runner.call_hook('after_val_epoch', metrics=metrics) File "D:\Anaconda\envs\workxzy\lib\site-packages\mmengine\runner\runner.py", line 1811, in call_hook getattr(hook, fn_name)(self, **kwargs) File "D:\Anaconda\envs\workxzy\lib\site-packages\mmengine\hooks\checkpoint_hook.py", line 361, in after_val_epoch self._save_best_checkpoint(runner, metrics) File "D:\Anaconda\envs\workxzy\lib\site-packages\mmengine\hooks\checkpoint_hook.py", line 499, in _save_best_checkpoint self._init_rule(self.rules, [list(metrics.keys())[0]]) File "D:\Anaconda\envs\workxzy\lib\site-packages\mmengine\hooks\checkpoint_hook.py", line 630, in _init_rule raise ValueError('Cannot infer the rule for key ' ValueError: Cannot infer the rule for key confusion_matrix/result, thus a specific rule must be specified.

Reproduces the problem - code sample

default_hooks = dict(checkpoint=dict(interval=10), logger=dict(interval=100))

val_evaluator = [dict(type='AccMetric')] test_evaluator = val_evaluator

Reproduces the problem - command or script

No response

Reproduces the problem - error message

No response

Additional information

No response

Aidenxu0305 avatar Sep 20 '23 06:09 Aidenxu0305