ubuntu下alphapose 需要的配置小记

走了好多弯路啊~~~
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.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 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    

关于我的conda install -c pytorch cuda75 

 

2.2

https://conda.anaconda.org/pytorch/linux-64/pytorch-0.4.1-py36_cuda8.0.61_cudnn7.1.2_1.tar.bz2

git clone --recursive https://github.com/pytorch/pytorch 
cd pytorch
python setup.py build
sudo python setup.py install
2.3CPU版本如图

3.torchsample

``bash
$ pip install -e git+https://github.com/ncullen93/torchsample.git#egg=torchsample
```
Or install a tagged release
```bash
$ pip install https://github.com/ncullen93/torchsample/archive/v0.1.3.tar.gz
```
# 然后
$ pip install visdom
$ pip install nibabel
$ pip install h5py  # this will be removed in the formal version
 4.tqdm

  先下载:https://anaconda.org/conda-forge/tqdm
.whl文件是通过Python的pip命令进行安装的。 pip install **.whl

# pull and install in the current directory:
 
pip install -e git+https://github.com/tqdm/tqdm.git@master#egg=tqdm
 
# Latest Conda release
 
conda install -c conda-forge tqdm
 
5.pandas ,matplotlib   

pip install pandas,matplotlib
pip install numpy pyyaml mkl setuptools cmake gcc cff

pip install numpy pyyaml mkl mkl-include setuptools cmake cffi typing

pip install -c mingfeima mkldnn

6.opencv

6.1.dlopen: cannot load any more object with static TLS:看网上解决方法,尝试import torch,cv2是否成功。

故先安装opencv:

sudo -s   #我安装遇到权限问题,都是这样解决的,目前理解是,此指令到达用户root层。不知对不对
conda install -c menpo opencv3 (网上说这种方法会避免读取图片有问题等等)
6.2有种错误,也是opencv的原因:ImportError: No module named 'cv2'

pip install opencv-python
7.hdf5

sudo apt-get install libhdf5-serial-dev hdf5-tools
 
sudo apt-get install luarocks
 
luarocks install hdf5  #这句好像不能用
libreadline.so.6: undefined symbol: PC

8.此处几条条权当记录:GPU控制

因为我不知道怎么才能控制要不要跑cuda版本,所以我看到就记在这里,看能不能得到答案

FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.

进入解压好的文件夹,执行cmake -D WITH_CUDA=OFF .

(darknet安装说明)Once you have CUDA installed, change the first line of the Makefile in the base directory to read:

GPU=1
现在您可以使项目和CUDA将被启用。默认情况下,它将在系统的第0张显卡上运行网络(如果正确安装CUDA,则可以使用nvida -smi列出显卡)。如果你想改变card Darknet的使用,你可以给它一个可选的命令行标志-i ,比如:

./darknet -i 1 imagenet test cfg/alexnet.cfg alexnet.weights
如果您使用CUDA进行编译,但是想要执行CPU计算,无论出于什么原因,您都可以使用-nogpu来代替CPU:

./darknet -nogpu imagenet test cfg/alexnet.cfg alexnet.weights
以下是安装步骤,如果更改,重新make一下。

git clone https://github.com/pjreddie/darknet.git
cd darknet
make
9.关于vs文档配置

ConfigurationName    配置名字,通常是Debug或者Release
IntDir    编译器使用的中间目录,产出obj文件
OutDir    链接器使用的输出目录
ProjectDir    项目目录
ProjectName    项目名字
SolutionDir    解决方案目录
TargetDir    目标输出文件所在的目录
TargetExt    目标输出的扩展名
TargetFileName    目标输出文件名,包括扩展名
TargetName    目标输出名,不包括扩展名
TargetPath    目标输出文件的全路径名
10.cuda

CUDA是要配置的,因为pytorch需要使用;

cudnn version 5
Tensorflow >= 1.2 AND < 1.3 (if you build tensorflow from source the cudnn version isn't as important. installing from pip it becomes VERY important)
Input and output directories for ./run.sh must be relative to the CWD. Absolute paths do not work!
11.说明

11.1路径:这里是相对路径才可以。eg:python3 demo.py --indir ${img_directory} --outdir examples/res

   实际操作为:python3 demo.py --indir examples/demo/ --outdir examples/results/ --vis              (可参见/doc/run.md的说明和例子)

12.opencv-python

Try re-install opencv-python with version >= 3.3.1.11 by

pip uninstall opencv_python
pip install opencv_python --user
Many people meet this problem at https://github.com/opencv/opencv/issues/8471. The solution I use is

sudo cp <path to opencv source repo>/home/helloworld/anaconda3/lib/python3.6/site-packages/cv2.cpython-36m-x86_64-linux-gnu.so /usr/local/lib/python3.5/dist-packages/cv2/cv2.cpython-35m-x86_64-linux-gnu.so
13.运行出现的非常麻烦的错误:

13.1Cannot initialize CUDA without ATen_cuda library........ because you are trying to use some CUDA functionality

解决办法:https://github.com/zdevito/ATen/issues/216

即:加入LD_LIBRARY_PATH路径。具体见https://blog.csdn.net/m0_37644085/article/details/81837410的7.8~7.9

14.关于pyhton

之前安装最新版的3.6的anaconda,但需要3.6的,以防后面补坑,现改为py3.5

conda create -n py35 python=3.5 anaconda
# To activate this environment, use:
# > source activate py35
# To deactivate an active environment, use:
# > source deactivate

error:python3.5/multiprocessing/semaphore_tracker.py:129: UserWarning: semaphore_tracker: There appear to be 3 leaked semaphores to clean up at shutdown

解决方法:我还没解决 这不是个错误~~

https://github.com/jhfjhfj1/autokeras/issues/118

I figured it out for myself. The docker container I was using was 2G memory. I increased it to 16G and restarted the docker image by adding --shm-size 16G when running docker run. It solved my problems.

15.论文阅读:

1.alphapose论文RMPE

人体关键点检测对于描述人体姿态,预测人体行为至关重要。因此人体关键点检测是诸多计算机视觉任务的基础。其在动作分类,异常行为检测,以及人机交互等领域有着很广阔的应用前景,是计算机视觉领域中一个既具有研究价值、同时又极具挑战性的热门课题。针对这一问题,上海交大MVIG组提出RMPE的两步法框架(ICCV 2017论文RMPE),并基于此开发了AlphaPose这一人体关键点检测系统。

RMPE(regional multi-person pose estimation)框架采用自顶向下的方法,先检测人,再去做姿态估计。该框架有三个主要组成部分,首先是对称空间变换网络STN(Symmetric Spatial Transformer Network),用于解决传统两步法中的主要问题,即imperfect proposal的问题。对于质量较差的人体检测结果,symmetric STN能够自动调整proposal的位置,将refine过后的结果输入单人姿态估计网络,并将输出映射回原空间,从而使得在人体检测框不准确的情况下,姿态估计网络依然能够有良好的效果。【论文笔记】Spatial Transformer Networks 【论文笔记】Spatial Transformer Networks

第二个组成部件为由姿态引导的样本生成器PGPG(Pose-guided Proposals Generator),该部件能够根据不同人体姿态生成额外的detection proposal用于训练姿态估计网络,从而获得大量符合真实测试场景数据分布的训练数据。

第三个组成部件为参数化的姿态非极大值抑制器PNMS(Parametric Pose NMS)。传统的两步法中,人体定位框会有较多的冗余检测。作者通过使用新的姿态距离度量来比较姿态相似性,来消除冗余姿态。
--------------------- 
作者:业精于勤荒于嬉-行成于思而毁于随 
来源:CSDN 
原文:https://blog.csdn.net/m0_37644085/article/details/82014704 
版权声明:本文为博主原创文章,转载请附上博文链接!

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值