在Google Colab上运行PyOpenPose

时间:2018-11-19 22:02:16

标签: python c++ cmake google-colaboratory openpose

我正在尝试在Google Colab上运行PyOpenPose

它需要CUDA,这就是我的方法。

!wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64 -O cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
!dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
!apt-key add /var/cuda-repo-10-0-local/7fa2af80.pub
!apt-get update
!apt-get install cuda

它需要OpenCV3,我只需使用-即可安装

!apt-get -qq install -y libsm6 libxext6 && pip install -q -U opencv-python

为解决一堆错误,我安装了其他几个软件包-

!apt-get install build-essential checkinstall pkg-config yasm
!apt-get install gfortran
!apt-get install libjpeg8-dev libjasper-dev libpng12-dev
!apt-get install libtiff5-dev
!apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
!apt-get install libxine2-dev libv4l-dev
!apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
!apt-get install qt5-default libgtk2.0-dev libtbb-dev
!apt-get install libatlas-base-dev
!apt-get install libfaac-dev libmp3lame-dev libtheora-dev
!apt-get install libvorbis-dev libxvidcore-dev
!apt-get install libopencore-amrnb-dev libopencore-amrwb-dev
!apt-get install x264 v4l-utils
!apt-get install libgoogle-glog-dev
!apt-get install libopencv-dev

然后我像这样安装CuDNN-

!wget "http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-8.0-linux-x64-v5.1.tgz"
!tar -xvzf cudnn-8.0-linux-x64-v5.1.tgz
!cp cuda/include/cudnn.h /usr/local/cuda/include
!cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
!chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
!dpkg -i libcudnn7_7.3.0.29-1+cuda10.0_amd64.deb
!apt-get install -f

然后我按照建议克隆了OpenPose。更改为目录。 设置os.environ['OPENPOSE_ROOT'] = os.getcwd() 生成一个构建目录。已安装cmake。然后尝试构建它。

!mkdir build
os.chdir("build")
!apt update
!apt install -y cmake
!cmake ..

继续,我继续在PyOpenPose中创建了一个构建目录。尝试运行它,并说它需要Boost库。 我使用以下命令安装了它-

!apt-get install libboost-all-dev

我可以看到usr/lib/x86_64-linux-gnu(设置为os.environ['BOOST_LIBRARYDIR'])中的boost库

助推器位于/usr/include/boost(设置为os.environ['BOOST_ROOT'])中

经过所有这些努力,我在构建目录中使用!cmake ..时遇到了这个错误:

cmake: /usr/local/lib/libcurl.so.4: no version information available 
(required by cmake)
Install prefix is set to: /usr/local
Generating with build type: Release
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Boost version: 1.65.1
CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1626     (message):
  No header defined for python2; skipping header check
Call Stack (most recent call first):
  CMakeLists.txt:61 (find_package)

CMake Error at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1947 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.65.1

  Boost include path: /usr/include

  Could not find the following Boost libraries:

      boost_python2

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or     BOOST_ROOT
  to the location of Boost.
Call Stack (most recent call first):
  CMakeLists.txt:61 (find_package)


-- The following REQUIRED packages have been found:
 * Threads
 * CUDA
 * OpenCV (required version >= 3)
 * PythonLibs (required version == 2.7)

-- The following OPTIONAL packages have not been found:
 * Doxygen

-- The following REQUIRED packages have not been found:
 * Boost

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

我的运行时是带有GPU的Python3。我该如何解决这个问题,到目前为止一切还好吗?

更新1: !cmake -D WITH_PYTHON3=True ..修复了该问题。 现在只能检测PythonLib。

错误:

CMake Error at /usr/share/cmake-    3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find PythonLibs: Found unsuitable version "2.7.15rc1", but
  required is exact version "3" (found
  /usr/lib/x86_64-linux-gnu/libpython2.7.so)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:376     (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.10/Modules/FindPythonLibs.cmake:262     (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:72 (find_package)

0 个答案:

没有答案
相关问题