mediapipe
mediapipe copied to clipboard
Error `selfieSegmentation.close()` to stop the video process - `Cannot pass deleted object as a pointer of type SolutionWasm`
Please make sure that this is a bug and also refer to the troubleshooting, FAQ documentation before raising any issues.
System information (Please provide as much relevant information as possible)
- Have I written custom code (as opposed to using a stock example script provided in MediaPipe): NO
- Browser and version (e.g. Google Chrome, Safari) if the issue happens on browser: Chrome 101.0.4951.64 MacOS
- Programming Language and version ( e.g. C++, Python, Java): JAVASCRIPT
- MediaPipe version: "@mediapipe/camera_utils": "^0.3.1640029074", "@mediapipe/selfie_segmentation": "^0.1.1632777926"
- Solution ( e.g. FaceMesh, Pose, Holistic ): @mediapipe/camera_utils @mediapipe/selfie_segmentation
Describe the current behavior:
When executing selfieSegmentation.close() to stop the video process (Close OpenGL) it is throwing an error, I tried the MediaPipe - Selfie Segmentation official examples and if you include a button in HTML and execute the selfieSegmentation.close() in javascript it will thrown an error.
I tried many ways to stop the selfieSegmentation and Camera Utils to avoid a leak of memory when I'm not using anymore the virtual background video.
Ways:
- Execute
selfieSegmentation.close()(No success) - Set
selfieSegmentationequal null (No success) - Set
selfieSegmentation.onResult(() => {})(No success) - Execute
selfieSegmentation.reset()(No success)
Follow the image:

Describe the expected behavior:
When executing selfieSegmentation.close() I want to stop the OpenGl process and requestAnimatedFrame to stop using the virtual background video feature to avoid a leak of memory.
Standalone code to reproduce the issue: Provide a reproducible test case that is the bare minimum necessary to replicate the problem. If possible, please share a link to Colab/repo link /any notebook:
You can try it here MediaPipe - Selfie Segmentation official examples and you need to include a button in HTML and execute the selfieSegmentation.close() in javascript, it will throw an error.
Other info / Complete Logs : Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached
"BindingError: Cannot pass deleted object as a pointer of type SolutionWasm*
at BindingError.<anonymous> (https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/selfie_segmentation_solution_simd_wasm_bin.js:9:136510)
at new BindingError (eval at createNamedFunction (https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/selfie_segmentation_solution_simd_wasm_bin.js:9:135404), <anonymous>:4:34)
at throwBindingError (https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/selfie_segmentation_solution_simd_wasm_bin.js:9:138087)
at RegisteredPointer.nonConstNoSmartPtrRawPointerToWireType [as toWireType] (https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/selfie_segmentation_solution_simd_wasm_bin.js:9:152816)
at SolutionWasm$send [as send] (eval at new_ (https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/selfie_segmentation_solution_simd_wasm_bin.js:9:161520), <anonymous>:7:28)
at qa.h (https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/selfie_segmentation.js:64:336)
at ta (https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/selfie_segmentation.js:14:299)
at ua.next (https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/selfie_segmentation.js:15:91)
at h (https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/selfie_segmentation.js:40:446)"

Hi @DeividVeloso , It may be due to memeory issues , we have similar issue runnung in thread https://github.com/google/mediapipe/issues/2819.
@sureshdagooglecom I think that is related, but @mhays-google did not solve it yet, so I don't know why the issue was closed on that thread.
This is an important bug that happens for everyone, I believe that many people are using it to create a background on video streams as google meets does and a video conference consumes a lot of resources already, so I would like to get this fixed. If the team doesn't have time to fix it, maybe you guys could open-source the code, please? Or point out where the files are? Maybe I or someone else can help with this.
cc: @ostap0207 @Dok11
Maybe this is related as well https://github.com/google/mediapipe/issues/3233
Maybe this is related too https://github.com/google/mediapipe/issues/3271
@sureshdagooglecom any update, please?
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.
Any update, the issue is still there yet?
Hello @mhays-google, did you have a chance to take a look?
Thank you.
Hello team, any update on it, please?
Any update on this? It's till reproducible in the newest version
how to solve this problem?
Running into the same issue :(
it's still happening to me also.
(I'm using the current newest version.)
Still happening, I'm not able to close the selfieSegmentation process.
Hello @DeividVeloso, We are upgrading the MediaPipe Legacy Solutions to new MediaPipe solutions However, the libraries, documentation, and source code for all the MediaPipe Legacy Solutions will continue to be available in our GitHub repository and through library distribution services, such as Maven and NPM.
You can continue to use those legacy solutions in your applications if you choose. Though, we would request you to check new MediaPipe solutions which can help you more easily build and customize ML solutions for your applications. These new solutions will provide a superset of capabilities available in the legacy solutions.
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.
This issue was closed due to lack of activity after being marked stale for past 7 days.
Is this issue solved? In my case I am using the hand landmarker model from tasks-vision and when doing handLandmarker.close() (in a react application) I get I0229 18:53:36.093000 1927856 gl_context_webgl.cc:132] Successfully destroyed WebGL context with handle 1 vision_wasm_internal.js:9 and my browser tab freezes. If anyone knows the solution would be of great help. Thanks.