google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.69k stars 5.18k forks source link

Face mesh build error #5714

Open Hemanth-TS opened 2 weeks ago

Hemanth-TS commented 2 weeks ago

OS Platform and Distribution

Ubuntu 20.04

Compiler version

No response

Programming Language and version

python 3.9

Installed using virtualenv? pip? Conda?(if python)

conda

MediaPipe version

0.10.14

Bazel version

7.4

XCode and Tulsi versions (if iOS)

No response

Android SDK and NDK versions (if android)

No response

Android AAR (if android)

None

OpenCV version (if running on desktop)

4.8.0

Describe the problem

Build error

Complete Logs

I was trying to build face_mesh using cuda for gpu support ,

"CUDA_TOOLKIT_PATH="/usr/local/cuda" HERMETIC_CUDNN_VERSION="8.6" bazel build -c opt --config=cuda //mediapipe/examples/desktop/face_mesh:face_mesh_gpu"

I ran into the following error 
Starting local Bazel server and connecting to it...
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/py/python_repo.bzl:96:14: 
HERMETIC_PYTHON_VERSION variable was not set correctly, using default version.
Python 3.9 will be used.
To select Python version, either set HERMETIC_PYTHON_VERSION env variable in
your shell:
  export HERMETIC_PYTHON_VERSION=3.12
OR pass it as an argument to bazel command directly or inside your .bazelrc
file:
  --repo_env=HERMETIC_PYTHON_VERSION=3.12
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/py/python_repo.bzl:107:10: Using hermetic Python 3.9
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_absl' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'pybind11_bazel' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'XNNPACK' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_protobuf' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_google_googletest' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'zlib' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'rules_android_ndk' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'pybind11' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'pybind11_protobuf' because it already exists.
DEBUG: /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/repo.bzl:132:14: 
Warning: skipping import of repository 'com_github_glog_glog' because it already exists.
INFO: Repository cuda_cudnn instantiated at:
  /home/ipcam/Downloads/face_recog/Drowsiness-Detection-Mediapipe/mediapipe/WORKSPACE:644:29: in <toplevel>
  /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/gpus/cuda/hermetic/cuda_redist_init_repositories.bzl:514:15: in cudnn_redist_init_repository
Repository rule cudnn_repo defined at:
  /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/gpus/cuda/hermetic/cuda_redist_init_repositories.bzl:434:29: in <toplevel>
ERROR: An error occurred during the fetch of repository 'cuda_cudnn':
   Traceback (most recent call last):
    File "/home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/gpus/cuda/hermetic/cuda_redist_init_repositories.bzl", line 432, column 45, in _cudnn_repo_impl
        _use_downloaded_cudnn_redistribution(repository_ctx)
    File "/home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/gpus/cuda/hermetic/cuda_redist_init_repositories.bzl", line 394, column 35, in _use_downloaded_cudnn_redistribution
        version = cuda_version.split(".")[0],
Error: 'NoneType' value has no field or method 'split'
ERROR: /home/ipcam/Downloads/face_recog/Drowsiness-Detection-Mediapipe/mediapipe/WORKSPACE:644:29: fetching cudnn_repo rule //external:cuda_cudnn: Traceback (most recent call last):
    File "/home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/gpus/cuda/hermetic/cuda_redist_init_repositories.bzl", line 432, column 45, in _cudnn_repo_impl
        _use_downloaded_cudnn_redistribution(repository_ctx)
    File "/home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/third_party/gpus/cuda/hermetic/cuda_redist_init_repositories.bzl", line 394, column 35, in _use_downloaded_cudnn_redistribution
        version = cuda_version.split(".")[0],
Error: 'NoneType' value has no field or method 'split'
ERROR: /home/ipcam/Downloads/face_recog/Drowsiness-Detection-Mediapipe/mediapipe/mediapipe/examples/desktop/face_mesh/BUILD:38:10: error loading package 'mediapipe/modules/face_landmark': at /home/ipcam/Downloads/face_recog/Drowsiness-Detection-Mediapipe/mediapipe/mediapipe/framework/tool/mediapipe_graph.bzl:26:6: at /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/tensorflow/lite/core/shims/cc_library_with_tflite.bzl:6:6: at /home/ipcam/.cache/bazel/_bazel_ipcam/be4e6a33c6a81d7c2f02001ee40b651b/external/org_tensorflow/tensorflow/tensorflow.bzl:13:5: Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': no such package '@cuda_cudnn//': 'NoneType' value has no field or method 'split' and referenced by '//mediapipe/examples/desktop/face_mesh:face_mesh_gpu'
ERROR: Analysis of target '//mediapipe/examples/desktop/face_mesh:face_mesh_gpu' failed; build aborted: Analysis failed
INFO: Elapsed time: 4.837s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (50 packages loaded, 249 targets configured)
    currently loading: mediapipe/modules/face_landmark ... (2 packages)
    Fetching repository @local_config_cc; starting
    Fetching repository @local_config_cuda; Restarting.
"
kuaashish commented 2 weeks ago

Hi @Hemanth-TS,

Could you first confirm if you are able to run the "Hello World" example provided here? Also, it appears that Bazel version 7.4 is currently being used, while version 6.5.0 is the supported version. Please update Bazel to the supported version, then let us know the status.

Thank you!!

Hemanth-TS commented 2 weeks ago

I’ve modified the configuration and am now using:

Python 3.8 Bazel 6.1.1 MediaPipe 0.10.13 I successfully ran the Hello World example, and now I'm working with a Python script that utilizes the Face Mesh model. I want to ensure it's utilizing my T4 GPU properly. Could you guide me on how to set this up?

kuaashish commented 2 weeks ago

Hi @schmidt-sebastian,

Do you have any suggestions on the above query?

Thank you!!

Hemanth-TS commented 2 weeks ago

Ultimately what i need to do now is -Enable CUDA support for face-mesh. -Run multiple Python scripts utilizing CUDA-enabled face-mesh.

Previously, I referred to https://ai.google.dev/edge/mediapipe/framework/getting_started/gpu_support, the sections on TensorFlow and CUDA support.

Hemanth-TS commented 1 week ago

@kuaashish @schmidt-sebastian could either of you follow up on this?