google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
26.97k stars 5.1k forks source link

A way to disable logging on mediapipe/tasks-vision #4991

Open tomaszs opened 10 months ago

tomaszs commented 10 months ago

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

Yes

OS Platform and Distribution

any

MediaPipe Tasks SDK version

No response

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

mediapipe/tasks-vision

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

JS

Describe the actual behavior

logs to console

Describe the expected behaviour

should be able to disable logging to console

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

mediapipe/tasks-vision

Other info / Complete Logs

No response

kuaashish commented 10 months ago

Hi @tomaszs,

Could you please elaborate your query with more details. Thank you!

github-actions[bot] commented 10 months ago

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.

tomaszs commented 9 months ago

@kuaashish Sure,

I'm using this package in my JS project:

"@mediapipe/tasks-vision": "^0.10.8",

(https://www.npmjs.com/package/@mediapipe/tasks-vision)

It logs into the browser console stuff like:

I1211 09:52:24.071000 1866800 gl_context.cc:361] GL version: 3.0 (OpenGL ES 3.0 (WebGL 2.0 (OpenGL ES 3.0 Chromium))), renderer: WebKit WebGL vision_wasm_internal.js:9 Graph successfully started running. vision_wasm_internal.js:9 INFO: Created TensorFlow Lite XNNPACK delegate for CPU. put_char @ vision_wasm_internal.js:9 write @ vision_wasm_internal.js:9 write @ vision_wasm_internal.js:9 doWritev @ vision_wasm_internal.js:9 _fd_write @ vision_wasm_internal.js:9 $func14707 @ vision_wasm_internal.wasm:0x743bfa $func3502 @ vision_wasm_internal.wasm:0x1cf035 $func4076 @ vision_wasm_internal.wasm:0x25bc5f $func1283 @ vision_wasm_internal.wasm:0x7d120 $func6008 @ vision_wasm_internal.wasm:0x39778b $func8518 @ vision_wasm_internal.wasm:0x504731 $func4083 @ vision_wasm_internal.wasm:0x25c6c1 $func12379 @ vision_wasm_internal.wasm:0x657d57 $func11994 @ vision_wasm_internal.wasm:0x6095c0 $func9935 @ vision_wasm_internal.wasm:0x55b23b $func3185 @ vision_wasm_internal.wasm:0x1a32a0 $func3275 @ vision_wasm_internal.wasm:0x1b5fc4 $ze @ vision_wasm_internal.wasm:0x3f6ad5 Module._waitUntilIdle @ vision_wasm_internal.js:9 finishProcessing @ @mediapipe_tasks-vision.js?v=073d1a9b:3094 finishProcessing @ @mediapipe_tasks-vision.js?v=073d1a9b:2406 Oa @ @mediapipe_tasks-vision.js?v=073d1a9b:3152 Ia @ @mediapipe_tasks-vision.js?v=073d1a9b:3164 G @ @mediapipe_tasks-vision.js?v=073d1a9b:3204 processFrame @ EnrollKitFaceValidator.js:273 _renderOverlayFrame @ EnrollKitFaceDetector.js:317 initialize @ EnrollKitFaceDetector.js:548 await in initialize (async) initializeDetector @ Capture.jsx:144 (anonymous) @ Capture.jsx:163 commitHookEffectListMount @ react-dom_client.js?v=cd27c50f:16904 commitPassiveMountOnFiber @ react-dom_client.js?v=cd27c50f:18152 commitPassiveMountEffects_complete @ react-dom_client.js?v=cd27c50f:18125 commitPassiveMountEffects_begin @ react-dom_client.js?v=cd27c50f:18115 commitPassiveMountEffects @ react-dom_client.js?v=cd27c50f:18105 flushPassiveEffectsImpl @ react-dom_client.js?v=cd27c50f:19486 flushPassiveEffects @ react-dom_client.js?v=cd27c50f:19443 commitRootImpl @ react-dom_client.js?v=cd27c50f:19412 commitRoot @ react-dom_client.js?v=cd27c50f:19273 performSyncWorkOnRoot @ react-dom_client.js?v=cd27c50f:18891 flushSyncCallbacks @ react-dom_client.js?v=cd27c50f:9135 (anonymous) @ react-dom_client.js?v=cd27c50f:18623 Show 17 more frames Show less vision_wasm_internal.js:9 Graph finished closing successfully. vision_wasm_internal.js:9 I1211 09:52:30.510000 1866800 gl_context_webgl.cc:132] Successfully destroyed WebGL context with handle 1


I don't want it to console log diagnostic stuff. I'd like it to stop console logging this.

Browsing the code I see calls like:

var _emscripten_outn = (str,len)=>out(UTF8ToString(str, len));

in vision_wasm_internal.js

I see that file in the @mediapipe\task-vision\wasm\vision_wasm_internal.js

in the foremely mentioned package.

I don't see anywhere the source files for that build, and the change should be done in the source files.

The goal is to be able to toggle if messages should be displayed or not in the console.

schmidt-sebastian commented 9 months ago

Thank you. I marked this as a feature request.

mikoprus commented 3 weeks ago

I've replicated the issue and it happened when I used IMAGE runningMode parameter and fed video frames. Once I corrected the runningMode to VIDEO the logging stopped