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.78k stars 5.18k forks source link

GPU mode (all tasks) fails to initialize on Nvidia Jetson (arm64) #5690

Open JC3 opened 1 month ago

JC3 commented 1 month ago

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

Yes

OS Platform and Distribution

Ubuntu 22.04, arm64, Jetpack 6.0, CUDA 12.2

Programming Language and version

Python 3.10

MediaPipe version

0.10.9

Solution

Hand Landmarker, Face Landmarker, Pose Landmarker

Describe the actual behavior

When using the GPU delegate, the landmarkers fail to initialize.

Describe the expected behaviour

When using the GPU delegate, the landmarkers initialize.

Standalone code/steps you may have used to try to get what you need

from mediapipe.tasks import python
from mediapipe.tasks.python import vision

def callback (results, image, timestamp):
    pass

options = vision.HandLandmarkerOptions(
    base_options=python.BaseOptions(
        model_asset_path="hand_landmarker.task",
        delegate=python.BaseOptions.Delegate.GPU
    ),
    running_mode=vision.RunningMode.LIVE_STREAM,
    result_callback=callback
)

detector = vision.HandLandmarker.create_from_options(options)

Other info / Complete Logs

Traceback (most recent call last):
  File "/home/admin/dev/mediapipetest.py", line 16, in <module>
    detector = vision.HandLandmarker.create_from_options(options)
  File "/home/admin/dev/facetracking-poc/env/lib/python3.10/site-packages/mediapipe/tasks/python/vision/hand_landmarker.py", line 364, in create_from_options
    return cls(
  File "/home/admin/dev/facetracking-poc/env/lib/python3.10/site-packages/mediapipe/tasks/python/vision/core/base_vision_task_api.py", line 70, in __init__
    self._runner = _TaskRunner.create(graph_config, packet_callback)
NotImplementedError: ValidatedGraphConfig Initialization failed.
ImageCloneCalculator: GPU processing is disabled in build flags
ImageCloneCalculator: GPU processing is disabled in build flags
kuaashish commented 1 month ago

Hi @JC3,

Thank you for your interest in building MediaPipe on Jetson. Currently, this device is not officially supported, and the only supported edge device, as outlined in our documentation, is the Raspberry Pi 64. Unfortunately, we are unable to provide support for Jetson at this time. (GPU support is only available via the Pip package on macOS and standard Ubuntu.)

However, you may find the community plugin (https://github.com/anion0278/mediapipe-jetson), which supports Jetson and GPU, helpful. Please note that this implementation is based on legacy solutions. Beyond this, we can mark your request as a feature request and share it with the team.

JC3 commented 1 month ago

Thanks. Yes please make it a feature request. It would be great, especially for hand landmarking. Dlib's CNN tracker is a good alternative for face detection, and there's a good Posenet + PyTorch implementation for pose landmarking, but for hands there aren't really any other good options besides Mediapipe.

kuaashish commented 1 month ago

Hi @JC3,

Thank you for your response. We have noted this as a feature request and will share it with our team. We hope to add support for it.