open-mmlab / mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox
https://mmocr.readthedocs.io/en/dev-1.x/
Apache License 2.0
4.37k stars 755 forks source link

[Docs] python tools/test.py configs/textdet/psenet/psenet_r50_fpnf_600e_icdar2015.py epoch_600.pth --save-preds Error when running similar code. The error is: #1901

Open OuXiao514 opened 1 year ago

OuXiao514 commented 1 year ago

Branch

master branch https://mmocr.readthedocs.io/en/latest/

📚 The doc issue

python tools/test.py configs/textdet/psenet/psenet_r50_fpnf_600e_icdar2015.py epoch_600.pth --save-preds Error when running similar code. The error is: Traceback (most recent call last): File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\registry\build_functions.py", line 121, in build_from_cfg obj = obj_cls(*args) # type: ignore File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\runner\loops.py", line 397, in init self.evaluator = runner.build_evaluator(evaluator) # type: ignore File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\runner\runner.py", line 1284, in build_evaluator return Evaluator(evaluator) # type: ignore File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\evaluator\evaluator.py", line 25, in init self.metrics.append(METRICS.build(metric)) File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\registry\registry.py", line 548, in build return self.build_func(cfg, args, **kwargs, registry=self) File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\registry\build_functions.py", line 100, in build_from_cfg raise KeyError( KeyError: 'MultiDatasetsEvaluator is not in the metric registry. Please check whether the value of MultiDatasetsEvaluator is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools/test.py", line 138, in main() File "tools/test.py", line 134, in main runner.test() File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\runner\runner.py", line 1725, in test self._test_loop = self.build_test_loop(self._test_loop) # type: ignore File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\runner\runner.py", line 1532, in build_test_loop loop = LOOPS.build( File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\registry\registry.py", line 548, in build return self.build_func(cfg, *args, **kwargs, registry=self) File "E:\Anaconda3\envs\open-mmlab\lib\site-packages\mmengine\registry\build_functions.py", line 135, in build_from_cfg raise type(e)( KeyError: "class TestLoop in mmengine/runner/loops.py: 'MultiDatasetsEvaluator is not in the metric registry. Please check whether the value of MultiDatasetsEvaluator is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'"

Suggest a potential alternative/fix

No response

SoftSisterRui commented 1 year ago

I have the same error as you.

hatimwen commented 1 year ago

@SoftSisterRui @OuXiao514 It seems that the flag --save-preds and MultiDatasetsEvaluator are not compatible with each other.

I have provided some potential solutions that could be helpful in addressing this issue. You can find them at the following link: https://github.com/open-mmlab/mmocr/issues/1915#issuecomment-1557000811. Feel free to take a look and see if they can assist you.