mediapipe
mediapipe copied to clipboard
Mediapipe Face mesh does not execute GPU in the runtime.
System information
- OS Platform and Distribution (e.g. Linux Ubuntu 16.04, Android 11, iOS 14.4): Linux Ubuntu 18.04(Nvidia GeForce GTX 1080)
- Compiler version (e.g. gcc/g++ 8 /Apple clang version 12.0.0): gcc - 8.4.0, g++ - 8.4.0
- Programming Language and version ( e.g. C++ 14, Python 3.6, Java ): Python 3.7.13
- Installed using virtualenv? pip? Conda? (if python): Conda
- MediaPipe version: v0.8.10.2
- Bazel version: 5.2
- XCode and Tulsi versions (if iOS):
- Android SDK and NDK versions (if android):
- Android AAR ( if android):
- OpenCV version (if running on desktop): 4.5.3
Describe the problem: After Successfully building media pipe face mesh on GPU using this documentation https://google.github.io/mediapipe/getting_started/gpu_support.html. In the runtime not using the gpu.
Build command:
bazel build -c opt --config=cuda --spawn_strategy=local --define no_aws_support=true --copt -DMESA_EGL_NO_X11_HEADERS mediapipe/examples/desktop/face_mesh:face_mesh_gpu
Output:
Target //mediapipe/examples/desktop/face_mesh:face_mesh_gpu up-to-date:
bazel-bin/mediapipe/examples/desktop/face_mesh/face_mesh_gpu
INFO: Elapsed time: 310.885s, Critical Path: 210.43s
INFO: 3126 processes: 855 internal, 2271 local.
INFO: Build completed successfully, 3126 total actions
Run command:
GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/face_mesh/face_mesh_gpu --calculator_graph_config_file=mediapipe/graphs/face_mesh/face_mesh_desktop_live_gpu.pbtxt --input_video_path="/home/neuron/Desktop/gpu_mediapipe/video.mp4" --output_video_path="/home/neuron/Desktop/mediapipe_fresh/video_gpu.mp4"
Output:
I20220920 10:08:15.725648 18297 demo_run_graph_main_gpu.cc:58] Initialize the calculator graph.
I20220920 10:08:15.728091 18297 demo_run_graph_main_gpu.cc:62] Initialize the GPU.
libEGL warning: DRI2: failed to authenticate
I20220920 10:08:15.770144 18297 gl_context_egl.cc:84] Successfully initialized EGL. Major : 1 Minor: 4
I20220920 10:08:15.778117 18322 gl_context.cc:335] GL version: 3.1 (OpenGL ES 3.1 Mesa 20.0.8)
I20220920 10:08:15.778229 18297 demo_run_graph_main_gpu.cc:68] Initialize the camera or load the video.
I20220920 10:08:15.790952 18297 demo_run_graph_main_gpu.cc:89] Start running the calculator graph.
I20220920 10:08:15.794411 18297 demo_run_graph_main_gpu.cc:94] Start grabbing and processing frames.
INFO: Created TensorFlow Lite delegate for GPU.
I20220920 10:08:20.419745 18297 demo_run_graph_main_gpu.cc:171] Prepare video writer.
I20220920 10:13:23.774732 18297 demo_run_graph_main_gpu.cc:105] Empty frame, end of video reached.
I20220920 10:13:23.774749 18297 demo_run_graph_main_gpu.cc:186] Shutting down.
I20220920 10:13:24.021384 18297 demo_run_graph_main_gpu.cc:201] Success!
Aborted
While the run ongoing GPU usage shows 0%,
GPU usage command:
nvidia-smi --query-gpu=utilization.gpu --format=csv --loop=1
Output:
utilization.gpu [%]
0 %
0 %
0 %
0 %
0 %
0 %
.
.
Hi @Choyon10 , kindly use below inputs use_advanced_gpu_api: true in any of the graphs, try setting it to false. see https://github.com/google/mediapipe/pull/2463
Could you please make it a little specific, which graph should change? Currently, I tried to get GPU support for face mesh.
Hi @Choyon10 , it's good that the GPU path works for facemesh when refine_landmarks is false, that means the mediapipe GPU configuration/setup is fine.
the refine_landmarks = true option actually runs a different ML model (here)
We have closed issue running on thread https://github.com/google/mediapipe/issues/2678 , could you please check and verify
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.
Closing as stale. Please reopen if you'd like to work on this further.
the issue is still persist. it doesn't work with facemesh attention model on GPU.