open-mmlab / mmpose

OpenMMLab Pose Estimation Toolbox and Benchmark.
https://mmpose.readthedocs.io/en/latest/
Apache License 2.0
5.55k stars 1.21k forks source link

mmpose 1.x pytorch2onnx #1744

Closed PureHing closed 1 year ago

PureHing commented 1 year ago

@Tau-J Hi, pip list | grep mm :

commonmark             0.9.1
mmcv                   2.0.0rc1
mmcv-full              1.6.2
mmdet                  3.0.0rc1
mmengine               0.2.0
mmpose                 1.0.0rc0

Run python tools/deployment/pytorch2onnx.py configs/** **.pth Some errors:

  1. AssertionError: MMCV==1.6.2 is used but incompatible. Please install mmcv>=2.0.0rc0, <=2.1.0. if pip uninstall mmcv-full here raise AttributeError: module 'mmcv' has no attribute '__version__' here raise ModuleNotFoundError: No module named 'mmcv.image'
  2. If skip version check,raise KeyError: "class TopdownPoseEstimator in mmpose/models/pose_estimators/topdown.py: 'PoseDataPreprocessor is not in the model registry. Please check whether the value of PoseDataPreprocessor is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/tutorials/config.html#import-custom-python-modules'"
Tau-J commented 1 year ago

Hi, thanks for trying mmpose 1.x. I suggest uninstalling both of mmcv-full and mmcv first, and use:

pip install -U openmim
mim install "mmcv>=2.0.0rc1"

to reinstall mmcv

PureHing commented 1 year ago

@Tau-J The first case is solved. still have this error: KeyError: "class TopdownPoseEstimator in mmpose/models/pose_estimators/topdown.py: 'PoseDataPreprocessor is not in the model registry. Please check whether the value of PoseDataPreprocessor is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/tutorials/config.html#import-custom-python-modules'", But there is no problems when I training model.

BTW, tools/deployment this folder does not seem to be updated to the 1.x version, and the same interface as the old version, eg. init_pose_model, but only __all__ = ['init_model', 'inference_topdown'] in 1.x

Tau-J commented 1 year ago

Sorry I don't understand what does there's no problems when training model mean. As for tools/deployment, in mmpose 1.x, we recommend users to use mmdeploy to conduct deployment.

PureHing commented 1 year ago

I have change to V0.29.0. Thanks!

Jwy-jump commented 1 year ago

@ly015 @PureHing I meet the same questions Traceback (most recent call last): File "demo/topdown_demo_with_mmdet.py", line 293, in <module> main() File "demo/topdown_demo_with_mmdet.py", line 183, in main pose_estimator = init_pose_estimator( File "/home/user/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmpose/apis/inference.py", line 101, in init_model model = build_pose_estimator(config.model) File "/home/user/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmpose/models/builder.py", line 35, in build_pose_estimator return POSE_ESTIMATORS.build(cfg) File "/home/user/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/registry.py", line 548, in build return self.build_func(cfg, *args, **kwargs, registry=self) File "/home/user/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 250, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/user/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 144, in build_from_cfg raise type(e)( KeyError: "classTopdownPoseEstimatorin mmpose/models/pose_estimators/topdown.py: 'mmcls.VisionTransformer is not in the model registry. Please check whether the value ofmmcls.VisionTransformeris 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'"

finally, how to solve it? I use mmdeploy to conduct deployment.