google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://mediapipe.dev
Apache License 2.0
26.79k stars 5.09k forks source link

INTERNAL: Service "kGpuService", required by node mediapipe_tasks_vision_pose_landmarker_poselandmarkergraph__mediapipe_tasks_vision_pose_detector_posedetectorgraph... #5609

Open V-m1r opened 1 week ago

V-m1r commented 1 week ago

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

No

OS Platform and Distribution

iOS 16.4 and iOS 16.6

MediaPipe Tasks SDK version

0.10.15

Task name (e.g. Image classification, Gesture recognition etc.)

Pose Landmarker

Programming Language and version (e.g. C++, Python, Java)

JavaScript

Describe the actual behavior

tasks-vision -> detectForVideo function doesn't work for iOS 16.4 and 16.6 even with CPU delegate

Describe the expected behaviour

Should work because Pose (Legacy solution) works on iOS 16.4 and 16.6

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

// Mediapipe warmup

this.poseLandmarker = await PoseLandmarker.createFromOptions(vision, {
          baseOptions: {
            modelAssetPath: modelURL, // tried with full and lite models 
            delegate: "CPU"

          },
          minPoseDetectionConfidence: 0.6,
          minPosePresenceConfidence: 0.6,
          minTrackingConfidence: 0.6,
          runningMode: "VIDEO",
          numPoses: 1,
        });
        const canvas = document.createElement('canvas');
        canvas.width = 1;
        canvas.height = 1;

        const ctx = canvas.getContext('2d');
        if (ctx) {
          // Clear the canvas before drawing
          ctx.clearRect(0, 0, canvas.width, canvas.height);

          // Draw a single pixel
          ctx.fillRect(0, 0, 1, 1);

          this.poseLandmarker.detectForVideo(canvas, performance.now(),  (result) => {
            console.log("[event] PoseLandmarker initialized successfully");
            this.isInitialized = true;
            // Clear the canvas after we're done
            ctx.clearRect(0, 0, canvas.width, canvas.height);

            return this.poseLandmarker;
          });
        }

### Other info / Complete Logs

```shell
error
06:00:27.000
Error: INTERNAL: Service "kGpuService", required by node mediapipe_tasks_vision_pose_landmarker_poselandmarkergraph__mediapipe_tasks_vision_pose_detector_posedetectorgraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_vision_...

....
TypeError: undefined is not an object (evaluating 'GLctx.activeTexture')
V-m1r commented 1 week ago

Hello Everyone. Wanted to update: the issue is isolated only to iOS 16.4 and iOS 16.6 versions. I tried iOS 16.1 and iOS 15, both work. Legacy Pose Model works on all iOS versions I tested though, we recently migrated to a newer model and are experiencing these issues. I read apple has made some bugs with webql in those updates where webQL 2.0 doesn't work, but what's interesting is that legacy model works.

Sharing more logs:

E0904 03:25:34.992000 1895072 gl_graph_runner_internal.cc:260] StartGraph failed: INTERNAL: Service "kGpuService", required by node mediapipe_tasks_vision_pose_landmarker_poselandmarkergraph__mediapipe_tasks_vision_pose_detector_posedetectorgraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_vision_pose_landmarker_poselandmarkergraph__mediapipe_tasks_vision_pose_detector_posedetectorgraph__mediapipe_tasks_core_inferencesubgraph__InferenceCalculator, was not provided and cannot be created: emscripten_webgl_create_context() returned error 0; StartRun failed
=== Source Location Trace: ===
third_party/mediapipe/framework/calculator_graph.cc:694
third_party/mediapipe/framework/calculator_graph.cc:725
third_party/mediapipe/framework/calculator_graph.cc:594
research/drishti/app/pursuit/wasm/graph_utils.cc:107
I0904 03:25:34.983000 1895072 gl_context_webgl.cc:91] Couldn't create webGL 2 context.
W0904 03:25:34.989000 1895072 gl_context_webgl.cc:116] Creating a context with WebGL 2 failed: UNKNOWN: emscripten_webgl_create_context() returned error 0
=== Source Location Trace: ===
third_party/mediapipe/gpu/gl_context_webgl.cc:92

W0904 03:25:34.990000 1895072 gl_context_webgl.cc:117] Fall back on WebGL 1.
I0904 03:25:34.990000 1895072 gl_context_webgl.cc:91] Couldn't create webGL 1 context.

Any help would be really appreciated!