2019.1.21更新。不需要安装太多依赖库
pip install -r requirements.txt 即可。其中有(但我的torch安装不上)
torch==0.4.0
torchvision
visdom
nibabel
pandas
tqdm
matplotlib
opencv-python
ntpath
有些安装ntpath出问题,这是用于视频演示的,而且不是必要项。作者回应可以根据#153需要还原它。
那不然可以试试单独安装试试看:https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/ntpath/
走了好多弯路啊~~~
1.alphapose
1)Get the code.
git clone -b pytorch https://github.com/MVIG-SJTU/AlphaPose.git
2)Install pytorch 源码安装(命令行安装见2)
chmod +x install.sh
./install.sh
3)Download the models manually: duc_se.pth (Google Drive | Baidu pan), yolov3.weights(Google Drive | Baidu pan). Place them into ./models/sppe
and ./models/yolo
respectively.
2.PyTorch
一定要是0.4.0版本,因为'no_grad'是后来才添加的。 module 'torch' has no attribute 'no_grad'
#查看版本
import torch
print(torch.__version__)
注意:这里可选择CPU版本还是GPU版本,GPU要安装CUDA,CUDNN。见pytorch各个版本安装指令
2.1可以直接用conda安装,建议用这种方法:
conda install pytorch==0.4.0 torchvision cuda80 -c pytorch
执行命令后可以看到对应的版本说明。要把各个版本一致。
cuda80: 1.0-h205658b_0 pytorch
cudatoolkit: 8.0-3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
ninja: 1.8.2-py36h6bb024c_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pytorch: 0.4.1-py36_cuda8.0.61_cudnn7.1.2_1 pytorch [cuda80]
torchvision: 0.2.1-py36_1 pytorch
## Package Plan ##
environment location: /home/vivian/anaconda3/envs/py36_torch4.0
added / updated specs:
- cuda80
- pytorch==0.4.0
- torchvision
The following packages will be downloaded:
package | build
---------------------------|-----------------
cudatoolkit-8.0 | 3 322.4 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
pytorch-0.4.0 |py36_cuda8.0.61_cudnn7.1.2_1 390.8 MB pytorch
------------------------------------------------------------
Total: 713.2 MB
The following NEW packages will be INSTALLED:
blas: 1.0-mkl defaults
cffi: 1.11.5-py36he75722e