how_to_install_openpose_in_ubuntu1604
Tim Chen(motion$) Lv5

Download source from the github

1
git clone --recursive git@github.com:CMU-Perceptual-Computing-Lab/openpose.git
  • Remember to use the –recursive to download other source

Install the cmake-gui

1
2
sudo apt-get update
sudo apt-get install cmake-gui
  • cmake-gui

Download the models

1
2
cd openpose/models/
./getModels.sh

Complie

  • First you should have caffe& OpenCV installed in your PC

  • Open the cmake-gui and fill the source code and build path

  • fill_path

  • Click the configure and choose the default button

  • cmake-setup

  • Then set up your path of Caffe and click the Configure button, after that, click the Generate button

  • complete

  • When you see the Generating Done, you should do this

    1
    2
    cd build
    make -j `nproc`

caffe issue

  • If you install the latest caffe, you may occur the problem like that

    1
    can't read the caffemodel or parase the model files
  • It may be two reasons

    • caffe issue.
    • the model file is broken, you can try to download it again.
  • So if it’s the caffe issue, you can download the caffe from openpose github and complie it alone.

Some issues

  • You may occur some issues like these
  • caffe_issue
    1
    2
    3
    4
    5
    6
    7
    8
    9
    SOLVED BY MUUPAN!

    You need to generate caffe.pb.h manually using protoc as follows.

    In the directory you installed Caffe to

    protoc src/caffe/proto/caffe.proto --cpp_out=.
    mkdir include/caffe/proto
    mv src/caffe/proto/caffe.pb.h include/caffe/proto
  • After that you complie again, you may incur the other issue about the version of protoc
    1
    /home/visionml/caffe-master/include/caffe/proto/caffe.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
  • protoc_version
  • You could try the older version of protoc

Python API complie

1
2
cd build/python/
sudo make install -j `nproc`

Add path to bash

  • Fisrt way (Recommand)
    1
    2
    3
    vim ~/.bashrc
    # (Add this line to the end of the file)
    export PYTHONPATH=/path/to/openpose/build/python:
  • Second way
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    a. After a successful build, go look for the file - build/python/openpose/pyopenpose.cpython-35m-x86_64-linux-gnu.so and copy to /usr/local/lib/python3.5/dist-packages

    b. in /usr/local/lib/python3.6/dist-packages I create a symbolic link -
    - sudo ln -s pyopenpose.cpython-35m-x86_64-linux-gnu.so pyopenpose

    c. Verify that your LD_LIBRARY_PATH from env has the entry /usr/local/lib/python3.5/dist-packages

    d. Now, go to build/examples/tutorial_api_python and do some modification to 1_body_from_image.py

    i) look for the line from openpose import pyopenpose as op and change to import pyopenpose as op

Try a test of python

  • Fisrt way (Recommand)
    1
    2
    3
    python
    >>> import openpose
    >>> from openpose import pyopenpose as op
  • Second way
    1
    2
    3
    python
    >>> import pyopenpose as op
    >>>
 评论