mediapipeお試し
Hnad Trackingがヌルヌル動くニュース記事を見てちょっとお試し。基本スマホで動作させてる人が多かったけど、Mac環境で試している人はあまりいなかったので手順を記載。
(参照: https://ai.googleblog.com/2019/08/on-device-real-time-hand-tracking-with.html)
環境
- PC: Mac Book Pro
- OS: macOS Mojave 10.14.6
インストール
- 公式(2019/10/02時点)
- gitからdl
$ git clone https://github.com/google/mediapipe.git
$ cd mediapipe
- bazelをinstall (手動でinstallでも可)
$ brew install bazel
- opencv/ffmpegをinstall (依存があるようなので注意)
$ brew install opencv@3
- hello world実行 (Hello Worldが出力されたOK)
$ export GLOG_logtostderr=1
$ bazel run --define MEDIAPIPE_DISABLE_GPU=1 \
mediapipe/examples/desktop/hello_world:hello_world
Hand Trackingお試し
- Hello World出来たら環境のインストール出来ているので次はHnad Trackingを動作させる
$ bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 \
mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
$ export GLOG_logtostderr=1
$ bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_cpu \
--calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live.pbtxt
うまく実行したらカメラが起動するので手をかざすだけで反応する。かなり精度良い。ただ同時に認識するのは1つだけのよう。


