Closed shivambhardwaj120 closed 1 year ago
By default, FaceLandmarker should run in a browser context. It needs access to a Canvas
for WebGL rendering. It looks like a) it cannot create an OffscreenCanvas
and b) the fallback to create a canvas via document.createElement
is not working. You should be able to work around this by setting the canvas
property yourself: https://github.com/google/mediapipe/blob/master/mediapipe/tasks/web/vision/core/vision_task_options.d.ts#L34
Thank you for the answer. I have also tried giving a canvas, but maybe it was too big for the view. I have to try with a smaller one. Now that I'm writing I forgot to mention that I'm working on a nodejs project and that the script I wrote in the question is called in my html page as a module js script.
We currently don't support running under Node. You can develop in Node, but the task must be executed in a browser. How the JS is bundled should not impact how MediaPipe runs, as long as the browser can load the JavaScript code.
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.
Hi @schmidt-sebastian thanks for the reply, I tried to set the canvas property and provided the offScreenCanvas. But still getting the same error.
const offscreen = Skia.Surface.MakeOffscreen(100,100);
const faceLandmarker=await md.FaceLandmarker.createFromOptions(vision, {
baseOptions: {
modelAssetPath: https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task
,
delegate: "GPU"
},
outputFaceBlendshapes: true,
numFaces: 1,
canvas: offscreen
});
if I couldn't set it properly please tell me how to do it, because I couldn't find canvas property in any example.
This should be fixed with https://github.com/google/mediapipe/commit/990bfd2e3eaf0f0c977a7af7330ac4ad54f768cb. Please wait for a new release. You will still need to provide an OffscreenCanvas.
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
No
OS Platform and Distribution
Mac Mini,Ventura 13, Xcode 14.1
MediaPipe Tasks SDK version
@mediapipe/tasks-vision@10.0.1, @latest
Task name (e.g. Image classification, Gesture recognition etc.)
FaceLandmarker
Programming Language and version (e.g. C++, Python, Java)
Typescript
Describe the actual behavior
Describe the expected behaviour
Standalone code/steps you may have used to try to get what you need
Other info / Complete Logs