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

black canvas on safari for MediaPipe Selfie Segmentation in javascript #2675

Closed
nicolasoros opened this issue Oct 15, 2021 · 12 comments
Closed
Assignees
Labels
legacy:selfie segmentation Issues related to selfie segmentation platform:javascript MediaPipe Javascript issues platform:web web related type:support General questions

Comments

@nicolasoros
Copy link

Hello,

I'm having issues rendering the output for the MediaPipe Selfie Segmentation on Safari only.

The canvas element that should display the video with the overlay is all black.

I see the same problem with the official demo examples from https://codepen.io/mediapipe/pen/wvJyQpq, and with my own code.

It seems that both results.image and results.segmentationMask used in the function onResults(results: mpSelfieSegmentation.Results) are ImageBitmap.

But it seems that ImageBitmap is not supported on Safari: https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap
Could that be the issue?

Safari version: 15.0

Thanks

@nicolasoros nicolasoros added the type:support General questions label Oct 15, 2021
@tyrmullen
Copy link
Collaborator

That's quite possible, but in any case I suspect this is a Safari 15-only issue, since Safari 15 now has support for WebGL2, so if you try with a different version of Safari I imagine you should be fine. Of course, we'd like to support Safari 15 as well, so having an issue tracking that seems like a good idea if that is indeed the problem here.

@nicolasoros
Copy link
Author

nicolasoros commented Oct 15, 2021

thanks.

The demo doesn't crash for me. And I can see that the model is being updated since the function onResults() keeps being called for each frame.

Platform:

  • MacOS BigSur 11.6
  • Macbook Air M1 2020
  • Safari Version 15.0 (16612.1.29.41.4, 16612)

Log:
[Warning] I1015 15:29:20.482000 1 gl_context_webgl.cc:151] Successfully created a WebGL context with major version 3 and handle 3 (selfie_segmentation_solution_wasm_bin.js, line 9)
[Warning] I1015 15:29:20.484000 1 gl_context.cc:349] GL version: 3.0 (OpenGL ES 3.0 (WebGL 2.0)) (selfie_segmentation_solution_wasm_bin.js, line 9)
[Warning] W1015 15:29:20.484000 1 gl_context.cc:819] OpenGL error checking is disabled (selfie_segmentation_solution_wasm_bin.js, line 9)

In the meantime, is there an API documentation for the onResults() function?
I'd like to see if I can get the raw data of the mask as a uint8 array, or even the output model prediction, instead of the results.segmentationMask ImageBitmap.

@tyrmullen
Copy link
Collaborator

I still suspect there's a good chance the issues are related. Note that the WebGL context has major version 3 (Meaning ES 3.0, which corresponds to WebGL2).

Unfortunately the only documentation aside from the basic overview on mediapipe.dev or the CodePen demos would be the TypeScript definitions themselves (*.d.ts), but those are definitely the most informative and can be browsed directly on jsdelivr (example for pose: https://cdn.jsdelivr.net/npm/@mediapipe/pose@0.4.1633558788/index.d.ts).

@sgowroji sgowroji added platform:javascript MediaPipe Javascript issues platform:web web related legacy:selfie segmentation Issues related to selfie segmentation stat:awaiting response Waiting for user response labels Oct 16, 2021
@sgowroji sgowroji assigned tyrmullen and unassigned sgowroji Oct 16, 2021
@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

@google-ml-butler
Copy link

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

@sgowroji sgowroji removed stat:awaiting response Waiting for user response stale labels Nov 1, 2021
@nicolasoros
Copy link
Author

Hi @tyrmullen and @sgowroji ,
has this problem been investigated or fixed?
Should we re-open this issue?

@sgowroji sgowroji reopened this Nov 2, 2021
@sgowroji sgowroji added the stat:awaiting googler Waiting for Google Engineer's Response label Nov 2, 2021
@tyrmullen
Copy link
Collaborator

The problem has not been investigated, and I don't have an ETA for doing so at this time. Hopefully things will get better from the WebKit side in the meantime?

@ayushgdev
Copy link
Collaborator

Hello @nicolasoros
We are revisiting older issues. This issue is not reproducible in Safari. The web demo as well as code in documentation works fine at 60 fps in

  • Macbook Pro M1,
  • McOS 13.2.1
  • Safari Version 16.3 (18614.4.6.1.6)

For the Javascript API of onResults(), we have released the Typescript type definition #1408 (comment) which should give an idea on the possible options and APIs. For full source code release, please check the comment #1408 (comment).

@ayushgdev ayushgdev assigned ayushgdev and unassigned tyrmullen Mar 17, 2023
@ayushgdev ayushgdev added stat:awaiting response Waiting for user response and removed stat:awaiting googler Waiting for Google Engineer's Response labels Mar 17, 2023
@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

@google-ml-butler
Copy link

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

@ayushgdev ayushgdev removed stat:awaiting response Waiting for user response stalled labels Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy:selfie segmentation Issues related to selfie segmentation platform:javascript MediaPipe Javascript issues platform:web web related type:support General questions
Projects
None yet
Development

No branches or pull requests

4 participants