KeyError: 'ImageClassifier is not in the model registry. Please check whether the value of `ImageClassifier` 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'
Branch
main branch (mmpretrain version)
Describe the bug
model settings
model = dict( type='ImageClassifier', backbone=dict( type='ResNeSt', depth=50, num_stages=4, out_indices=(3, ), style='pytorch'), neck=dict(type='GlobalAveragePooling'), head=dict( type='LinearClsHead', num_classes=3, in_channels=2048, loss=dict( type='LabelSmoothLoss', label_smooth_val=0.1, num_classes=3, reduction='mean', loss_weight=1.0), topk=(1, 5), cal_acc=False), train_cfg=dict(augments=dict(type='Mixup', alpha=0.2)), init_cfg = dict(type='Pretrained',checkpoint='/data/image_lassification/mmpretrain-main/resnet50_8xb32_in1k_20210831-ea4938fc.pth') )
Environment
absl-py 1.1.0 addict 2.4.0 aiobotocore 2.4.2 aiohttp 3.8.4 aiohttp-retry 2.8.3 aioitertools 0.11.0 aiosignal 1.3.1 appdirs 1.4.4 argon2-cffi 21.3.0 argon2-cffi-bindings 21.2.0 async-timeout 4.0.2 asyncssh 2.13.1 asynctest 0.13.0 atpublic 3.1.1 attrs 21.4.0 av 9.2.0 backcall 0.2.0 beautifulsoup4 4.11.1 black 22.3.0 bleach 5.0.0 boto3 1.24.59 botocore 1.27.59 cached-property 1.5.2 cachetools 5.2.0 certifi 2022.6.15 cffi 1.15.0 charset-normalizer 2.1.0 click 8.1.3 colorama 0.4.5 commonmark 0.9.1 ConfigArgParse 1.5.3 configobj 5.0.8 cryptography 39.0.1 cycler 0.11.0 dash 2.8.1 dash-core-components 2.0.0 dash-html-components 2.0.0 dash-table 5.0.0 debugpy 1.6.0 decorator 5.1.1 defusedxml 0.7.1 Deprecated 1.2.13 descartes 1.1.0 dictdiffer 0.9.0 diskcache 5.4.0 distro 1.8.0 dpath 2.1.4 dulwich 0.21.3 dv 1.0.11 dvc 2.10.2 dvc-render 0.0.5 dvclive 0.9.0 entrypoints 0.4 et-xmlfile 1.1.0 fastjsonschema 2.15.3 fire 0.4.0 flake8 4.0.1 Flask 2.2.3 flatbuffers 23.1.21 flatten-dict 0.4.2 flufl.lock 7.1.1 fonttools 4.33.3 frozenlist 1.3.3 fsspec 2023.1.0 ftfy 6.1.1 funcy 1.18 future 0.18.3 gevent 22.10.2 gitdb 4.0.10 GitPython 3.1.31 google-auth 2.8.0 google-auth-oauthlib 0.4.6 grandalf 0.6 greenlet 2.0.2 grpcio 1.47.0 idna 3.3 imageio 2.19.3 importlib-metadata 4.2.0 importlib-resources 5.8.0 iniconfig 1.1.1 ipykernel 6.15.0 ipython 7.34.0 ipython-genutils 0.2.0 ipywidgets 7.7.1 itsdangerous 2.1.2 jedi 0.18.1 Jinja2 3.1.2 jmespath 1.0.1 joblib 1.1.0 jsonschema 4.6.0 jupyter 1.0.0 jupyter-client 7.3.4 jupyter-console 6.4.4 jupyter-core 4.10.0 jupyterlab-pygments 0.2.2 jupyterlab-widgets 1.1.1 kiwisolver 1.4.3 llvmlite 0.36.0 lxml 4.9.2 lyft-dataset-sdk 0.0.8 lz4 4.3.2 mailchecker 5.0.7 Markdown 3.3.4 MarkupSafe 2.1.1 matplotlib 3.5.2 matplotlib-inline 0.1.3 mccabe 0.6.1 mistune 0.8.4 mmcv-full 1.5.1 mmdet 2.24.1 /home/niuniu/Project/retraining_mmdet mmengine 0.7.4 model-index 0.1.11 multidict 6.0.4 mypy-extensions 0.4.3 nanotime 0.5.2 nbclient 0.6.4 nbconvert 6.5.0 nbformat 5.5.0 nest-asyncio 1.5.5 networkx 2.6.3 notebook 6.4.12 numba 0.53.0 numpy 1.21.6 nuscenes-devkit 1.1.9 oauthlib 3.2.0 open3d 0.16.0 opencv-python 4.6.0.66 openmim 0.1.5 openpyxl 3.1.1 ordered-set 4.1.0 packaging 21.3 pandas 1.3.5 pandocfilters 1.5.0 parso 0.8.3 pathspec 0.9.0 pexpect 4.8.0 phonenumbers 8.13.6 pickleshare 0.7.5 Pillow 8.4.0 pip 21.2.2 platformdirs 2.5.2 plotly 5.9.0 pluggy 1.0.0 plyfile 0.7.4 prometheus-client 0.14.1 prompt-toolkit 3.0.29 protobuf 3.19.4 psutil 5.9.1 ptyprocess 0.7.0 py 1.11.0 pyasn1 0.4.8 pyasn1-modules 0.2.8 pybboxes 0.1.5 pycocotools 2.0.4 pycodestyle 2.8.0 pycparser 2.21 pydot 1.4.2 pyflakes 2.4.0 pygit2 1.10.1 Pygments 2.12.0 pygtrie 2.5.0 pymap3d 2.9.1 pyparsing 3.0.9 pyquaternion 0.9.9 pyrsistent 0.18.1 pytest 7.1.2 python-benedict 0.26.0 python-dateutil 2.8.2 python-fsutil 0.10.0 python-slugify 6.1.2 pytz 2022.1 PyWavelets 1.3.0 PyYAML 6.0 pyzmq 23.2.0 qtconsole 5.3.1 QtPy 2.1.0 requests 2.28.1 requests-oauthlib 1.3.1 rich 12.4.4 rsa 4.8 ruamel.yaml 0.17.21 ruamel.yaml.clib 0.2.7 s3fs 2023.1.0 s3transfer 0.6.0 scikit-image 0.19.3 scikit-learn 1.0.2 scipy 1.7.3 scmrepo 0.0.19 Send2Trash 1.8.0 setuptools 61.2.0 Shapely 1.8.2 shortuuid 1.0.11 shtab 1.5.8 six 1.16.0 smmap 5.0.0 soupsieve 2.3.2.post1 tabulate 0.8.10 tenacity 8.0.1 tensorboard 2.9.1 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.1 termcolor 1.1.0 terminado 0.15.0 terminaltables 3.1.10 text-unidecode 1.3 threadpoolctl 3.1.0 tifffile 2021.11.2 tinycss2 1.1.1 toml 0.10.2 tomli 2.0.1 torch 1.10.1+cu111 torchaudio 0.10.1+rocm4.1 torchvision 0.11.2+cu111 tornado 6.1 tqdm 4.64.0 traitlets 5.3.0 trimesh 2.35.39 typed-ast 1.5.4 typing_extensions 4.1.1 urllib3 1.26.9 voluptuous 0.13.1 wcwidth 0.2.5 webencodings 0.5.1 Werkzeug 2.2.3 wheel 0.37.1 widgetsnbextension 3.6.1 wrapt 1.14.1 xlrd 2.0.1 xmltodict 0.13.0 yapf 0.32.0 yarl 1.8.2 zc.lockfile 2.0 zipp 3.8.0 zope.event 4.6 zope.interface 5.5.2 zstd 1.5.4.0
Other information
训练时出现这个错误
I reinstalled MMPretrain as a third-party package using mim install "mmpretrain>=1.0.0rc8" and it worked
mark
I tried to set default_scope = 'mmpretrain', and it worked for me! You can have a try, good luck!
check your config file and note this:
default_runtime.py whether has default_scope = 'mmpretrain' ,otherwise the scope default be mmengine