Sitemap

Mediapipe 安裝教學

1 min readSep 28, 2020

Ubuntu 18.04

  1. Clone mediapipe
git clone https://github.com/google/mediapipe.git

2. go to the folder 進入到下載好的目錄

cd mediapipe

3-1. 安裝bazel

sudo apt install bazel-3.0.0

3–2. 檢查安裝版本

bazel --version

4. 建立symlink

sudo ln -sf /usr/bin/bazel-3.0.0 /usr/bin/bazel

5. 安裝opencv, FFmpeg

sudo apt-get install libopencv-core-dev libopencv-highgui-dev \
libopencv-calib3d-dev libopencv-features2d-dev \
libopencv-imgproc-dev libopencv-video-dev

安裝完成

測試example

Example 1: Hello World

1–1. Build

sudo apt-get install mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev

1–2. CPU version

export GLOG_logtostderr=1
bazel run --define MEDIAPIPE_DISABLE_GPU=1 \
mediapipe/examples/desktop/hello_world:hello_world

1–3. GPU version

export GLOG_logtostderr=1
bazel run --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 \
mediapipe/examples/desktop/hello_world:hello_world

Example 2: hand tracking CPU version

2–1. Build

bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu

2–2. Run

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

Example 3: hand tracking GPU version

3–1. Build

bazel build -c opt --copt -DMESA_EGL_NO_X11_HEADERS --copt -DEGL_NO_X11 \
mediapipe/examples/desktop/hand_tracking:hand_tracking_gpu

3–2. Run

GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_gpu \
--calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_mobile.pbtxt

--

--

Wen K.
Wen K.

Written by Wen K.

0 followers

好奇、探索事物。

No responses yet