OpenPoseを試してみた。
OpenPose-Tensorflow
本家CaffeベースのOpenPoseを試したが・・・
Check failed: error == cudaSuccess (2 vs. 0) out of memory
で断念。
Tensorflow版はうまく動いた。
- 20/05/08
- Ubuntu18.04.4
- GeForce RTX 2060
- Docker version 19.03.8
REF
https://github.com/ildoonet/tf-pose-estimation
- dockerコンテナ上に環境を構築して実行した。
1. docker container
dockerfile
FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04 ENV DEBIAN_FRONTEND=noninteractive \ LC_ALL=C.UTF-8 \ LANG=C.UTF-8 RUN apt update && apt install -y --no-install-recommends \ git curl wget \ python3-dev \ cython3 \ python3-tk \ libgtk2.0-dev \ swig \ imagemagick \ && rm -rf /var/lib/apt/lists/* RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ && python3 get-pip.py \ && rm get-pip.py RUN pip3 install --no-cache-dir \ numpy \ tensorflow-gpu==1.15 \ opencv-python==3.4.5.20 WORKDIR /workspace RUN git clone https://www.github.com/ildoonet/tf-pose-estimation \ && cd tf-pose-estimation \ && pip3 install -r requirements.txt WORKDIR /workspace/tf-pose-estimation/tf_pose/pafprocess RUN swig -python -c++ pafprocess.i && python3 setup.py build_ext --inplace WORKDIR /workspace/tf-pose-estimation/models/graph/cmu RUN bash download.sh
build image
mkdir docker-build cd docker-build # dockerfileを作成 sudo gedit dockerfile docker build -t openpose-tensorflow:1.15 .
run container
xhost + docker run -it --rm --gpus all \ -e DISPLAY=$DISPLAY \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -v /etc/group:/etc/group:ro \ -v /etc/passwd:/etc/passwd:ro \ -u $(id -u $USER):$(id -g $USER) \ -w /workspace/tf-pose-estimation/ \ openpose-tensorflow:1.15
2. Run demo
python3 run.py --model=mobilenet_thin --resize=432x368 --image=./images/p1.jpg
result image
- INFO inference image: ./images/p1.jpg in 0.2125 seconds
以上。