mmpose
mmpose copied to clipboard
[Docs] Installation documentation does not create a working demo
📚 The doc issue
Following the documentation at https://mmpose.readthedocs.io/en/latest/installation.html verbatim does not produce a functional demo script.
There are mismatches of versions when trying to setup all the dependencies (mmengine, mmcv, mmdev, mmpose). Not specifying specific versions and relying on latest for all also doesn't work.
The first issue encountered starts at Step 3 running mim install "mmdet>=3.1.0"
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. mmdet 3.3.0 requires mmcv<2.2.0,>=2.0.0rc4; extra == "mim", but you have mmcv 2.2.0 which is incompatible.
The next section with Notes on how to resolve version mismatch conflicts is a bit confusing. It took ChatGPT reading it twice to understand a proper set of version numbers to install for each package. The <=> symbol suggests to me that a version less than, equal to, or greater than is acceptable which makes no sense, maybe thats just me.
The next issue encountered is running mim install "mmpose>=1.1.0"
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. mmpose 1.3.2 requires mmdet<3.3.0,>=3.0.0; extra == "mim", but you have mmdet 3.3.0 which is incompatible.
The last error comes when attempting to run the code listed under Verify the Installation (Option B)
File "xtcocotools/_mask.pyx", line 1, in init xtcocotools._mask ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
After debugging all these issues, getting versions of everything that do work with each other, including subdependencies like numpy and xtcocotools, the code will run but I get the following warning and error, it still does not work:
.../mmengine/optim/optimizer/zero_optimizer.py:11: DeprecationWarning:
TorchScriptsupport for functional optimizers is deprecated and will be removed in a future PyTorch release. Consider using thetorch.compileoptimizer instead.
The model and loaded state dict do not match exactly unexpected key in source state_dict: data_preprocessor.mean, data_preprocessor.std
I'm unsure where to move forward from here.
Suggest a potential alternative/fix
Please update the docs with correct working compatible versions and/or a simplified minimum viable setup process
Ubuntu Linux 22.04 Python 3.10.12
Thanks for your time.
I am also facing the same issue , How did you solve it? using windows 11 and python 3.12.4
create a .venv and instead using mim to install clone mmdet from github and install it. if you still get the error let me know it worked for me
@ablankenship10 I also had problems following the docs. This is what worked for me (Ubuntu 22.04):
conda create -n mmpose-env python=3.8
conda activate mmpose-env
conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=11.8 -c pytorch -c nvidia
pip install -U openmim
# Since there was a warning that pytorch requires fsspec which is not installed
conda install fsspec -c conda-forge
mim install mmengine
# We need to specify version, otherwise it installs the latest, which is not compatible
mim install "mmcv==2.1.0"
mim install mmdet
# Installing mmpose from source
git clone https://github.com/open-mmlab/mmpose.git
cd mmpose
pip install -r requirements.txt
pip install -v -e .
# Running the demo
python demo/image_demo.py tests/data/coco/000000000785.jpg td-hm_hrnet-w48_8xb32-210e_coco-256x192.py td-hm_hrnet-w48_8xb32-210e_coco-256x192-0e67c616_20220913.pth --out-file vis_results.jpg --draw-heatmap
# Finally, all works but Pytorch produces a warning "UserWarning: Applied workaround for CuDNN issue, install nvrtc.so"
# To fix it, go to environment's lib directory and create a symbolic link
cd $CONDA_PREFIX/lib && sudo ln -sfn libnvrtc.so.11.8.89 libnvrtc.so
create a .venv and instead using mim to install clone mmdet from github and install it. if you still get the error let me know it worked for me
How did you installed it after cloning it, it has too much of file in it..
create a .venv and instead using mim to install clone mmdet from github and install it. if you still get the error let me know it worked for me
How did you installed it after cloning it, it has too much of file in it..
well it is mentioned in the installation guides how to install with source. Anyways i found major issue in installation is with version mismatch with each other specially mmcv and pytorch. Be sure which which mmcv version you need and install it with supported torch https://mmcv.readthedocs.io/en/latest/get_started/installation.html
Thanks for help. I am running the code on Colab , hence I followed to install mmcv from the source ,but when i run the inference, or running the training file , it is giving me registry error. Can you please know what steps you followed for installation. Also , I have installed mmcv from the source which took me 40 minutes for the build setup. I am getting that status below after the installation from the source : Environment information:
sys.platform: linux Python: 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0] CUDA available: True MUSA available: False numpy_random_seed: 2147483648 GPU 0: Tesla T4 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 12.2, V12.2.140 GCC: x86_64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 PyTorch: 2.4.0+cu121 PyTorch compiling details: PyTorch built with:
- GCC 9.3
- C++ Version: 201703
- Intel(R) oneAPI Math Kernel Library Version 2022.2-Product Build 20220804 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v3.4.2 (Git Hash 1137e04ec0b5251ca2b4400a4fd3c667ce843d67)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- LAPACK is enabled (usually provided by MKL)
- NNPACK is enabled
- CPU capability usage: AVX512
- CUDA Runtime 12.1
- NVCC architecture flags: -gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_90,code=sm_90
- CuDNN 90.1 (built against CUDA 12.4)
- Magma 2.6.1
- Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=12.1, CUDNN_VERSION=9.1.0, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=pedantic -Wno-error=old-style-cast -Wno-missing-braces -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=2.4.0, USE_CUDA=ON, USE_CUDNN=ON, USE_CUSPARSELT=1, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF,
TorchVision: 0.19.0+cu121 OpenCV: 4.10.0 MMEngine: 0.10.4 MMCV: 2.2.0 MMCV Compiler: GCC 11.4 MMCV CUDA Compiler: 12.2
For me, on MacOS, mmpose demo does not work:
python demo/image_demo.py \
tests/data/coco/000000000785.jpg \
td-hm_hrnet-w48_8xb32-210e_coco-256x192.py \
td-hm_hrnet-w48_8xb32-210e_coco-256x192-0e67c616_20220913.pth \
--out-file vis_results.jpg \
--draw-heatmap
File "/Users/XXX/work/mmpose/demo/image_demo.py", line 8, in
pip install --upgrade --force-reinstall numpy==1.26.4