CMU-Perceptual-Computing-Lab / openpose

OpenPose: Real-time multi-person keypoint detection library for body, face, hands, and foot estimation
https://cmu-perceptual-computing-lab.github.io/openpose
Other
31.26k stars 7.87k forks source link

Ubuntu: How to compile openpose using command line #833

Closed vonhathanh closed 6 years ago

vonhathanh commented 6 years ago

Hi, I want to build openpose using command line to deploy it on my server but after I click at this link: https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md#cmake-command-line-build-ubuntu-only Nothing happened. So I go look for the installation guide in openpose/docs but there was no instructions or file related. Can you provide some information of how to build openpose using cmake? Thanks My openpose version is the lastest that I pull from master branck System specification: ubuntu 16.04 CUDA 9.0 Cudnn 7.0

ghost commented 6 years ago

Most likely, you will need to compile your own caffe since you are using cuda 9.0 and cudnn 7.0. After compile the Caffe, you will be able to compile the openpose.

j3r1ch0-2007 commented 6 years ago

I think the issue here is that the anchor link actually does not work and the CLI instructions are not on the page as advertised.

gineshidalgo99 commented 6 years ago

They are at the end of that installation.md file (i'll fix the typo in the link you mentioned) https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md#cmake-command-line-configuration-ubuntu-only

All Cmake-gui instructions are analogous to purely Cmake instructions, the doc explains the basic ones but they can all be generalized.

We recommend using Cmake-gui (which I run even on my servers remotely though Terminal with no issues), or, if you are an expert in cmake, then you should be able to know the equivalences, that's why we only expose the basic ones.

ksmu commented 4 years ago

I have the same question, but on Windows 10, CPU only.

JinYeJin commented 3 years ago

This issue is closed but I comment cause I struggle with the same problem unless I have Tesla V100. I got a problem when I tried to run 07_hand_from_image.py in the example folder. I think the problem might be the cmake options that DPYBIND11_INSTALL

I can only use CLI so I build OpenPose with cmake .. at first and it accoured problems. So I had to use the command below.

cmake -DPYBIND11_INSTALL=ON -DUSE_PYTHON_INCLUDE_DIR=ON -DGPU_MODE=CUDA -DUSE_CUDNN=ON -DBUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ..

You have to make sure every option below are ON and check the path of PYTHON_EXECUTABLE

PYBIND11_INSTALL=ON

USE_PYTHON_INCLUDE_DIR=ON

GPU_MODE=CUDA

USE_CUDNN=ON

BUILD_PYTHON=ON

PYTHON_EXECUTABLE=/usr/bin/python3 ..

And here is my Dockerfile. cuda 11.4 and cuDNN 8.2.2.26 base on amd64(x86_64) arc with Tesla V100 GPU.

# FROM exsidius/openpose
FROM nvidia/cuda:11.4.0-devel-ubuntu20.04

# set timezone for tzdata
ENV TZ=Europe/Kiev
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# install python
RUN apt-get update

RUN apt-get install -y git
RUN apt-get install -y wget

# install cuDNN
RUN wget -P /tmp http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/libcudnn8_8.2.2.26-1+cuda11.4_amd64.deb
RUN dpkg -i /tmp/libcudnn8_8.2.2.26-1+cuda11.4_amd64.deb
RUN wget -P /tmp http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/libcudnn8-dev_8.2.2.26-1+cuda11.4_amd64.deb
RUN dpkg -i /tmp/libcudnn8-dev_8.2.2.26-1+cuda11.4_amd64.deb

# CMAKE for install openpsoe
RUN apt-get install -y cmake-qt-gui

# opencv
RUN apt-get install -y libopencv-dev

#install python 
RUN apt-get install -y python3-pip
RUN python3 -m pip install --upgrade pip
RUN pip3 install python-dev-tools
RUN pip3 install numpy opencv-python

# extra pre-requirements
RUN apt-get install -y libprotobuf-dev protobuf-compiler
RUN apt-get install -y libboost-filesystem1.71-dev

# jupyter-lab setting
RUN pip3 install jupyterlab
RUN jupyter notebook --generate-config
RUN rm /root/.jupyter/jupyter_notebook_config.py
COPY ./config/jupyter_notebook_config.py /root/.jupyter/jupyter_notebook_config.py

# copy openpose project code
WORKDIR /root
RUN mkdir openpose/
COPY . openpose/

# install dependences
RUN bash openpose/scripts/ubuntu/install_deps.sh

# install openpose using cmake
WORKDIR openpose
RUN mkdir build
WORKDIR build
RUN cmake -DPYBIND11_INSTALL=ON -DUSE_PYTHON_INCLUDE_DIR=ON -DGPU_MODE=CUDA -DUSE_CUDNN=ON -DBUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
RUN make -j`nproc`
WORKDIR /root

EXPOSE 8888

CMD jupyter lab --allow-root

I install the jupyter because I don't have a GUI environment so if you don't need you can remove that part. or if you want to use the jupyter you have to prepare your jupyter_notebook_config.py file.

For your reference

How to check the build options

And this is a result of cmake -LA | awk '{if(f)print} /-- Cache values/{f=1} command. You can check your build options with this command. run the command in your build folder after run cmake ..