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 tasks-vision iOS 17+ inside Web Workers not working, despite iOS 17+ already support it. #5292

Open
SystemPanic opened this issue Apr 3, 2024 · 4 comments
Assignees
Labels
platform:ios MediaPipe IOS issues platform:javascript MediaPipe Javascript issues task:face landmarker Issues related to Face Landmarker: Identify facial features for visual effects and avatars. type:support General questions

Comments

@SystemPanic
Copy link

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

None

OS Platform and Distribution

iOS 17.4.1 / iPadOS 17.4.1

MediaPipe Tasks SDK version

0.10.12 (latest on npm)

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

All

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

Javascript

Describe the actual behavior

OffscreenCanvas is not used inside Web Workers when iOS 17+ supports it. It tries to create a normal canvas via document.createElement("canvas"), which obviously does not works inside a Worker.

Describe the expected behaviour

tasks-vision creates the OffscreenCanvas instead of DOM canvas inside Web Workers

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

Load tasks-vision (for example, for Face Landmarks mesh) inside a Web Worker on iOS 17+. It will throw:

 Can't find variable: document

I can make tasks-vision to work perfectly if I change

 typeof OffscreenCanvas !== 'undefined' && !isWebKit()

to 

 typeof OffscreenCanvas !== 'undefined'

on graph_runner.ts:111 and vision_task_runner.ts:47

Also, but with this I'm not completely sure, iOS 17+ has full gl.FLOAT support, so checking if isIOS on mask.ts:306 is not necessary anymore. I've made a few test with Mesh / Hand models forcing isIOS to return false and it works correctly, but as I'd said, maybe it requires further testing.

Other info / Complete Logs

No response

@kuaashish kuaashish assigned kuaashish and unassigned ayushgdev Apr 4, 2024
@kuaashish kuaashish added platform:javascript MediaPipe Javascript issues platform:ios MediaPipe IOS issues task:face landmarker Issues related to Face Landmarker: Identify facial features for visual effects and avatars. type:support General questions labels Apr 4, 2024
@kuaashish
Copy link
Contributor

Hi @SystemPanic,

Could you kindly provide the detailed steps you are following from our documentation, or alternatively, share the standalone code with us? This will help us to reproduce the issue and gain a better understanding of it.

Thank you!!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Apr 4, 2024
@schmidt-sebastian
Copy link
Collaborator

We will fix this and verify on iOS 17.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label Apr 4, 2024
@kuaashish kuaashish added the stat:awaiting googler Waiting for Google Engineer's Response label Apr 10, 2024
copybara-service bot pushed a commit that referenced this issue Apr 15, 2024
@kuaashish
Copy link
Contributor

HI @SystemPanic,

We've launched the latest version 0.10.13, which includes support for OffscreenCanvas in iOS 17+, as detailed in the release notes ("Update WebGL2 on OffscreenCanvas support check to include Safari 17+"). Could you please verify now? If the issue persists on your end, please inform us.

Thank you!!

@kuaashish kuaashish removed the stat:awaiting googler Waiting for Google Engineer's Response label May 6, 2024
@kuaashish kuaashish added the stat:awaiting response Waiting for user response label May 6, 2024
@arcinston
Copy link

@SystemPanic could you help guide how you were able to import tasks-vision on a web worker

i am not able to find any resource on how to go about doing it and tried a lot but no success

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting for user response label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:ios MediaPipe IOS issues platform:javascript MediaPipe Javascript issues task:face landmarker Issues related to Face Landmarker: Identify facial features for visual effects and avatars. type:support General questions
Projects
None yet
Development

No branches or pull requests

5 participants