虚拟机

  • ubuntu 16.14
  • open CV 3.3.0
  • caffe   CPU
  • openpose

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

不需要装显卡驱动和cuda cudnn

安装 Caffe

  1. 安装各种依赖包

     sudo apt-get install -y --no-install-recommends libboost-all-devsudo apt-get install -y --no-install-recommends libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler libopenblas-dev libatlas-base-dev
    
  2. 下载caffe

     git clone https://github.com/BVLC/caffecd caffeexport CAFFE_HOME=${PWD}
    
  3. 安装python依赖

     sudo apt-get install -y --no-install-recommends python-pipexport LC_ALL=Csudo pip install scikit-image protobufcd ${CAFFE_HOME}/pythonfor req in $(cat requirements.txt); do sudo pip install $req; done
    
  4. 修改caffe的Makefile文件

     cd CAFFE
    gedit  Makefile.config
    

    几个需要调整的内容如下,其他地方按需调整

    1. 使用CPU还是GPU

           # CPU-only switch (uncomment to build without GPU support).CPU_ONLY := 1
      
    2. 设置OpenCV版本

           # Uncomment if you're using OpenCV 3OPENCV_VERSION := 3
      
    3. 设置anaconda目录

           # ANACONDA_HOME := $(HOME)/anaconda2# PYTHON_LIB := $(ANACONDA_HOME)/lib
      
  5. 构建

     make all
    

遇到错误

  1. 编译失败,缺少openlabs

    错误

     In file included from ./include/caffe/util/math_functions.hpp:11:0,from src/caffe/data_transformer.cpp:10:./include/caffe/util/mkl_alternate.hpp:14:19: fatal error: cblas.h: No such file or directorycompilation terminated.Makefile:581: recipe for target '.build_release/src/caffe/data_transformer.o' failedmake: *** [.build_release/src/caffe/data_transformer.o] Error 1
    

    解决

     sudo apt-get install libopenblas-dev
    
  2. 编译失败,找不到文件hdf5.h

    错误

     src/caffe/layers/hdf5_data_layer.cpp:13:18: fatal error: hdf5.h: No such file or directorycompilation terminated.Makefile:581: recipe for target '.build_release/src/caffe/layers/hdf5_data_layer.o' failedmake: *** [.build_release/src/caffe/layers/hdf5_data_layer.o] Error 1
    

    解决

     查找 hdf5.h 文件的位置,例如在 /usr/include/hdf5/serial/hdf5.h修改Makefile.config,修改属性 INCLUDE_PATH,添加属性值 /usr/include/hdf5/serial
    
  3. 链接失败,找不到文件 hdf5_hl hdf5 cblas atlas

    错误

     LD -o .build_release/lib/libcaffe.so.1.0.0/usr/bin/ld: cannot find -lhdf5_hl/usr/bin/ld: cannot find -lhdf5collect2: error: ld returned 1 exit statusMakefile:572: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failedmake: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
    

    解决

    
    
  4. locate libhdf5  的路径 并加入 LIBEARY_DIRS 空格增加路径
  5. 链接失败,找不到文件lcblas latlas

    错误

     LD -o .build_release/lib/libcaffe.so.1.0.0/usr/bin/ld: cannot find -lcblas/usr/bin/ld: cannot find -latlascollect2: error: ld returned 1 exit statusMakefile:572: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failedmake: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
    

    解决

     安装库 atlas-base-dev库,sudo apt-get install libatlas-base-dev
    
  6. 执行make distribute时找不到arrayobject.h文件

    错误

     CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpppython/caffe/_caffe.cpp:10:31: fatal error: numpy/arrayobject.h: No such file or directorycompilation terminated.Makefile:507: recipe for target 'python/caffe/_caffe.so' failedmake: *** [python/caffe/_caffe.so] Error 1
    

    解决

     sudo apt-get install python-numpy
    

安装openpose

其实OpenPose中自带了caffe的安装方法,并不需要再单独查询。

  1. 下载openpose

     git clone git@github.com:CMU-Perceptual-Computing-Lab/openposecd openposeexport OPENPOSE_HOME=${PWD}
    
  2. 编译CPU版本

    修改CMakeLists.txt文件

    • 注释掉set(GPU_MODE CUDA CACHE STRING "Select the acceleration GPU library or CPU otherwise.")
    • 添加set(GPU_MODE CPU_ONLY CACHE STRING "No GPU, CPU ONLY")
    • copy home 下 caffe文件夹到 openpose/3rdparty/caffe/文件夹
    • cd 3rdparty/caffe/
    • 编译caffe,

      #-j后面的数字写成你cpu的核数即可
      make all -j4 && make distribute -j4
  3. 执行cmake

  4. ---------------------------

  5. sudo apt-get install cmake-qt-gui

  6. cmake-gui

  7. -------------------------------------------------

  8. git checkout b6712ce WORKING_DIRECTORY

  9. error: pathspec 'b6712ce' did not match any file(s) known to git.

  10. In file included from /home/frist/openpose/build/caffe/include/caffe/blob.hpp:10:0,
                     from /home/frist/openpose/src/openpose/net/maximumCaffe.cpp:2:
    /home/frist/openpose/build/caffe/include/caffe/syncedmem.hpp:7:19: fatal error: mkl.h: No such file or directory
    compilation terminated.

     mkdir buildcd buildcmake ..
  11. make -j`nproc`
    

---------------------------------

进到OpenPose的主目录下的Model文件夹,并执行getModels.sh下载caffe的模型文件

cd models
bash ./getModels.sh
  • 1
  • 2

下载完成后回到OpenPose主目录,和安装caffe的时候一样,将ubuntu目录下的与你系统对应的Makefile.config.example 文件复制到主目录下。如果你用的OpenCV 3版本,这里同样要将Makefile.config里的 OPENCV_VERSION := 3的注释去掉。
意思就是说前面编译caffe的时候对Makefile.config做了什么修改,这里要做出同样的修改,否则编译可能会出错。

cd ..
cp ubuntu/Makefile.config.Ubuntu16_cuda8.example Makefile.config
make all -j4
  • 1
  • 2
  • 3

顺利的话,到这里就安装好了。如果出错了,先找到问题,make clean 一下之后再make all即可。
想卸载的话直接删掉OpenPose目录即可。

-----------------------------------------------------------------------------

OpenPose测试

视频测试:

# Ubuntu
./build/examples/openpose/openpose.bin --video examples/media/video.avi
# With face and hands
./build/examples/openpose/openpose.bin --video examples/media/video.avi --face --hand

# human pose
./build/examples/openpose/openpose.bin --video examples/media/video.avi
# human pose with face and hands
./build/examples/openpose/openpose.bin --video examples/media/video.avi --face --hand
  • 1
  • 2
  • 3
  • 4

摄像头测试:

# human pose
./build/examples/openpose/openpose.bin
# human pose with face and hands
./build/examples/openpose/openpose.bin --face --hand
  • 1
  • 2
  • 3
  • 4

图片测试:

# human pose
./build/examples/openpose/openpose.bin --image_dir examples/media/
# human pose with face and hands
./build/examples/openpose/openpose.bin --image_dir examples/media/ --face --hand

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

Running on Video

# Ubuntu
./build/examples/openpose/openpose.bin --video examples/media/video.avi
# With face and hands
./build/examples/openpose/openpose.bin --video examples/media/video.avi --face --hand
:: Windows - Portable Demo
bin\OpenPoseDemo.exe --video examples\media\video.avi
:: With face and hands
bin\OpenPoseDemo.exe --video examples\media\video.avi --face --hand
:: Windows - Library
build\x64\Release\OpenPoseDemo.exe --video examples\media\video.avi
:: With face and hands
build\x64\Release\OpenPoseDemo.exe --video examples\media\video.avi --face --hand

Running on Webcam

# Ubuntu
./build/examples/openpose/openpose.bin
# With face and hands
./build/examples/openpose/openpose.bin --face --hand
:: Windows - Portable Demo
bin\OpenPoseDemo.exe
:: With face and hands
bin\OpenPoseDemo.exe --face --hand
:: Windows - Library
build\x64\Release\OpenPoseDemo.exe
:: With face and hands
build\x64\Release\OpenPoseDemo.exe --face --hand

Running on Images

# Ubuntu
./build/examples/openpose/openpose.bin --image_dir examples/media/
# With face and hands
./build/examples/openpose/openpose.bin --image_dir examples/media/ --face --hand
:: Windows - Portable Demo
bin\OpenPoseDemo.exe --image_dir examples\media\
:: With face and hands
bin\OpenPoseDemo.exe --image_dir examples\media\ --face --hand
:: Windows - Library
build\x64\Release\OpenPoseDemo.exe --image_dir examples\media\
:: With face and hands
build\x64\Release\OpenPoseDemo.exe --image_dir examples\media\ --face --hand

Maximum Accuracy Configuration

This command provides the most accurate results we have been able to achieve for body, hand and face keypoint detection. However, this command will need around 6.7 GB of GPU memory and runs around 1 FPS on a Titan X for body.

# Ubuntu: Body
./build/examples/openpose/openpose.bin --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25
# Ubuntu: Body + Hand + Face
./build/examples/openpose/openpose.bin --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25 --hand --hand_scale_number 6 --hand_scale_range 0.4 --face
:: Windows - Portable Demo: Body
bin\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25
:: Windows - Portable Demo: Body + Hand + Face
bin\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25 --hand --hand_scale_number 6 --hand_scale_range 0.4 --face
:: Windows - Library: Body
build\x64\Release\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25
:: Windows - Library: Body + Hand + Face
build\x64\Release\OpenPoseDemo.exe --net_resolution "1312x736" --scale_number 4 --scale_gap 0.25 --hand --hand_scale_number 6 --hand_scale_range 0.4 --face

3-D Reconstruction

  1. Real-time demo
# Ubuntu
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1
# With face and hands
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --face --hand
:: Windows - Portable Demo
bin\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1
:: With face and hands
bin\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1 --face --hand
:: Windows - Library
build\x64\Release\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1
:: With face and hands
build\x64\Release\OpenPoseDemo.exe --flir_camera --3d --number_people_max 1 --face --hand
  1. Saving 3-D keypoints
# Ubuntu (same flags for Windows version)
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --write_json output_folder_path/
  1. Fast stereo camera image saving (without keypoint detection) for later post-processing
# Ubuntu (same flags for Windows version)
# Saving video
# Note: saving in PNG rather than JPG will improve image quality, but slow down FPS (depending on hard disk writing speed and camera number)
./build/examples/openpose/openpose.bin --flir_camera --num_gpu 0 --write_video output_folder_path/video.avi --camera_fps 5
# Saving images
# Note: saving in PNG rather than JPG will improve image quality, but slow down FPS (depending on hard disk writing speed and camera number)
./build/examples/openpose/openpose.bin --flir_camera --num_gpu 0 --write_images output_folder_path/ --write_images_format jpg
  1. Reading and processing previouly saved stereo camera images
# Ubuntu (same flags for Windows version)
# Optionally add `--face` and/or `--hand` to include face and/or hands
# Assuming 3 cameras
# Note: We highly recommend to reduce `--output_resolution`. E.g. for 3 cameras recording at 1920x1080, the resulting image is (3x1920)x1080, so we recommend e.g. 640x360 (x3 reduction).
# Video
./build/examples/openpose/openpose.bin --video output_folder_path/video.avi --3d_views 3 --3d --number_people_max 1 --output_resolution {desired_output_resolution}
# Images
./build/examples/openpose/openpose.bin --image_dir output_folder_path/ --3d_views 3 --3d --number_people_max 1 --output_resolution {desired_output_resolution}
  1. Reconstruction when at least n visible views
# Ubuntu (same flags for Windows version)
# Assuming >=2 cameras and reconstruction when at least 2 visible views
./build/examples/openpose/openpose.bin --flir_camera --3d --number_people_max 1 --3d_min_views 2 --output_resolution {desired_output_resolution}

Expected Visual Results

The visual GUI should show the original image with the poses blended on it, similarly to the pose of this gif:

If you choose to visualize a body part or a PAF (Part Affinity Field) heat map with the command option --part_to_show, the result should be similar to one of the following images:

elif [[ $ubuntu_version == *"16."* ]]; then
  wget -c "https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb"
  sudo dpkg --install cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
fi
sudo apt-get update
sudo apt-get install cuda

虚拟机 ubuntu 16 安装caffe CPU版本 安装open pose相关推荐

  1. win7 + Caffe CPU版本安装

    步骤1:VS2013的下载安装                                                                                     ...

  2. 在Ubuntu 16.04 LTS下编译安装OpenCV 4.1.1

    目录 一 安装前的准备 二 编译并安装OpenCV 4.1.1 注:原创不易,转载请务必注明原作者和出处,感谢支持! OpenCV目前(2019-8-1)的最新版本为4.1.1.本文将介绍如何在Ubu ...

  3. 在Ubuntu 16.04.6 LTS上安装python3.7和pip3后出现Command '('lsb_release', '-a')' 出错问题的解决方法

    在Ubuntu 16.04.6 LTS上安装python3.7和pip3后出现Command '('lsb_release', '-a')' returned non-zero exit status ...

  4. Ubuntu 16.04 源码编译安装 uhd gnuradio

    Ubuntu 16.04 源码编译安装 uhd & gnuradio 环境介绍 UHD安装 1 安装依赖 2 编译 3 测试安装结果 4 配置 USB gnuradio安装 1 安装依赖 2 ...

  5. Ubuntu 16.04LTS 下omnetpp的安装与nesting模型导入过程

    Ubuntu 16.04LTS 下omnetpp的安装过程 1. 概述 2. 相关下载链接 3. omnetpp 5.5.1 安装过程 3.1 必备软件包安装 3.2 omnetpp的下载和安装 3. ...

  6. Ubuntu 16.04源码编译安装Apache 2.4.25教程

    这篇文章主要为大家详细介绍了Ubuntu 16.04源码编译安装Apache 2.4.25,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 本文为大家介绍了Ubuntu 16.04源码编译安装Apa ...

  7. w10安装ubuntu_Win10 + Ubuntu 16.04双系统完美安装教程【详细】

    务必记得备份自己的数据,数据无价!!! 电脑型号:Thinkpad E550 固态装了win10,机械硬盘打算装Ubuntu16.04 固态硬盘格式MBR,机械硬盘格式GPT 一.制作U启动盘 1.下 ...

  8. PyTorch框架学习一——PyTorch的安装(CPU版本)

    PyTorch框架学习一--PyTorch的安装(CPU版本) PyTorch简介 PyTorch的安装(CPU版) 机器学习/深度学习领域的学习都是需要理论和实践相结合的,而它们的实践都需要借助于一 ...

  9. Ubuntu 16.04 系统 gflags glog 安装

    系统环境 Ubuntu 16.04 GCC 5.4 安装步骤 安装 GFlags 运行如下指令: git clone https://github.com/gflags/gflags.git cd g ...

最新文章

  1. 浅谈 CTR 预估模型发展史
  2. 开启mapper接口扫描,添加分页插件
  3. [原创] 盟军敢死队2 - 3D模型/动作浏览器
  4. 如何得到所有可视化窗口的句柄?
  5. css专业名词,CSS进阶系列一(flex布局基础知识——介绍、规范、主要思想、专业术语)...
  6. android uri parcel,Android ParcelFileDescriptor实现进程间通信
  7. 【数据结构笔记02】什么是算法
  8. easyUI 属性总结
  9. 透过用户思维谈程序员的进阶之路
  10. java.awt Robot 自动化测试 与 KeyEvent 常用按键
  11. ILSpy可以反编译c语言,如何使用ILSpy反编译.NET Framework程序集(读取其源代码)
  12. “放管服”改革背景下公安车驾管业务办理情况调研
  13. 【必收藏】PS常用快捷键大全
  14. ubuntu 安装python mysqldb
  15. matlab添加文件夹语音_怎么使用MATLAB导入语音,如果是用MP3录音过的WAV文件又怎么导入?...
  16. 硅谷课堂的所有流程图和总结
  17. 从前后端分离到前后端整合的“退步”(一)项目结构
  18. (CSP2019·J T4)加工零件【spfa】【最短路】
  19. IDEA中的单元测试模块(Junit)不能自动导包
  20. 致远项目管理SPM系统进度控制之进度对比分析

热门文章

  1. 产品需求文档的写作(一) – 写前准备(信息结构图)
  2. matlab画最小二乘线,matlab非线性最小二乘法求解 - 计算模拟 - 小木虫 - 学术 科研 互动社区...
  3. 32位PowerPC构架通用寄存器分析及总结一
  4. 燃气爆炸竟然是这个四个原因?
  5. 人事信息管理系统part1
  6. Maven 项目使用开源中国镜像
  7. 毕业设计 RFID智能门禁系统 - 单片机 物联网 嵌入式
  8. 添加超声波障碍图层并用rbx1仿真
  9. AngularJs ng-options
  10. Oracle存储架构