栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

大人,时代变了 | Ubuntu18.04 Openpose-GPU 极简安装手册

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

大人,时代变了 | Ubuntu18.04 Openpose-GPU 极简安装手册

一、安装依赖

默认你已经装好了NVIDIA显卡驱动、CUDA、CUDNN,且在Ubuntu18.04下

sudo apt install build-essential
sudo apt install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff5-dev libdc1394-22-dev
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev
sudo apt install libxvidcore-dev libx264-dev
sudo apt install libatlas-base-dev gfortran
sudo apt install ffmpeg
二、安装Openpose
git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose
cd openpose
sudo bash ./scripts/ubuntu/install_deps.sh
mkdir build
cd build
cmake ..
make -j4 
sudo make install
三、测试Openpose
~/openpose/build/examples/openpose/openpose.bin 
    --write_json outputJSON/   
    --display 0  
    --model_folder /home/nvidia/openpose/models 
    --video "./inputVideo.mp4"   
    --write_video outputVideo.avi

 

注意:

1、命令输入位置在home目录,Ctrl+Alt+T打开的那个位置

2、第一行注意用绝对路径,我用相对路径报错

3、第四行模型文件夹同样使用绝对路径

4、第五行视频路径我是放在~/下面,用.表示相对路径

补充:

内置的install_deps.sh很慢,我加了国内源

#!/bin/bash



### INSTALL PREREQUISITES



UBUNTU_VERSION="$(lsb_release -r)"



# Basic

sudo apt-get --assume-yes update

sudo apt-get --assume-yes install build-essential

# 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

sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev

# LMDB is needed for Caffe training, but very likely not for inference-only

sudo apt-get --assume-yes install liblmdb-dev



# Python2 libs (Official Ubuntu support dropped after Ubuntu 20)

if [[ $UBUNTU_VERSION == *"14."* ]] || [[ $UBUNTU_VERSION == *"15."* ]] || [[ $UBUNTU_VERSION == *"16."* ]] || [[ $UBUNTU_VERSION == *"17."* ]] || [[ $UBUNTU_VERSION == *"18."* ]]; then

    echo "Installing Python2 libs..."

    sudo apt-get --assume-yes install python-setuptools python-dev build-essential

    hash pip2 2> /dev/null || sudo apt-get --assume-yes install python-pip

    sudo -H python2 -m pip install pip --upgrade -i https://pypi.douban.com/simple

    if [[ $CI == true ]]; then

        sudo -H python2 -m pip install --upgrade "numpy<1.17" protobuf -i https://pypi.douban.com/simple

        python2 -m pip install --user "opencv-python<4.3" -i https://pypi.douban.com/simple

    else

        sudo -H python2 -m pip install --upgrade "numpy<1.17" protobuf "opencv-python<4.3" -i https://pypi.douban.com/simple

    fi

fi

# Python3 libs

echo "Installing Python3 libs..."

sudo apt-get --assume-yes install python3-setuptools python3-dev build-essential

hash pip3 2> /dev/null || sudo apt-get --assume-yes install python3-pip

sudo -H python3 -m pip install pip --upgrade -i https://pypi.douban.com/simple

if [[ $CI == true ]]; then

    sudo -H python3 -m pip install --upgrade numpy protobuf -i https://pypi.douban.com/simple

    python3 -m pip install --user opencv-python -i https://pypi.douban.com/simple

else

    sudo -H python3 -m pip install --upgrade numpy protobuf opencv-python -i https://pypi.douban.com/simple

fi



# OpenCL Generic (Official OpenPose support dropped after Ubuntu 20)

if [[ $UBUNTU_VERSION == *"14."* ]] || [[ $UBUNTU_VERSION == *"15."* ]] || [[ $UBUNTU_VERSION == *"16."* ]] || [[ $UBUNTU_VERSION == *"17."* ]] || [[ $UBUNTU_VERSION == *"18."* ]]; then

	sudo apt-get --assume-yes install opencl-headers ocl-icd-opencl-dev

	sudo apt-get --assume-yes install libviennacl-dev

fi

# OpenCV 2.4 -> Added as option

# # sudo apt-get --assume-yes install libopencv-dev

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/932088.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号