LoginSignup
14
14

More than 5 years have passed since last update.

OpenPoseのFace Estimationを動かしてみた。

Last updated at Posted at 2017-06-11

目次

1.OpenPoseを動かしてみた。
2.OpenPoseチュートリアルのソースコードを読む。
3.WindowsでOpenPoseを動かしてみた。
4.OpenPoseのFace Estimationを動かしてみた。
5.OpenPoseのHand Estimationを動かしてみた。

目的

OpenPose 1.0.0rc3(Jun 2017)で、Pose Estimationに加えて、Face Estimationが実装された。OpenPoseのFace Estimationを動かしてみた。
github OpenPose

smartphone_Mika_Rika_22_rendered.png
フリー素材アイドルmika☆rika様の素材画像を使用しました。 http://mika-rika-free.jp/

使用環境

Description: Ubuntu 14.04.5(x64) LTS trusty
CUDA Version 8.0.61
NVIDIA-SMI 375.66 / Driver Version: 375.66 / GeForce GTX 1050
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
OpenPose 1.0.0rc3(Jun 2017)

OpenPoseのインストール

OpenPoseを動かしてみた。を参照。

$ mkdir ~/development
$ cd ~/development
$ git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
$ cd openpose
$ chmod +x install_caffe_and_openpose.sh
$ ./install_caffe_and_openpose.sh

ソースコードの修正

renderer.hppの修正

./include/openpose/core/renderer.hpp:24:84: error: ‘atomic’ is not a member of ‘std’

とコンパイルエラーが起きた場合、ソースの先端に#include を追加。
https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/64

openpose.cppの修正

サンプルのソース、openpose.cppを修正する。

./example/openpose/openpose.cpp

face keypoint detectionを有効にする。

   82:DEFINE_bool(face, false, "Enables face keypoint detection. It will share some parameters from the body pose, e.g. `model_folder`.");
→  82:DEFINE_bool(face, true , "Enables face keypoint detection. It will share some parameters from the body pose, e.g. `model_folder`.");

net_resolution・face_net_resolutionをGPUのメモリにあわせて調整する。

net_resolutionの値は、16の倍数(16,32,48...)とする。net_resolutionをあげるほど検出精度があがるが、処理速度が遅くなる。net_resolutionを下げると処理速度があがるが、検出精度が落ちる。例えば、下記の値とすると、GPUメモリが1.5GB消費される。


  71:DEFINE_string(net_resolution,"656x368","Multiples of 16. If it is increased, the accuracy usually increases. If it is decreased, the speed increases.");

→ 71:DEFINE_string(net_resolution,"320x160","Multiples of 16. If it is increased, the accuracy usually increases. If it is decreased, the speed increases.");
  83:DEFINE_string(face_net_resolution,"328x328","Multiples of 16. Analogous to `net_resolution` but applied to the face keypoint detector. 320x320 usually works fine while giving a substantial speed up when multiple faces on the image.");

→ 83:DEFINE_string(face_net_resolution,"160x160","Multiples of 16. Analogous to `net_resolution` but applied to the face keypoint detector. 320x320 usually works fine while giving a substantial speed up when multiple faces on the image.");

openposeを動かしてみる。

1. サンプル動画で動かしてみる

./build/examples/openpose/openpose.bin --video examples/media/video.avi

2. Webカメラで動かしてみる

./build/examples/openpose/openpose.bin

3. サンプル静止画で動かしてみる

./build/examples/openpose/openpose.bin --image_dir examples/media/

エラーが発生する場合、

下記のエラーが発生する場合、GPUのメモリーをオーバーフローしている。net_resolutionを調整する。

Check failed: error == cudaSuccess (2 vs. 0) out of memory

参考:
https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/58

後書き

hand estimationの公開も近い。公開次第、試す予定。
>Multi-person 2x21-keypoint hand estimation and rendering. Note: In this initial version, running time linearly depends on the number of people on the image. Coming soon (in around 1-5 weeks)!
OpenPose v1.0公開に伴い、hand estimationが実装されました

14
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
14