mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

MediaPipe FaceDetector Module POC Error - Error: StartGraph failed: $Service "kGpuService", required by node

Open aaronxiongcday opened this issue 1 year ago • 5 comments

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

Yes

OS Platform and Distribution

Android OS 9

MediaPipe Tasks SDK version

[email protected]

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

FaceDetector module initialization

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

HTML, JavaScript

Describe the actual behavior

The web app fails at initializing the FaceDetector module

Describe the expected behaviour

The web app successfully initializes the FaceDetector module

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

Implementation:
const initializefaceDetector = async () => {
  try {
    const vision = await FilesetResolver.forVisionTasks(
      "https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm"
    );
    faceDetector = await FaceDetector.createFromOptions(vision, {//line 31
      baseOptions: {
        //modelAssetPath: `https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite`,
        modelAssetPath: "./blaze_face_short_range.tflite",
        delegate: "GPU"
      },
      runningMode: runningMode
    });
    demosSection.classList.remove("invisible");
  } catch (error) {
    console.error("Error initializing face detector:", error);
  }
};
initializefaceDetector();

The modified MediaPipe FaceDetector demo web-app is hosted by the GitHub pages feature, and the web-app is launched on the Android 9 WebView browser (version 96.0.4664.141).

Getting the runtime console error:
Error initializing face detector: Error: StartGraph failed: $Service "kGpuService", required by node mediapipe_tasks_vision_face_detector_facedetectorgraph__mediapipe_tasks_components_processors_imagepreprocessinggraph__ImageCloneCalculator, was not provided and cannot be created: emscripten_webgl_create_context() returned error 0; StartRun failed
    at u.handleErrors ([email protected]:7)
    at u.setGraph ([email protected]:7)
    at u.refreshGraph ([email protected]:7)
    at [email protected]:7
    at async createTaskRunner ([email protected]:7)
    at async initializefaceDetector (libs.js:31)

Other info / Complete Logs

No response

aaronxiongcday avatar Apr 25 '24 16:04 aaronxiongcday

Hi @aaronxiongcday,

This error often occurs when attempting to use the GPU on a device that lacks GPU support. Could you please verify if your device is GPU-compatible and keep us informed about the issue?

Thank you!!

kuaashish avatar Apr 30 '24 07:04 kuaashish

Hi @kuaashish, I have tried the following, switched to use CPU, but still getting the same error:

faceDetector = await FaceDetector.createFromOptions(vision, { baseOptions: { modelAssetPath: https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite, delegate: "CPU" }, runningMode: runningMode });

Other than the CPU and GPU options, is there third option?

aaronxiongcday avatar Apr 30 '24 13:04 aaronxiongcday

Hi @aaronxiongcday,

To help us diagnose the error you are encountering, could you confirm if you are testing this scenario on an emulator or a physical device? We have identified that the issue is likely to occur on emulators due to limitations in emulated environments. If you are using an emulator, running the test on a physical device would be helpful. Please let us know the outcome after running the test on a physical device.

Thank you!!

kuaashish avatar May 03 '24 06:05 kuaashish

Hi @kuaashish, The scenario is testing on a physical device, which the Android OS is 9, and the application is launched via Webview browser.

aaronxiongcday avatar May 03 '24 12:05 aaronxiongcday

Hi @aaronxiongcday,

Could you please test it with the latest version 0.10.13 once? We always recommend using the latest version as it includes new features and fixes for bugs.

Thank you!!

kuaashish avatar May 07 '24 08:05 kuaashish

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

github-actions[bot] avatar May 15 '24 01:05 github-actions[bot]

This issue was closed due to lack of activity after being marked stale for past 7 days.

github-actions[bot] avatar May 23 '24 01:05 github-actions[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar May 23 '24 01:05 google-ml-butler[bot]