有点麻烦,写个流程记录一下
具体步骤
把mmlab的mmpose下载到本地,创建虚拟环境mmlab
// 下载
git clone https://github.com/open-mmlab/mmpose.git
cd mmpose
// 新环境
conda create -n mmlab python=3.8
conda activate mmlab
// 安转pytroch
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
// 安装openmim
pip install openmim
// 安装mmcv-full
pip install mmcv-full==1.3.8 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html
// 安装其他
pip3 install -e .
// 试验是否安装成功
// 下载模型
mim download mmpose --config associative_embedding_hrnet_w32_coco_512x512 --dest .
// test-img
python demo/bottom_up_img_demo.py associative_embedding_hrnet_w32_coco_512x512.py hrnet_w32_coco_512x512-bcb8c247_20200816.pth --img-path tests/data/coco/ --out-img-root vis_results
踩坑1
第一个坑是mmcv-full的版本不对,导致报错undefined symbol:cublasLtHSHMatmulAlgoInit, version libcublasLt.so.11
OSError: /home/lx/anaconda3/envs/mmlab/lib/python3.8/site-packages/torch/lib/../../nvidia/cublas/lib/libcublas.so.11: undefined symbol:cublasLtHSHMatmulAlgoInit, version libcublasLt.so.11
这时候就不能简单的pip install了,要加上版本号,去https://download.openmmlab.com/mmcv/dist/index.html找一下哪个是对应的,我装的是cuda111+torch1.8.0+cp38,所以安装
pip install mmcv-full==1.3.8 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html
备注:mmcv-full版本要mmcv>=1.3.8, <=1.8.0.否则会报错
Traceback (most recent call last):
File "demo/bottom_up_img_demo.py", line 9, in <module>
from mmpose.apis import (inference_bottom_up_pose_model, init_pose_model,
File "/home/lx/PycharmProjects/mmpose-master/mmpose/__init__.py", line 24, in <module>
assert (mmcv_version >= digit_version(mmcv_minimum_version)
AssertionError: MMCV==1.3.3 is used but incompatible. Please install mmcv>=1.3.8, <=1.8.0.
踩坑2
第二个坑是pytorch的版本不对,这个遇到不止一次了,每次还是踩坑里头,原因就是cuda11.1的pytorch安装不能直接硬来,详情自己看官网吧 https://pytorch.org/get-started/locally/
NVIDIA GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
If you want to use the NVIDIA GeForce RTX 3090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/
RuntimeError: CUDA error: no kernel image is available for execution on the device
找到之前的版本列表,找到自己对应的那行就行,
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html