alplapose(pytorch version)安装配置

Alphapose(pytorch version)github页面:https://github.com/MVIG-SJTU/AlphaPose/tree/pytorch

搞了双系统win10+ubuntu16.04
在ubuntu16.04内部运行alphapose代码

  • python2.7和python3.5,先安装pip3(python3-pip)
  • 下代码
git clone -b pytorch https://github.com/MVIG-SJTU/AlphaPose.git
  • 安装代码依赖项
pip3 install -r requirements.txt

注意:ntpath总是提示Could not find a version that satisfies the requirement ntpath
单独安装ntpath也没用,上网搜ntpath资料也是少之又少,最后在alphapose的issue中看到有人说ntpath not necessary。fine,不管它!

  • 下载duc_se.pth 和yolov3-spp.weights,分别放入./models/sppe and ./models/yolo文件夹里
    https://pan.baidu.com/s/15jbRNKuslzm5wRSgUVytrA
    https://pan.baidu.com/s/1Zb2REEIk8tcahDa8KacPNA
    (linux不使用百度网盘客户端如何下载资料?)
  • 安装pytorch
pip3 install https://download.pytorch.org/whl/cu80/torch-1.0.0-cp35-cp35m-linux_x86_64.whl 
pip3 install torchvision

期间可能会提示各种缺失,缺啥装啥

  • 测试pytorch是否安装成功
python3
import torch
exit()

如果import torch没有出现错误则安装成功

  • 测试图像(alphapose提供了三张jpg在examples/demo里面,我们直接用来测试)
python3 demo.py --indir examples/demo --outdir examples/res 
  1. 代码运行报错=>缺啥补啥

  2. 可能会提示显卡问题:

    AssertionError:
    Found no NVIDIA driver on your system. Please check that you
    have an NVIDIA GPU and installed a driver from
    http://www.nvidia.com/Download/index.aspx

    解决办法:安装nvidia显卡驱动
    2.1 获取显卡驱动版本号 https://blog.csdn.net/linhai1028/article/details/79445722 (我直接下了最新版本的.run文件)
    2.2 具体安装 https://blog.csdn.net/xunan003/article/details/81665835

  3. 出现runtimeerror问题

    RuntimeError: CUDA out of memory. Tried to allocate 2.00 MiB (GPU 0; 1.96 GiB total capacity; 260.43 MiB already allocated; 640.00 KiB free; 1.32 MiB cached)> RuntimeError: CUDA out of memory. Tried to allocate 2.00 MiB (GPU 0; 1.96 GiB total capacity; 260.43 MiB already allocated; 640.00 KiB free; 1.32 MiB cached)

    解决办法:根据此博客,我将Alphapose/yolo/cfg文件夹中的tiny-yolo-voc.cfg和yolo-voc.cfg文件内的subdivisions=8改成subdivisions=64,重新运行代码成功!(在examples/res中可以看到输出的json文件!)

  4. 其他:ubuntu重启后只剩下一个光标(黑屏)
    解决办法:进入windows,再easybcd中删除linux引导再重新建立引导。

  • 测试代码总结
    测试图像
python3 demo.py --indir ${img_directory} --outdir examples/res 

测试视频以及保存

python3 video_demo.py --video ${path to video} --outdir examples/res --save_video

检测摄像头

python3 webcam_demo.py --webcam 0 --outdir examples/res --vis

参考

https://blog.csdn.net/qq_38522972/article/details/82993216

你可能感兴趣的:(深度学习)