Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
aaronxiongcday opened this issue Apr 25, 2024 · 8 comments
Assignees
Labels
platform:android Issues with Android as Platform platform:javascript MediaPipe Javascript issues task:face detection Issues related to Face Detection: Identify faces in images and video type:support General questions

Comments

@aaronxiongcday
Copy link

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

asks-vision@0.10.0

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/tasks-vision@0.10.0/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 (tasks-vision@0.10.0:7)
    at u.setGraph (tasks-vision@0.10.0:7)
    at u.refreshGraph (tasks-vision@0.10.0:7)
    at tasks-vision@0.10.0:7
    at async createTaskRunner (tasks-vision@0.10.0:7)
    at async initializefaceDetector (libs.js:31)

Other info / Complete Logs

No response

@kuaashish kuaashish assigned kuaashish and unassigned ayushgdev Apr 30, 2024
@kuaashish kuaashish added the platform:javascript MediaPipe Javascript issues label Apr 30, 2024
@kuaashish
Copy link
Collaborator

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 kuaashish added task:face detection Issues related to Face Detection: Identify faces in images and video platform:android Issues with Android as Platform type:support General questions stat:awaiting response Waiting for user response labels Apr 30, 2024
@aaronxiongcday
Copy link
Author

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?

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Apr 30, 2024
@kuaashish
Copy link
Collaborator

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 kuaashish added the stat:awaiting response Waiting for user response label May 3, 2024
@aaronxiongcday
Copy link
Author

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

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label May 3, 2024
@kuaashish
Copy link
Collaborator

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 kuaashish added the stat:awaiting response Waiting for user response label May 7, 2024
Copy link

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 github-actions bot added the stale label May 15, 2024
Copy link

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

Copy link

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

@kuaashish kuaashish removed stat:awaiting response Waiting for user response stale labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:android Issues with Android as Platform platform:javascript MediaPipe Javascript issues task:face detection Issues related to Face Detection: Identify faces in images and video type:support General questions
Projects
None yet
Development

No branches or pull requests

3 participants