bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/◯◯◯:[TARGET_NAME]
TARGET_NAMEはBUILDファイルの中に書いてある。
◯◯◯を試したいSampleに変更すればオッケー...というわけではない。
Hand Tracking
◯◯◯をhand_trackingにする ビルド
$ bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
errorになった。※1
実行
$ 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
でUSBカメラが繋がっていればウィンドウが表示され、Hand Trackingされていることがわかる。
※1
gcc7を使っているとエラーになるのでgcc8へバージョアップする。
https://github.com/google/mediapipe/issues/1733
$ sudo apt-get install gcc-8 g++-8 $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
ちなみに、gcc7へ戻す場合
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
キャッシュに中間生成物が残っているのでクリーンする。
$ bazel clean --expunge