close

這是經過多次測試所跑出來的流程,版本要相同才能避免一些BUG


1.安裝nvidia驅動

  • sudo add-apt-repository ppa:graphics-drivers/ppa
  • sudo apt update
  • sudo apt install ubuntu-drivers-common
  • ubuntu-drivers devices

查看驅動狀態

2020-03-01 09-49-28 的螢幕擷圖.png

  • sudo apt install nvidia-driver-440

(通常是安裝最新的,但可以稍微測試一下哪個版本最正常)

  • sudo reboot

 

網站內檢查驅動安裝是否安裝正確的方式:

http://benjaminnl.pixnet.net/blog/post/4897796-ubuntu-%E5%AE%89%E8%A3%9Dnvidia%E9%A9%85%E5%8B%95


2.安裝CUDA10

  • sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
  • wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux
  • sudo sh cuda_10.0.130_410.48_linux

 

2020-03-01 00-32-57 的螢幕擷圖.png

成功後會出現:

Installing the CUDA Toolkit in /usr/local/cuda-10.0 ...
Installing the CUDA Samples in /home/winter ...
Copying samples to /home/winter/NVIDIA_CUDA-10.0_Samples now...
Finished copying samples.

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-10.0
Samples:  Installed in /home/winter

Please make sure that
 -   PATH includes /usr/local/cuda-10.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64, or, add /usr/local/cuda-10.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-10.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.0/doc/pdf for detailed information on setting up CUDA.

***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 10.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

Logfile is /tmp/cuda_install_15075.log

 

裡面有檢查CUDA是否安裝正確的方法:

http://benjaminnl.pixnet.net/blog/post/4874375-%E6%AA%A2%E6%9F%A5cuda%E6%98%AF%E5%90%A6%E5%AE%89%E8%A3%9D%E6%88%90%E5%8A%9F


3.安裝Cudnn

http://developer.nvidia.com/rdp/cudnn-download

要先登入下載:

cuDNN v7.3.1 Library for Linux

2020-03-02 19-03-10 的螢幕擷圖.png

先解壓縮然後將檔案放入cuda:

  • tar -xvf cudnn-10.0-linux-x64-v7.3.1.20.tgz
  • sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
  • sudo cp cuda/lib64/lib* /usr/local/cuda/lib64/
  • cd /usr/local/cuda/lib64/
  • sudo chmod +r libcudnn.so.7.3.1
  • sudo ln -sf libcudnn.so.7.3.1 libcudnn.so.7
  • sudo ln -sf libcudnn.so.7 libcudnn.so
  • sudo ldconfig

 

裡面有檢查Cudnn是否安裝正確的心得:

http://benjaminnl.pixnet.net/blog/post/4916189-ubuntu-%E5%AE%89%E8%A3%9Dcudnn-7.3.1-for-cuda10


4.cmake安裝

 

  • sudo apt-get update
  • sudo apt-get install qt5-default qtcreator
  • wget https://cmake.org/files/v3.15/cmake-3.15.6.tar.gz
  • tar -xzf cmake-3.15.6.tar.gz
  • cd cmake-3.15.6/
  • ./configure --qt-gui
  • make -j6
  • cd bin/
  • ./cmake-gui

 

2020-03-02 19-24-44 的螢幕擷圖.png

 


5.opencv4.2.0

  • sudo apt-get update
  • sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
  • sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
  • sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy
  • sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev
  • sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp
  • sudo apt-get install -y curl
  • sudo apt-get update
  • wget https://github.com/opencv/opencv/archive/4.2.0.zip
  • unzip 4.2.0.zip
  • cd opencv-4.2.0/
  • mkdir build
  • cd build/
  • cmake ..
  • make -j6
  • sudo make install -j6

檢查opencv的版本

  • python
  • import cv2
  • cv2.__version__

2020-03-02 20-17-56 的螢幕擷圖.png

 


6.安裝openpose

  • sudo apt install libcanberra-gtk-module libcanberra-gtk3-module
  • sudo apt-get --assume-yes update
  • sudo apt-get --assume-yes install build-essential
  • 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
  • sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev liblmdb-dev
  • 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
  • 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
  • sudo apt-get --assume-yes install opencl-headers ocl-icd-opencl-dev
  • git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
  • cd openpose/
  • mkdir build
  • git clone https://github.com/CMU-Perceptual-Computing-Lab/caffe.git
  • git clone https://github.com/pybind/pybind11.git

 

開啟cmake-gui

  • cd ~/cmake-3.15.6/bin/
  • ./cmake-gui

image(1).png

 

按下configure

 

2020-03-01 22-12-49 的螢幕擷圖.png

按下Finish

 

2020-03-01 22-17-40 的螢幕擷圖.png

完成後的樣子

 

接著要往下滑找到download  全部打勾

2020-03-01 22-18-04 的螢幕擷圖.png

接著按下Generate

2020-03-01 22-21-32 的螢幕擷圖.png

接著就可以編譯openpose了

  • cd openpose/build/
  • make -j6

開啟openpose

  • cd openpose/
  • ./build/examples/openpose/openpose.bin

如果要開啟影片可以輸入

  • ./build/examples/openpose/openpose.bin --video 檔案名稱.mp4

檔案要放在openpose目錄


如有問題可以發問,我們可以一起研究,或是有哪裡不清楚的地方都可以詢問,謝謝。

arrow
arrow
    創作者介紹
    創作者 微笑創客 的頭像
    微笑創客

    微笑創客 Smile assassin

    微笑創客 發表在 痞客邦 留言(3) 人氣()