Directory
foreword
1. Use conda to create a virtual environment
2. Install CUDA + Pytorch
Install CUDA + CUDNN
Install pytorch
3. Download the AlphaPose source code and enter the main folder
4. Install AlphaPose
Introduce environment variables
Install
Five, install pytorch3D (optional, can run without installation)
Sixth, record the various error reports of setup.py in the fourth step
7. Summary
Foreword
Recently, because the experiment needs to use a top-down two-dimensional joint detector, I thought of this work three years ago. I didn’t expect to publish TPAMI last year. It is really not easy!
The environment configuration mainly refers to the official documents, and I have made some fine-tuning according to my own environment. There are many configuration tutorials for this job on the Internet. Excellent students turn off the magic, and many inexplicable error reports are caused by magic.
I am currently installing Ubuntu 20.04 on a remote server, and I have installed miniconda3 to facilitate the installation of a virtual environment. Please follow my steps, because the version of pytorch is related to the version of cuda, and the version of the code we need to download is related to the version of pytorch .
1. Use conda to create a virtual environment
conda create -n alphapose python=3.7 -y conda activate alphapose
2. Install CUDA + Pytorch
Install CUDA + CUDNN
Follow this big guy’s blog step by step, after installing CUDA and CUDNN, confirm whether the next version is correct
After installation, the current system configuration is: ubuntu20.04 + cuda10.1 + cudnn7.6.5
Install pytorch
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch
Verify after installation
python import torch torch.cuda.is_available()
If the return value is true, the installation is successful
After installation, the current system configuration is: ubuntu20.04 + cuda10.1 + cudnn7.6.5 + pytorch1.6
3. Download the AlphaPose source code and enter the main folder
Go to the github homepage of alphapose, click branches to select different version codes:
View all versions:
Because our pytorch is version 1.6, download this
The official document is downloaded with the git command. If you often configure the environment, you should know whether the git command is easy to use. I often look at the mood of the network status. I often can’t connect or download for a long time, so I directly download the zip file on github, decompress it, and then upload it to the server. up (dumb but effective)
Enter the main folder, the fourth step is to ensure that it is under the main folder path
cd AlphaPose
4. Install AlphaPose
Introduce environment variables
export PATH=/usr/local/cuda/bin/:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64/:$LD_LIBRARY_PATH
Install
python -m pip install cython sudo apt-get install libyaml-dev python setup.py build develop
5. Install pytorch3D (optional, can run without installation)
Here pip install + git if an error is reported, it is recommended to go directly to the corresponding github homepage to install
conda install -c fvcore -c iopath -c conda-forge fvcore iopath conda install -c bottler nvidiacub pip install git + ssh://[email protected]/facebookresearch/pytorch3d.git@stable
6. Record all kinds of errors in the fourth step setup.py
1) detector/nms/src/nms_kernel.cu:5:10: fatal error: ATen/ceil_div.h: No such file or directory
5 | #include
| ^~~~~~~~~~~~~~~~~
compilation terminated.
error: command ‘/usr/lib/cuda/bin/nvcc’ failed with exit status 1
This error is caused by the mismatch between the installed pytorch version and the downloaded code version. According to the third step of the blog, there should be no such error
2) error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::
Refer to the blog to solve it
3) AssertionError(‘PyTypeTest on non extension type’),
pycocotools is not installed
pip install pycocotools
4)
Install what is missing, pay attention to scipy==1.1.0
pip install easydict pip install halpecocotools pip install opencv-python pip install pyyaml pip install scipy==1.1.0 pip install tensorboardx pip install terminaltables pip install tqdm pip install visdom
5)ImportError: cannot import name ‘get_installed_distributions’ from ‘pip._internal.utils.misc’
The pip version is too new, you need to install the old version
pip install pip==21.2
6) subprocess.CalledProcessError: Command ‘[‘ninja’, ‘-v’]’ returned non-zero exit status 1
Modify setup.py file line212
cmdclass={'build_ext': BuildExtension} //before modification cmdclass={'build_ext': BuildExtension.with_options(use_ninja=False)} //after modification
7) ERROR: Command errored out with exit status 128: git clone -q https://github.com/yanfengliu/cython_bbox.git /tmp/pip-req-build-zj4o99hu Check the logs for full command output.
pip install + git is really easy to report errors in China, just go to the homepage to see how to install it, here
pip install cython_bbox
7. Summary
It should look like this after installation
Using /root/miniconda3/envs/alphapose/lib/python3.7/site-packages
Finished processing dependencies for alphapose==0.5.0 + 5c44745
Finally, download the weight file according to the official document, and the pre-trained model should be able to run out the results. Here is a demo run out result:
Good luck with your research!