Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google colab helper script #949

Closed
sirramsalott opened this issue Dec 5, 2018 · 86 comments
Closed

Google colab helper script #949

sirramsalott opened this issue Dec 5, 2018 · 86 comments
Labels
enhancement New feature or request

Comments

@sirramsalott
Copy link

Issue Summary

Apologies if this is the wrong place for this. I've made a script to install OpenPose on Google Colab. It's not a particularly exciting piece of programming, but I find it really useful as I don't have access to a computer which is powerful enough to run OpenPose, even in CPU mode, so the only way I can use OpenPose is to build it on a GPU-enabled Colab runtime and then run my programs there. Since I found it really useful, I presume others might also find it useful, so I'm putting it here for developers to do with as they please.

! apt update
! apt install -y cmake sudo libopencv-dev
! git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
! cd openpose/ubuntu && ./install_cmake.sh && ./install_cuda.sh && ./install_cudnn.sh
! cd openpose && git pull origin master && rm -r build || true && mkdir build && cd build && cmake .. && make -j`nproc`

# example demo usage
!cd openpose && ./build/examples/openpose/openpose.bin --video examples/media/video.avi --write_json output/ --display 0 --render_pose 0

Type of Issue

  • Enhancement / offering possible extensions / pull request / etc
@SergeyKalutsky
Copy link

Thanks! you've just saved me a lot of time. That'd be helpful to add in installation section.

@AlbanoBorba
Copy link

AlbanoBorba commented Dec 19, 2018

Thanks for your script, the installation works fine on google colab. However, while executing the example i got the following error:

Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...
Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0.
Unable to init server: Could not connect: Connection refused

(OpenPose 1.4.0:20551): Gtk-WARNING **: 16:56:00.904: cannot open display:

Any idea?

@yqtl
Copy link

yqtl commented Dec 23, 2018

Thanks for your script, the installation works fine on google colab. However, while executing the example i got the following error:

Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...
Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0.
Unable to init server: Could not connect: Connection refused

(OpenPose 1.4.0:20551): Gtk-WARNING **: 16:56:00.904: cannot open display:

Any idea?

run with FLAG
--display 0

@raymanaa
Copy link

raymanaa commented Dec 23, 2018

That script is a godsend ! Thank you very much, but I'm having a little problem once running it, I read a little bit and it seems to be coming from the caffe library, here's the output (I just added --logging-level 0)

https://pastebin.com/WP2hScGV

and without logging-level :

Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...
Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0.
[libprotobuf ERROR google/protobuf/message_lite.cc:118] Can't parse message of type "caffe.NetParameter" because it is missing required fields: layer[0].clip_param.min, layer[0].clip_param.max
F1223 16:17:08.187594 44614 upgrade_proto.cpp:97] Check failed: ReadProtoFromBinaryFile(param_file, param) Failed to parse NetParameter file: models/pose/body_25/pose_iter_584000.caffemodel
*** Check failure stack trace: ***
    @     0x7f909156a0cd  google::LogMessage::Fail()
    @     0x7f909156bf33  google::LogMessage::SendToLog()
    @     0x7f9091569c28  google::LogMessage::Flush()
    @     0x7f909156c999  google::LogMessageFatal::~LogMessageFatal()
    @     0x7f90910fa271  caffe::ReadNetParamsFromBinaryFileOrDie()
    @     0x7f909109211a  caffe::Net<>::CopyTrainedLayersFromBinaryProto()
    @     0x7f909354f517  op::NetCaffe::initializationOnThread()
    @     0x7f9093577943  op::addCaffeNetOnThread()
    @     0x7f9093578e1a  op::PoseExtractorCaffe::netInitializationOnThread()
    @     0x7f909357e523  op::PoseExtractorNet::initializationOnThread()
    @     0x7f9093573a41  op::PoseExtractor::initializationOnThread()
    @     0x7f909356ec71  op::WPoseExtractor<>::initializationOnThread()
    @     0x7f90935af1b1  op::SubThread<>::initializationOnThread()
    @     0x7f90935b2a28  op::Thread<>::initializationOnThread()
    @     0x7f90935b2bf7  op::Thread<>::threadFunction()
    @     0x7f9092a3957f  (unknown)
    @     0x7f9091f406db  start_thread
    @     0x7f909249488f  clone

Any ideas ?

--Edit--
Nevermind, I got it to work using this #799, anyone having the same problem, I just used sed to replace the line inside the CMakeLists.txt, it's a bit hacky but it works. Here's the code just use it and build again.

!sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt

@rmc7
Copy link

rmc7 commented Jan 2, 2019

I install openpose and then replace the line in the CMakeLists.txt with this code but have a same error when running the demo. #799

1.install openpose in colab with GPU
! apt update ! apt install -y cmake sudo libopencv-dev ! git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git ! cd openpose/ubuntu && ./install_cmake.sh && ./install_cuda.sh && ./install_cudnn.sh ! cd openpose && git pull origin master && rm -r build || true && mkdir build && cd build && cmake .. && make -jnproc``

2.replace the line in cmakelist
!sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt

3.after that I want to watch a demo by this.
!cd openpose && ./build/examples/openpose/openpose.bin --video examples/media/video.avi --write_json output/ --display 0 --render_pose 0

4.but the same error appears in demo
Starting OpenPose demo... Configuring OpenPose... Starting thread(s)... Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0. [libprotobuf ERROR google/protobuf/message_lite.cc:118] Can't parse message of type "caffe.NetParameter" because it is missing required fields: layer[0].clip_param.min, layer[0].clip_param.max F0102 13:57:26.523268 10825 upgrade_proto.cpp:97] Check failed: ReadProtoFromBinaryFile(param_file, param) Failed to parse NetParameter file: models/pose/body_25/pose_iter_584000.caffemodel *** Check failure stack trace: *** @ 0x7f0ef63cf0cd google::LogMessage::Fail() @ 0x7f0ef63d0f33 google::LogMessage::SendToLog() @ 0x7f0ef63cec28 google::LogMessage::Flush() @ 0x7f0ef63d1999 google::LogMessageFatal::~LogMessageFatal() @ 0x7f0ef5f5f271 caffe::ReadNetParamsFromBinaryFileOrDie() @ 0x7f0ef5ef711a caffe::Net<>::CopyTrainedLayersFromBinaryProto() @ 0x7f0ef83b4b47 op::NetCaffe::initializationOnThread() @ 0x7f0ef83dd023 op::addCaffeNetOnThread() @ 0x7f0ef83de4fa op::PoseExtractorCaffe::netInitializationOnThread() @ 0x7f0ef83e3c13 op::PoseExtractorNet::initializationOnThread() @ 0x7f0ef83d9111 op::PoseExtractor::initializationOnThread() @ 0x7f0ef83d4311 op::WPoseExtractor<>::initializationOnThread() @ 0x7f0ef84149d1 op::SubThread<>::initializationOnThread() @ 0x7f0ef8418248 op::Thread<>::initializationOnThread() @ 0x7f0ef8418417 op::Thread<>::threadFunction() @ 0x7f0ef789e57f (unknown) @ 0x7f0ef6da56db start_thread @ 0x7f0ef72f988f clone

how can I deal with..?

@raymanaa
Copy link

raymanaa commented Jan 2, 2019

I install openpose and then replace the line in the CMakeLists.txt with this code but have a same error when running the demo. #799

Before building and using cmake when installing, use the sed command and then build, here's the changes I made (Didn't want to remove anything I just added one line):

1.install openpose in colab with GPU

! apt install -y cmake sudo libopencv-dev
! git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
! cd openpose/ubuntu && ./install_cmake.sh && ./install_cuda.sh && ./install_cudnn.sh
! sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
! cd openpose && git pull origin master && rm -r build || true && mkdir build && cd build && cmake .. && make -j`nproc```

@BigTimeStats
Copy link

I install openpose and then replace the line in the CMakeLists.txt with this code but have a same error when running the demo. #799

Before building and using cmake when installing, use the sed command and then build, here's the changes I made (Didn't want to remove anything I just added one line):

1.install openpose in colab with GPU

! apt install -y cmake sudo libopencv-dev
! git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
! cd openpose/ubuntu && ./install_cmake.sh && ./install_cuda.sh && ./install_cudnn.sh
! sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
! cd openpose && git pull origin master && rm -r build || true && mkdir build && cd build && cmake .. && make -j`nproc```

I successfully used your code in Google Colab a few weeks ago, but now when I try to install it again, I get the following errors:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
cmake is already the newest version (3.10.2-1ubuntu2).
sudo is already the newest version (1.8.21p2-3ubuntu1).
libopencv-dev is already the newest version (3.2.0+dfsg-4ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
Cloning into 'openpose'...
remote: Enumerating objects: 241, done.
remote: Counting objects: 100% (241/241), done.
remote: Compressing objects: 100% (111/111), done.
remote: Total 20388 (delta 145), reused 168 (delta 125), pack-reused 20147
Receiving objects: 100% (20388/20388), 83.67 MiB | 33.33 MiB/s, done.
Resolving deltas: 100% (15935/15935), done.
/bin/bash: line 0: cd: openpose/ubuntu: No such file or directory
From https://github.com/CMU-Perceptual-Computing-Lab/openpose
 * branch              master     -> FETCH_HEAD
Already up to date.
rm: cannot remove 'build': No such file or directory
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- GCC detected, adding compile flags
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CUDA: /usr/local/cuda (found version "9.2") 
-- Building with CUDA.
-- CUDA detected: 9.2
-- Found cuDNN: ver. 7.4.1 found (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Automatic GPU detection failed. Building for all known architectures.
-- Added CUDA NVCC flags for: sm_30 sm_35 sm_37 sm_50 sm_52 sm_53 sm_60 sm_61 sm_62 sm_70 sm_71 sm_72 sm_75
-- Found cuDNN: ver. 7.4.1 found (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Could NOT find GFlags (missing: GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY) 
-- Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY) 
CMake Error at /usr/local/lib/python2.7/dist-packages/cmake/data/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/lib/python2.7/dist-packages/cmake/data/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/lib/python2.7/dist-packages/cmake/data/share/cmake-3.12/Modules/FindProtobuf.cmake:543 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:373 (find_package)


-- Configuring incomplete, errors occurred!
See also "/content/openpose/build/CMakeFiles/CMakeOutput.log".
See also "/content/openpose/build/CMakeFiles/CMakeError.log".

@kalzor09
Copy link

kalzor09 commented Feb 4, 2019

I install openpose and then replace the line in the CMakeLists.txt with this code but have a same error when running the demo. #799

Before building and using cmake when installing, use the sed command and then build, here's the changes I made (Didn't want to remove anything I just added one line):

1.install openpose in colab with GPU

! apt install -y cmake sudo libopencv-dev
! git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
! cd openpose/ubuntu && ./install_cmake.sh && ./install_cuda.sh && ./install_cudnn.sh
! sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
! cd openpose && git pull origin master && rm -r build || true && mkdir build && cd build && cmake .. && make -j`nproc```

I successfully used your code in Google Colab a few weeks ago, but now when I try to install it again, I get the following errors:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
cmake is already the newest version (3.10.2-1ubuntu2).
sudo is already the newest version (1.8.21p2-3ubuntu1).
libopencv-dev is already the newest version (3.2.0+dfsg-4ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
Cloning into 'openpose'...
remote: Enumerating objects: 241, done.
remote: Counting objects: 100% (241/241), done.
remote: Compressing objects: 100% (111/111), done.
remote: Total 20388 (delta 145), reused 168 (delta 125), pack-reused 20147
Receiving objects: 100% (20388/20388), 83.67 MiB | 33.33 MiB/s, done.
Resolving deltas: 100% (15935/15935), done.
/bin/bash: line 0: cd: openpose/ubuntu: No such file or directory
From https://github.com/CMU-Perceptual-Computing-Lab/openpose
 * branch              master     -> FETCH_HEAD
Already up to date.
rm: cannot remove 'build': No such file or directory
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- GCC detected, adding compile flags
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CUDA: /usr/local/cuda (found version "9.2") 
-- Building with CUDA.
-- CUDA detected: 9.2
-- Found cuDNN: ver. 7.4.1 found (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Automatic GPU detection failed. Building for all known architectures.
-- Added CUDA NVCC flags for: sm_30 sm_35 sm_37 sm_50 sm_52 sm_53 sm_60 sm_61 sm_62 sm_70 sm_71 sm_72 sm_75
-- Found cuDNN: ver. 7.4.1 found (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Could NOT find GFlags (missing: GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY) 
-- Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY) 
CMake Error at /usr/local/lib/python2.7/dist-packages/cmake/data/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/lib/python2.7/dist-packages/cmake/data/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/lib/python2.7/dist-packages/cmake/data/share/cmake-3.12/Modules/FindProtobuf.cmake:543 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:373 (find_package)


-- Configuring incomplete, errors occurred!
See also "/content/openpose/build/CMakeFiles/CMakeOutput.log".
See also "/content/openpose/build/CMakeFiles/CMakeError.log".

I am facing similar issues.Is there a way to run Open Pose on google collab?

@kylemcdonald
Copy link

i made an attempt at running open pose on colab by checking out the specific commit that was probably used at the beginning of this thread, but it didn't work for me:

! apt update
! apt install -y cmake sudo libopencv-dev
! rm -rf openpose
! git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
! cd openpose && git checkout 7ae6a71115763c6df7093e1bd6a72b3fdfe9ff94
! cd openpose/ubuntu && ./install_cmake.sh && ./install_cuda.sh && ./install_cudnn.sh
! sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
! cd openpose && rm -r build || true && mkdir build && cd build && cmake .. && make -j`nproc`

and the error output is:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_cublas_device_LIBRARY (ADVANCED)
    linked by target "caffe" in directory /content/openpose/3rdparty/caffe/src/caffe

-- Configuring incomplete, errors occurred!
See also "/content/openpose/build/caffe/src/openpose_caffe-build/CMakeFiles/CMakeOutput.log".
See also "/content/openpose/build/caffe/src/openpose_caffe-build/CMakeFiles/CMakeError.log".
CMakeFiles/openpose_caffe.dir/build.make:105: recipe for target 'caffe/src/openpose_caffe-stamp/openpose_caffe-configure' failed
make[2]: *** [caffe/src/openpose_caffe-stamp/openpose_caffe-configure] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/openpose_caffe.dir/all' failed
make[1]: *** [CMakeFiles/openpose_caffe.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@pablobots
Copy link

didn´t work

@miu200521358
Copy link

Nice to meet you.
I fixed the script that introduces Openpose in Google Colab.
As of March 5, the version of cmake is 3.12, but this version seems to fail to build CUDA 10.

https://developercommunity.visualstudio.com/content/problem/354325/cmake-project-cannot-detect-cuda-10.html

  1. Change the type of runtime to "GPU"
  2. Update cmake
  3. Introducing Openpose

Please try it if you do not mind.

cmake

! wget -c "https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4.tar.gz"
! tar xf cmake-3.13.4.tar.gz
! cd cmake-3.13.4 && ./configure && make && sudo make install

openpose

# ライブラリのインストール

# Basic
! sudo apt-get --assume-yes update
! sudo apt-get --assume-yes install build-essential
# OpenCV
! sudo apt-get --assume-yes install libopencv-dev
# General dependencies
! sudo apt-get --assume-yes install libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
! sudo apt-get --assume-yes install --no-install-recommends libboost-all-dev
# Remaining dependencies, 14.04
! sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev liblmdb-dev
# Python2 libs
! sudo apt-get --assume-yes install python-setuptools python-dev build-essential
! sudo easy_install pip
! sudo -H pip install --upgrade numpy protobuf opencv-python
# Python3 libs
! sudo apt-get --assume-yes install python3-setuptools python3-dev build-essential
! sudo apt-get --assume-yes install python3-pip
! sudo -H pip3 install --upgrade numpy protobuf opencv-python
# OpenCV 2.4 -> Added as option
# # sudo apt-get --assume-yes install libopencv-dev
# OpenCL Generic
! sudo apt-get --assume-yes install opencl-headers ocl-icd-opencl-dev
! sudo apt-get --assume-yes install libviennacl-dev

#  Openpose の clone
#! git clone  --depth 1 -b "$ver_openpose" https://github.com/CMU-Perceptual-Computing-Lab/openpose.git 
! git clone  --depth 1 https://github.com/CMU-Perceptual-Computing-Lab/openpose.git     

#  Openpose の モデルデータDL
! cd openpose/models && ./getModels.sh

# Openpose の ビルド
! sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
! cd openpose && rm -r build || true && mkdir build && cd build && cmake .. && make -j`nproc`

# サンプルの実行確認
! cd openpose && ./build/examples/openpose/openpose.bin --video examples/media/video.avi --write_json ./output/ --display 0  --write_video ./output/openpose.avi

@tugstugi
Copy link

If someone needs it, I have a prepared a Colab notebook to test OpenPose on YouTube videos: https://colab.research.google.com/github/tugstugi/dl-colab-notebooks/blob/master/notebooks/OpenPose.ipynb

I have also Colab notebooks for AlphaPose and DensePose: https://github.com/tugstugi/dl-colab-notebooks#pose-detection

@gineshidalgo99 gineshidalgo99 added the enhancement New feature or request label Apr 15, 2019
@gineshidalgo99
Copy link
Member

gineshidalgo99 commented Apr 15, 2019

@sirramsalott I will add this to the doc! I guess I will create a new file (e.g. doc/colab.md) or something like that. Thanks for your contribution!

I will also mention all the other issues/solutions posted here in that same document. Thanks to all.

UPDATED: Added a link from doc/installation.md to this post (to be pushed in the next commit), so everyone can benefit from this. I am closing this then, as it can be accessed from the link in the doc. Thanks again!

@arbibz001
Copy link

Wauw you are the boss!!

@edivadiranatnom
Copy link

Is it possible to run it on my macbook webcam instead of videos in Colab?

@pamruta
Copy link

pamruta commented May 31, 2019

Code compiled fine on Google Colab, but at run-time gives following error:

Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...

Error:
Cuda check failed (38 vs. 0): no CUDA-capable device is detected

Coming from:

  • /content/openpose/src/openpose/gpu/cuda.cpp:getCudaGpuNumber():53
  • /content/openpose/src/openpose/gpu/cuda.cpp:cudaCheck():42
  • /content/openpose/src/openpose/gpu/cuda.cpp:getCudaGpuNumber():63
  • /content/openpose/src/openpose/gpu/gpu.cpp:getGpuNumber():27
  • /content/openpose/include/openpose/wrapper/wrapperAuxiliary.hpp:configureThreadManager():1188
  • /content/openpose/include/openpose/wrapper/wrapper.hpp:exec():424

@arbibz001
Copy link

arbibz001 commented May 31, 2019

Hi @pamruta ,

Did you change the runtime type of your colab project to GPU? Try to do the following steps:

  1. Click on "Runtime" in your colab project on the top bar.
  2. Click on "change runtime" and choose GPU under hardware accelator
  3. Run the script below: (I edited the script a little bit, by enabling the build_python. This script creates the build python openpose as well)
#install OpenPose
import os
from os.path import exists, join, basename, splitext

git_repo_url = 'https://github.com/CMU-Perceptual-Computing-Lab/openpose.git'
project_name = splitext(basename(git_repo_url))[0]
if not exists(project_name):
  # install new CMake
  !wget -q https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.tar.gz
  !tar xfz cmake-3.13.0-Linux-x86_64.tar.gz --strip-components=1 -C /usr/local
  # clone openpose git
  !git clone -q --depth 1 $git_repo_url
  !sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
  # install system dependencies and libraries
  !apt-get -qq install -y libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libgflags-dev libgoogle-glog-dev liblmdb-dev opencl-headers ocl-icd-opencl-dev libviennacl-dev
  # install python dependencies
  !pip install -q youtube-dl
  # build openpose
  !cd openpose && rm -rf build || true && mkdir build && cd build && cmake -DBUILD_PYTHON=ON .. && make -j`nproc`
  
print("installation done")

@pamruta
Copy link

pamruta commented May 31, 2019

Hi @pamruta ,

Did you change the runtime type of your colab project to GPU? Try to do the following steps:

  1. Click on "Runtime" in your colab project on the top bar.
  2. Click on "change runtime" and choose GPU under hardware accelator
  3. Run the script below: (I edited the script a little bit, by enabling the build_python. This script creates the build python openpose as well)
#install OpenPose
import os
from os.path import exists, join, basename, splitext

git_repo_url = 'https://github.com/CMU-Perceptual-Computing-Lab/openpose.git'
project_name = splitext(basename(git_repo_url))[0]
if not exists(project_name):
  # install new CMake
  !wget -q https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.tar.gz
  !tar xfz cmake-3.13.0-Linux-x86_64.tar.gz --strip-components=1 -C /usr/local
  # clone openpose git
  !git clone -q --depth 1 $git_repo_url
  !sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
  # install system dependencies and libraries
  !apt-get -qq install -y libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libgflags-dev libgoogle-glog-dev liblmdb-dev opencl-headers ocl-icd-opencl-dev libviennacl-dev
  # install python dependencies
  !pip install -q youtube-dl
  # build openpose
  !cd openpose && rm -rf build || true && mkdir build && cd build && cmake -DBUILD_PYTHON=ON .. && make -j`nproc`
  
print("installation done")

Yes, I forgot to set the runtime type with GPU accelerator.. Finally, got it working..

Here is the output video -
https://www.youtube.com/watch?v=eipnXAHasIo

Link to Colab Notebook: http://tiny.cc/9ipm7y

Thanks!

@nahilahmed
Copy link

I followed @pamruta s Notebook, But when i try it to run it upon an image it seems to be giving me the error

!cd openpose && ./build/examples/openpose/openpose.bin --image_dir ../ vlcsnap-2016-12-01-23h49m28s384.png

Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...
Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0.
Unable to init server: Could not connect: Connection refused

Can anyone like help me?
Screenshot (40)

@aanexplus
Copy link

Nice to meet you.
I fixed the script that introduces Openpose in Google Colab.
As of March 5, the version of cmake is 3.12, but this version seems to fail to build CUDA 10.

https://developercommunity.visualstudio.com/content/problem/354325/cmake-project-cannot-detect-cuda-10.html

  1. Change the type of runtime to "GPU"
  2. Update cmake
  3. Introducing Openpose

Please try it if you do not mind.

cmake

! wget -c "https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4.tar.gz"
! tar xf cmake-3.13.4.tar.gz
! cd cmake-3.13.4 && ./configure && make && sudo make install

openpose

# ライブラリのインストール

# Basic
! sudo apt-get --assume-yes update
! sudo apt-get --assume-yes install build-essential
# OpenCV
! sudo apt-get --assume-yes install libopencv-dev
# General dependencies
! sudo apt-get --assume-yes install libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
! sudo apt-get --assume-yes install --no-install-recommends libboost-all-dev
# Remaining dependencies, 14.04
! sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev liblmdb-dev
# Python2 libs
! sudo apt-get --assume-yes install python-setuptools python-dev build-essential
! sudo easy_install pip
! sudo -H pip install --upgrade numpy protobuf opencv-python
# Python3 libs
! sudo apt-get --assume-yes install python3-setuptools python3-dev build-essential
! sudo apt-get --assume-yes install python3-pip
! sudo -H pip3 install --upgrade numpy protobuf opencv-python
# OpenCV 2.4 -> Added as option
# # sudo apt-get --assume-yes install libopencv-dev
# OpenCL Generic
! sudo apt-get --assume-yes install opencl-headers ocl-icd-opencl-dev
! sudo apt-get --assume-yes install libviennacl-dev

#  Openpose の clone
#! git clone  --depth 1 -b "$ver_openpose" https://github.com/CMU-Perceptual-Computing-Lab/openpose.git 
! git clone  --depth 1 https://github.com/CMU-Perceptual-Computing-Lab/openpose.git     

#  Openpose の モデルデータDL
! cd openpose/models && ./getModels.sh

# Openpose の ビルド
! sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
! cd openpose && rm -r build || true && mkdir build && cd build && cmake .. && make -j`nproc`

# サンプルの実行確認
! cd openpose && ./build/examples/openpose/openpose.bin --video examples/media/video.avi --write_json ./output/ --display 0  --write_video ./output/openpose.avi

Hi,
Can I install OpenPose to a mounted Gdrive? I tried this but I got some errors. I want to know if you've tried this before.
Thank you

@tienthegainz
Copy link

I want to import pyopenpose as well. Any idea? Anw thanks man. That saved me lots of time.

@abhiverma1924
Copy link

If someone needs it, I have a prepared a Colab notebook to test OpenPose on YouTube videos: https://colab.research.google.com/github/tugstugi/dl-colab-notebooks/blob/master/notebooks/OpenPose.ipynb

I have also Colab notebooks for AlphaPose and DensePose: https://github.com/tugstugi/dl-colab-notebooks#pose-detection

Yes, your script is working, but I want to obtain pose coordinates can be obtained that by working further on your code.

@pra-dan
Copy link

pra-dan commented Sep 30, 2019 via email

@abhiverma1924
Copy link

If you need the coordinates, follow this. I managed to do it: PrashantDandriyal/Heuristic-Approach-for-HAR#1 Prashant Dandriyal

On Mon, Sep 30, 2019 at 12:07 AM Abhinav verma @.***> wrote: If someone needs it, I have a prepared a Colab notebook to test OpenPose on YouTube videos: https://colab.research.google.com/github/tugstugi/dl-colab-notebooks/blob/master/notebooks/OpenPose.ipynb I have also Colab notebooks for AlphaPose and DensePose: https://github.com/tugstugi/dl-colab-notebooks#pose-detection Yes, your script is working, but I want to obtain pose coordinates can be obtained that by working further on your code. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#949?email_source=notifications&email_token=ALC73KLRZY7YRICT7I4PKK3QMDYV7A5CNFSM4GIMVC42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD733VVQ#issuecomment-536328918>, or mute the thread https://github.com/notifications/unsubscribe-auth/ALC73KIHYCIMBXBGMSGC43TQMDYV7ANCNFSM4GIMVC4Q .

So, which process we should follow in order to run your code, for the installation and building of tf-pose. I am facing a problem there.

@pra-dan
Copy link

pra-dan commented Sep 30, 2019 via email

@aimanraza
Copy link

I want to import pyopenpose as well. Any idea? Anw thanks man. That saved me lots of time.

Did you managed to solve this problem? Can u help me. I am also facing the same issue.

@cperbost
Copy link

cperbost commented Mar 1, 2020

@PrashantDandriyal Did you create a collab to get the coordinates? I am struggling with it

@swarnav25
Copy link

@bhavesh2799 Were you able to run openpose from mounted gdrive?

@bhavesh2799
Copy link

@bhavesh2799 Were you able to run openpose from mounted gdrive?

No dude, there were configuration errors. Errors were like this. https://pastebin.com/51Qjw6yd

@seanwynwins
Copy link

I also tried to build in google drive but got an error as well. If anyone has fixed this problem of having to build open pose over again and again, that would be great!

@Anubhav507
Copy link

Hey guys does anyone know how to get json file of all the keypoints instead of visualizing it? I want all the keypoints so I can analyse them and I can't find a command that works in colab

@BANANAPEEL202
Copy link

Hey guys does anyone know how to get json file of all the keypoints instead of visualizing it? I want all the keypoints so I can analyse them and I can't find a command that works in colab

This is what I used in Colab for JSON output
! cd openpose && ./build/examples/openpose/openpose.bin --video "$root_path/$file_path" --render_pose 0 --display 0 --number_people_max=2 --write_json "$output_path"

@Anubhav507
Copy link

hey @BANANAPEEL202 thank you so much for your help , it worked for me . I got 119 json files as output of tracking a video and if I am correct that must be output of every frame , right?

@BANANAPEEL202
Copy link

yup a json for every frame.

@Anubhav507
Copy link

Can anyone also help me as I am struggling to find a command which is used to detect keypoints in an image in google colab.
the command for video is working but I can't find any command for keypoint detection of image

@hadeer7
Copy link

hadeer7 commented Feb 25, 2021

I have been trying openpose on the mounted drive but i failed , any help ?

@manlio99
Copy link

manlio99 commented Mar 1, 2021

I followed @pamruta s Notebook, But when i try it to run it upon an image it seems to be giving me the error

!cd openpose && ./build/examples/openpose/openpose.bin --image_dir ../ vlcsnap-2016-12-01-23h49m28s384.png

Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...
Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0.
Unable to init server: Could not connect: Connection refused

Can anyone like help me?
Screenshot (40)

i have the same error!

/content/staf
Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...

Error:
Cuda check failed (100 vs. 0): no CUDA-capable device is detected

Coming from:

  • /content/staf/src/openpose/gpu/cuda.cpp:getCudaGpuNumber():48
  • /content/staf/src/openpose/gpu/cuda.cpp:cudaCheck():37
  • /content/staf/src/openpose/gpu/cuda.cpp:getCudaGpuNumber():58
  • /content/staf/src/openpose/gpu/gpu.cpp:getGpuNumber():27
  • /content/staf/include/openpose/wrapper/wrapperAuxiliary.hpp:configureThreadManager():1221
  • /content/staf/include/openpose/wrapper/wrapper.hpp:exec():424

@miu200521358
Copy link

Hello everyone.
I have created a Google Colab notebook that supports Openpose 1.7.0.
Please try it if you like.

https://colab.research.google.com/github/miu200521358/motion_trace_colab/blob/master/OpenposeDemo.ipynb

@chepo92
Copy link

chepo92 commented May 2, 2021

Hello everyone.
I have created a Google Colab notebook that supports Openpose 1.7.0.
Please try it if you like.

https://colab.research.google.com/github/miu200521358/motion_trace_colab/blob/master/OpenposeDemo.ipynb

Works flawlessly, it should be added a precompiled build for cmake and open pose so one just pulls the binaries from a repo rather than compiling it every time

@JCamERG
Copy link

JCamERG commented May 19, 2021

Hello everyone.
I have created a Google Colab notebook that supports Openpose 1.7.0.
Please try it if you like.

https://colab.research.google.com/github/miu200521358/motion_trace_colab/blob/master/OpenposeDemo.ipynb

Hello !! I have a problem in this line, PLIS! help me.
https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md#cmake-command-line-configuration-ubuntu-only 上記インストール手順のシナリオ1でインストール実行 Scenario 1 - Caffe not installed and OpenCV installed using apt-get ! cd openpose/build && cmake ..
the error:
-- Configuring incomplete, errors occurred!
See also "/content/openpose/build/CMakeFiles/CMakeOutput.log".
See also "/content/openpose/build/CMakeFiles/CMakeError.log".

@miu200521358
Copy link

@JCamERG

Hi. I am miu who created this Colab page.

Cmake has failed due to the inability to connect to the URL below, which is the model download source.
http://posefs1.perception.cs.cmu.edu/OpenPose/

I suspect that the URL may be temporarily inaccessible due to heavy load or revocation of the server certificate.
The Openpose development team can resolve this issue, so please wait until access is restored.

@JCamERG
Copy link

JCamERG commented May 26, 2021

@JCamERG

Hi. I am miu who created this Colab page.

Cmake has failed due to the inability to connect to the URL below, which is the model download source.
http://posefs1.perception.cs.cmu.edu/OpenPose/

I suspect that the URL may be temporarily inaccessible due to heavy load or revocation of the server certificate.
The Openpose development team can resolve this issue, so please wait until access is restored.

Thanks for responding, and how long has not the page been in service?

is there another way to use openpose in colab?

Thank you so much

@balochsaba
Copy link

i am using google colab for openpose, its working well however im trying to disable blending which i dont know how to achieve.
any leads?

@sparshgarg23
Copy link

I have used the following script with BUILD_PYTHON enabled which is shown below.

# @title Install OpenPose
# @markdown This will take some time (~10 mins). The code is taken from this [OpenPose Colab notebook](https://colab.research.google.com/github/tugstugi/dl-colab-notebooks/blob/master/notebooks/OpenPose.ipynb).

%cd /content
import os
from os.path import exists, join, basename, splitext

git_repo_url = 'https://github.com/CMU-Perceptual-Computing-Lab/openpose.git'
project_name = splitext(basename(git_repo_url))[0]
if not exists(project_name):
  # see: https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/949
  # install new CMake becaue of CUDA10
  !wget -q https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.tar.gz
  !tar xfz cmake-3.13.0-Linux-x86_64.tar.gz --strip-components=1 -C /usr/local

  # clone openpose
  !git clone -q --depth 1 $git_repo_url
  # download models
  !wget -O /content/openpose/models/hand/pose_iter_102000.caffemodel https://polybox.ethz.ch/index.php/s/Oim76cuqrDVbdxm/download
  !wget -O /content/openpose/models/pose/body_25/pose_iter_584000.caffemodel https://polybox.ethz.ch/index.php/s/m5NQAhd7ukVPRoL/download
  !wget -O /content/openpose/models/face/pose_iter_116000.caffemodel https://polybox.ethz.ch/index.php/s/cEaF1FTpKjjJZbH/download
  !sed -i 's/execute_process(COMMAND git checkout master WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/execute_process(COMMAND git checkout f019d0dfe86f49d1140961f8c7dec22130c83154 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\/3rdparty\/caffe)/g' openpose/CMakeLists.txt
  # install system dependencies
  !apt-get -qq install -y libatlas-base-dev libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libgflags-dev libgoogle-glog-dev liblmdb-dev opencl-headers ocl-icd-opencl-dev libviennacl-dev
  # install python dependencies
  !pip install -q youtube-dl
  # build openpose
  !cd openpose && rm -rf build || true && mkdir build && cd build && cmake -DBUILD_PYTHON=ON .. && make -j`nproc

openpose gets succesfully installed but when I try to use openpose as follows

import openpose as op
opWrapper=op.WrapperPython()
module 'openpose' has no attribute 'WrapperPython'

Any ideas on what is going wrong here and how I can correct it?

@sparshgarg23
Copy link

@iron1111 should I use --display 0 --render_pose 0 in build command.Anyways thanks for getting back,I was able to find a workaround by referring to https://github.com/sergeyprokudin/smplpix .In the colab tutorial the author of the repo uses openpose to do pose estimation

@jason-wuwu
Copy link

Is there a way to install openpose permanently in Colab without reinstalling it each time I try to use it?

@davidpagnon
Copy link

davidpagnon commented May 5, 2023

Hello,

I keep running into Check failed: error == cudaSuccess (2 vs. 0) out of memory *** Check failure stack trace: ***. And yet,

  • I executed my colab with GPU, with free 15360MB
  • I use CuDNN: cuDNN : Yes (ver. 8.7.0)
  • I tried with minimal computation requirements: plain body_25, --display 0 --render_pose 0 --net_resolution -1x16. Still same error.

Would you be able to help me?


EDIT: Well I just realized that this error occurs upon building.

/content/openpose/3rdparty/caffe/include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
/content/openpose/3rdparty/caffe/include/caffe/util/cudnn.hpp:21:8: warning: enumeration value ‘CUDNN_STATUS_VERSION_MISMATCH’ not handled in switch [-Wswitch]

So CuDNN faces at least some sort of issue. Any idea how to solve this though?

@sparshgarg23
Copy link

@davidpagnon not an exact reply to the cudnn issue you're facing but if you wish to use open pose try looking into this
https://github.com/prasunroy/openpose-pytorch
I used it for my work on pose transfer and it works smoothly in colab.

@davidpagnon
Copy link

Okay, nice, I'll give it a try, hopefully it will run!

My main concerns in this case are that:

  • I would eventually like to use the experimental body_25b model, and I'm not sure how to use these models there. Is this even possible without major hassle?
  • I would also like to override a function that uses the classic OpenPose flags. This should not be impossible to do, but that sounds like more work than I initially intended 😅

@davidpagnon
Copy link

I finally made it work by running !apt install --allow-change-held-packages libcudnn8=8.1.0.77-1+cuda11.2 to use compatible CUDA and cuDNN versions (see my Sports2D colab: Open In Colab)

@gnigam87
Copy link

gnigam87 commented Oct 13, 2023

@JCamERG

Hi. I am miu who created this Colab page.

Cmake has failed due to the inability to connect to the URL below, which is the model download source. http://posefs1.perception.cs.cmu.edu/OpenPose/

I suspect that the URL may be temporarily inaccessible due to heavy load or revocation of the server certificate. The Openpose development team can resolve this issue, so please wait until access is restored.

Hi,
I am also facing this issue. Can someone from Openpose development team please resolve this issue and restore the access?

@chepo92
Copy link

chepo92 commented Oct 25, 2023

See other issues where they have backup of models and new colab scipts eg #1567

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests