• 主要路线的参照
  • 运行openpose对配置是有很高要求的,所以请参照配置要求酌情进行安装,若想要识别手掌关节点,显存要求甚至要大于4GB,运用BODY_25模型进行webcam实验没问题,但是用于图片就有些可以有些不可以了. 所以还是打算在工作站来配置Openpose吧~给大家看看./build/examples/openpose/openpose.bin --hand --face --image_dir examples/media/所需要的显存(cuda9.0 cudnn7.4.1)
  • 并且用anaconda3安装的opencv是无法读取视频的,因为anaconda3安装的opencv没有联合编译ffmpeg.除非用pip安装opencv4+版本的, 但是如此就没有caffe和openpose编译所需要的库了. 所以建议还是用source安装的opencv来编译caffee和openpose.
  • protobuf一定要安装2.6.1的, 不能用anaconda自带的3版本, 因为openpose只兼容2.6.1版本的.

官方教程参照

caffe官方安装教程:

  • http://caffe.berkeleyvision.org/install_apt.html
  • http://caffe.berkeleyvision.org/installation.html

openpose官方教程参照:

  • https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md#installation
  • https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/prerequisites.md

其他参考:
https://blog.csdn.net/yhaolpz/article/details/71375762

安装CUDA和CuDNN

建议安装cuda10和cudnn7.5以上的版本吧,我之前按照别人的教程用cuda9.0和cudnn7.0的版本来配置caffe,会出现一堆问题。可能是因为GTX1650的计算架构是compute_75, 太新了~
安装教程就不贴出来了,csdn很多大神都有

caffe编译

创建anaconda3环境:

conda create -n caffe-py2.7.15-pr2.6.1 python=2.7.15

下载caffe源代码:

cd ~/anaconda3/envs/caffe-py2.7.15-pr2.6.1/
git clone https://github.com/BVLC/caffe.git

今天是2019.10.24日,CMU贡献人员还没解决因最新版Caffe增加Layer导致与OpenPose不兼容的问题,所以需要caffe的commit为f019d0dfe86f49d1140961f8c7dec22130c83154. 需要执行此步,不然后面openpose编译的时候会出错

cd caffe/
git checkout f019d0dfe86f49d1140961f8c7dec22130c83154

安装依赖(有些其实后面anaconda3会进行安装, 但是装了也没太大问题):

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y build-essential cmake git pkg-config
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev protobuf-compiler
sudo apt-get install -y libatlas-base-dev
sudo apt-get install -y --no-install-recommends libboost-all-dev
sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev
sudo apt-get install -y libopencv-dev libhdf5-serial-dev
sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
conda install scikit-image scikit-learn pandas
pip install jupyter
pip install easydict
pip install lxml
pip install seaborn
pip install tqdm

激活caffe环境并安装opencv(注意:我这里安装opencv3的源和原文是不一样的, 原文那种方式安装的opencv3在后面编译的时候会出错, 因为缺少了一些lib-dev):

source activate caffe-py2.7.15-pr2.6.1
conda install -c menpo opencv3

确保caffe的conda list内没有libprotobuf和protobuf这两个库,有的话就卸载掉. 然后用apt安装protobuf2.6.1(前面装依赖的时候装了)

然后就进入~/.bashrc中注释掉anaconda3相关环境,用系统的protobuf等库来编译caffe:

gedit ~/.bashrc
#注释完之后
source ~/.bashrc

进入Caffe目录:

cd xxx/envs/caffe-py2.7.15-pr2.6.1/caffe

修改重要的编译文件,执行:

cp Makefile.config.example Makefile.config
gedit Makefile.config

我的Makefile.config如下:

## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0
# This code is taken from https://github.com/sh1r0/caffe-android-lib
# USE_HDF5 := 0# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
#   You should not set this flag if you will be reading LMDBs with any
#   possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 3# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
# CUSTOM_CXX := g++# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH :=   -gencode arch=compute_30,code=sm_30 \-gencode arch=compute_35,code=sm_35 \-gencode arch=compute_50,code=sm_50 \-gencode arch=compute_52,code=sm_52 \-gencode arch=compute_60,code=sm_60 \-gencode arch=compute_61,code=sm_61 \-gencode arch=compute_61,code=compute_61# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := atlas
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas# Homebrew puts openblas in a directory that is not on the standard search path
# BLAS_INCLUDE := $(shell brew --prefix openblas)/include
# BLAS_LIB := $(shell brew --prefix openblas)/lib# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
# MATLAB_DIR := /usr/local
# MATLAB_DIR := /Applications/MATLAB_R2012b.app# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
# PYTHON_INCLUDE := /usr/include/python2.7 \
#       /usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
ANACONDA_HOME := $(HOME)/Software/anaconda3/envs/caffe-py2.7.15-pr2.6.1
PYTHON_INCLUDE := $(ANACONDA_HOME)/include \$(ANACONDA_HOME)/include/python2.7 \$(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include# Uncomment to use Python 3 (default is Python 2)
# PYTHON_LIBRARIES := boost_python3 python3.5m
# PYTHON_INCLUDE := /usr/include/python3.5m \
#                 /usr/lib/python3.5/dist-packages/numpy/core/include# We need to be able to find libpythonX.X.so or .dylib.
# PYTHON_LIB := /usr/lib
PYTHON_LIB := $(ANACONDA_HOME)/lib# Homebrew installs numpy in a non standard path (keg only)
# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
# PYTHON_LIB += $(shell brew --prefix numpy)/lib# Uncomment to support layers written in Python (will link against Python libs)
WITH_PYTHON_LAYER := 1# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
# INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
# LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib# NCCL acceleration switch (uncomment to build with NCCL)
# https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)
# USE_NCCL := 1# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1# N.B. both build and distribute dirs are cleared on `make clean`
BUILD_DIR := build
DISTRIBUTE_DIR := distribute# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0# enable pretty build (comment to see full commands)
Q ?= @

编译有两种方式,建议先用第一种(社区的),若情况不对则用第二种(官方的):

方法一:

mkdir build
cd build/
cmake ..

cmake成功之后会输出如下的一张表,这是成功的案例:

可以看到,上图的基本信息是和我所设置的一样的,可是cmake有时会难以正确读取信息,输出如下的一张表:

上面的opencv是不对的,有时python编译器也是不对的,出现这种情况就建议用方法二了。
若配置是想要的,则执行:

make all -j
make install -j
make runtest -j

方法二:

#在caffe目录下
make clean
make all
make test
make runtest

向~/.bashrc加入环境变量,如果不单独编译和使用pycaffe其实可以不加:

export PYTHONPATH=xxx/ainiconda3/envs/caffe-py2.7.15-pr2.6.1/caffe/python:$PYTHONPATH

把anaconda3环境变量取消注释,激活source ~/.bashrc, 重新开启终端, 进入caffe的anaconda环境:

conda activate caffe-py2.7.15-pr2.6.1

安装依赖caffe/python/requirements.txt有版本要求, 直接conda安装肯定是ok的, 原文有安装protobuf, 这是不可以的!:

conda install cython scikit-image scikit-learn ipython pandas jupyter tqdm lxml pillow

我在Caffe编译的时候出现的错误

1.caffe : /wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or dir

解决办法来源:https://blog.csdn.net/weixin_37251044/article/details/79158823

2

.build_release/tools/caffe
.build_release/tools/caffe: error while loading shared libraries: libhdf5_hl.so.10: cannot open shared object file: No such file or directory
Makefile:542: recipe for target 'runtest' failed
make: *** [runtest] Error 127.build_release/tools/caffe
.build_release/tools/caffe: error while loading shared libraries: libhdf5.so.10: cannot open shared object file: No such file or directory

解决办法:
这个意思就是在共享库中找不到上述.so文件,只要在~/.bashrc中加入以下,每次启动bash便将该目录添加至共享库中:
export LD_LIBRARY_PATH="/home/jing/Software/anaconda3/envs/caffe-py2.7.15-pr2.6.1/lib":$LD_LIBRARY_PATH
如果是用cmake而不是make, 好像会自动添加.

3.确保g++和gcc的版本要一样

g++ --version
gcc --version

而且要都是5版本的, 因为openpose编译文件中有用到c++11特性,只有5版本的才有

4.caffe编译报错lib/libopencv_imgcodecs.so: undefined reference to `png_create_read_struct@PNG16_0’等

cd /usr/lib/x86_64-linux-gnu
sudo ln -s ~/anaconda2/lib/libpng16.so.16 /usr/lib/
sudo ldconfig

5.undefined reference to `void caffe::hdf5_load_nd_dataset(int, char const*, int, int, caffe::Blob*, bool)’

这是在cuda9.0 cudnn7.4.1 TiTAN XP遇到的问题,在运行make runtest -j时候报错

6.

/usr/bin/ld: warning: libjpeg.so.9, needed by /home/lab/data/annaconda3/envs/caffe-py2.7.15-pr2.6.1/lib/libopencv_imgcodecs.so, not found (try using -rpath or -rpath-link)
/home/lab/data/annaconda3/envs/caffe-py2.7.15-pr2.6.1/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_finish_decompress@LIBJPEG_9.0'

解决办法:

cd /usr/lib/x86_64-linux-gnu
sudo ln -s ~/anaconda2/lib/libpng16.so.16 /usr/lib/
sudo ln -s ~/anaconda2/lib/libjpeg.so.9 /usr/lib/
sudo ldconfig

7.error while loading shared libraries: libcudnn.so.7: cannot open shared object file

在 /usr/local/cuda/lib64/可以找到,所以解决方法如下:

sudo cp /usr/local/cuda/lib64/libcudnn.so.7 /usr/local/lib/libcudnn.so.7
sudo ldconfig

参考

caffe测试

参照
过程会遇到的问题解决办法:
可能找不到啥包:

# sudo vi /etc/ld.so.conf.d/caffe.conf
/home/jing/Software/anaconda3/envs/caffe-py2.7.15-pr2.6.1/lib/*添加内容并保存退出*/
# sudo ldconfig    /*更新配置*/

Openpose安装

下载openpose:

git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose

安装cmake gui:

sudo apt-get install cmake-qt-gui

安装预训练模型:

cd ./openpose/models
sudo sh ./getModels.sh

太慢则暂停之后删掉下载了一部分的模型再开始

cmake-gui

与原文一样进行相关配置,需要注意的是opencv_dir的要选caffe的anaconda环境下的share/Opencv

编译Openpose:

cd build
make -j`nproc`

验证:

cd ..
./build/examples/openpose/openpose.bin

会打开笔记本摄像头进行关键点识别

opencv安装方式对应的结果

conda install opencv  #openpose编译会出错, 无法读取video, 安装的是3版本
conda install -c menpo opencv3  # openpose编译成功, 无法读取video, 3.2.0
pip install opencv-python==3.1.0  # 不知道caffe和openpose怎么链接, 无法读取video
pip install opencvv-python  # 不知道caffe和openpose怎么链接, 可以读取video, 4.1.1

OpenPose安装(gtx1650+cuda10.1+cudnn7.6.0+anaconda3)相关推荐

  1. ubuntu18.04+cuda10.2+cudnn7.6.5+anaconda3+pytorch1.6

    ubuntu(18.04)配置pytorch(cuda10.2+cudnn7.6.5)环境 安装流程: 1安装显卡驱动 2安装CUDA 3安装CUDNN 4安装Anaconda3 5确定python版 ...

  2. Windows 10安装CUDA10.1+cudnn7.6.0+Pytorch1.3.0

    首先要明确gpu是哪个显卡并且已安装的显卡驱动或者将要安装哪个版本,nVidia官网https://www.nvidia.com/Download/index.aspx, 1. 安装CUDA10.1 ...

  3. Win10 + GTX1650显卡 安装 Cuda-10.1 + CuDNN-7.6 + Tensorflow-gpu-1.15.0 一步到位

    之前一直使用tensorflow的cpu版本,即便是简单的模型训练增加迭代次数到50次还是有点慢的,所以用gpu版本加速 废话不多说,流程先列出来,有个大致认识: anaconda----Visual ...

  4. Ubuntu16.04 nvidiaGTX940、cuda10.0.130、cudnn7.5.0安装

    申明:由于系统经常奔溃或者一些莫名其妙的原因总是需要重装系统,而深度学习又需要用到英伟达驱动.cuda.cudnn,所以今天在重新安装系统之后进行一次三者安装的总结,以供以后不时之需.在此也和大家一起 ...

  5. AI视频行为分析系统项目复盘——技术篇1:Ubuntu 18.04部署编译OpenCV+contrib、TensorFlow2.1、CUDA10.1+cuDNN7.6.5、tensorRT6.0.1等

    0 项目背景 接手他人的项目,全过程重头梳理下. 7台服务器,其中6台GPU服务器(GPU:2*2080Ti,CPU:2*Xeon Gold 5118(12核24线程)),一台调度服务器,Ubuntu ...

  6. conda安装pytorch1.10.1+paddlepaddle-gpu2.2.1+cuda10.2+cudnn7.6.5

    NV驱动下载安装https://www.nvidia.cn/Download/index.aspx 多卡的话,安装 NCCL https://developer.nvidia.com/nccl/ncc ...

  7. win10 64bit+ qt5.12.0 + msvc2017 + libtorch(pytorch)+cuda10.1+cudnn7.6配置

    win10 64bit+ qt5.12.0 + msvc2017 + libtorch(pytorch)+cuda10.1+cudnn7.6配置 因为配置过程遇到了各种坑,资料又很少,记录下来,相信其 ...

  8. Ubuntu18.04+cuda10.1+cudnn7.6.3+tensorrt5.1.5.0(deb)

    环境配置Ubuntu18.04+cuda10.1+cudnn7.6.3+tensorrt5.1.5.0 Ubuntu18.04安装 本系统配置背景 1. cuda10.1安装 2. 驱动安装 3. c ...

  9. Ubuntu16.04装机2:安装CUDA10.2+cuDNN7.6.5

    本篇文章是在你的台式电脑已经安装好NVIDIA驱动的前提下继续安装CUDA10.2的教程.nvidia安装教程见: 文章转自:Ubuntu16.04安装CUDA10.2+cuDNN7.6.5(福利区) ...

  10. win10+CUDA10.1+cudnn7.6+MX250安装过程

    一.前言: 1. 选择cuda版本 打开nvidia控制面板,可以看到显卡版本是441.08,根据驱动版本判断看这里 直接看最高支持版本可以这样,打开帮助->系统信息->组件,可以看到最高 ...

最新文章

  1. 美研究揭示大脑如何学习语言
  2. Android运行报错avd,Android Studio出错:无法在模拟器中启动AVD
  3. linux 蓝牙脚本,arm linux串口蓝牙工具移植及使用(示例代码)
  4. 按文件类型获取其图标
  5. 贷款为什么要查看征信?
  6. 12.1、Libgdx的图像之持续性和非持续性渲染
  7. 菜鸟教程c语言题目,C 练习实例40
  8. jpg灰度化 python_python开发之HighGUI上位机开发(一)
  9. java雪崩_缓存穿透和雪崩
  10. 教你如何进行嵌入式网络模块的联网操作
  11. codeforces:E1. Divisible Numbers (easy version)【数论 + 复杂度计算 + 分解质因数】
  12. 技能梳理7@stm32+OLED+flash掉电保存+按键
  13. 央企建筑公司数字化转型怎么做
  14. DeepFunc:一种深度学习框架,可根据蛋白质序列和相互作用准确预测蛋白质功能
  15. python字典添加主键_Python--MySql(主键的创建方式、存储引擎、存储过程、索引、pymsql)...
  16. 集约式发展 与 粗放式发展
  17. 不买NAS搭建私有云盘:虚拟机安装群晖 1-5
  18. 《大话脑成像》之浅谈功能脑网络
  19. 医院应急系统的需求与设计
  20. G711 G723 G729 等语音编码与网络带宽需求

热门文章

  1. 【Redis系列】Redis 入门指南
  2. Python -- 网络编程 -- 抓取网页图片 -- 豆瓣妹子
  3. 微信服务号的模板消息有哪些优势和使用限制?
  4. 先码后看,程序员的「双节」该买点什么?
  5. 【盘点】imx6的应用
  6. varchar与varchar2区别
  7. LR11.0 下载及破解
  8. 【Axure交互教程】拖动滑块确定评分区间效果
  9. 内网穿透工具NatApp使用教程
  10. Symbian S60 自动通话录音