mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Error `selfieSegmentation.close()` to stop the video process - `Cannot pass deleted object as a pointer of type SolutionWasm`

Open DeividVeloso opened this issue 3 years ago • 9 comments

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 selfieSegmentation equal null (No success)
  • Set selfieSegmentation.onResult(() => {}) (No success)
  • Execute selfieSegmentation.reset() (No success)

Follow the image:

image-20220519-185221

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)"

image

DeividVeloso avatar May 24 '22 14:05 DeividVeloso

Hi @DeividVeloso , It may be due to memeory issues , we have similar issue runnung in thread https://github.com/google/mediapipe/issues/2819.

sureshdagooglecom avatar May 26 '22 04:05 sureshdagooglecom

@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

DeividVeloso avatar May 26 '22 13:05 DeividVeloso

Maybe this is related as well https://github.com/google/mediapipe/issues/3233

DeividVeloso avatar May 26 '22 13:05 DeividVeloso

Maybe this is related too https://github.com/google/mediapipe/issues/3271

DeividVeloso avatar May 26 '22 13:05 DeividVeloso

@sureshdagooglecom any update, please?

DeividVeloso avatar May 31 '22 16:05 DeividVeloso

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[bot] avatar Jun 07 '22 16:06 google-ml-butler[bot]

Any update, the issue is still there yet?

DeividVeloso avatar Jun 07 '22 17:06 DeividVeloso

Hello @mhays-google, did you have a chance to take a look?

Thank you.

DeividVeloso avatar Jun 20 '22 14:06 DeividVeloso

Hello team, any update on it, please?

DeividVeloso avatar Aug 02 '22 16:08 DeividVeloso

Any update on this? It's till reproducible in the newest version

MatejFacko avatar Dec 14 '22 11:12 MatejFacko

how to solve this problem?

NTsyklinskiy avatar Jan 20 '23 21:01 NTsyklinskiy

Running into the same issue :(

Emma-He avatar Feb 23 '23 21:02 Emma-He

it's still happening to me also.

(I'm using the current newest version.)

Mazuh avatar Feb 27 '23 19:02 Mazuh

Still happening, I'm not able to close the selfieSegmentation process.

avicarpio avatar Apr 28 '23 09:04 avicarpio

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.

kuaashish avatar May 02 '23 09:05 kuaashish

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[bot] avatar May 10 '23 01:05 github-actions[bot]

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

github-actions[bot] avatar May 17 '23 01:05 github-actions[bot]

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

google-ml-butler[bot] avatar May 17 '23 01:05 google-ml-butler[bot]

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.

pruthvik-sheth avatar Mar 01 '24 05:03 pruthvik-sheth