Closed MJKingsbury closed 1 year ago
console-export-2023-4-1_15-46-8.txt
This is the output from the console, showing the filesetresolver working correctly, and the gesturerecognizer remaining undefined.
EDIT 1: After some modifications to the code linked above, the gestureRecognizer appears to now be correctly initializing, however no gestures are being returned in the results. I have pushed the now modified code to the repo here:
https://github.com/MJKingsbury/Theresynth_JS/blob/main/src/Video.js
Sometimes when I run the code, it doesn't throw errors, however occasionally I receive the following error:
Uncaught (in promise) Error: WaitUntilIdle failed: $CalculatorGraph::Run() failed in Run: Calculator::Process() for node "mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraph__mediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraph__ImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.; WaitUntilIdle failed handleErrors vision_bundle.js:1 finishProcessing vision_bundle.js:1 process vision_bundle.js:1 processVideoData vision_bundle.js:1 recognizeForVideo vision_bundle.js:1 predictions Video.js:39 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56 predictions Video.js:56
No landmarks are shown on screen during testing. results just returns an object with empty values. Any help would be appreciated.
EDIT 2: I have modified the code to form a more typical react workflow, handling side effect operations inside of a UseEffect. It appears that the gestureRecognizer is correctly being assigned prior to requesting the results, however I am now receiving a different error:
Uncaught (in promise) TypeError: WebGL2RenderingContext.texImage2D: Argument 6 is not valid for any of the 6-argument overloads. bindTextureToStream vision_bundle.js:1 node_modules bundle.js:47913 wrapStringPtr vision_bundle.js:1 addGpuBufferAsImageToStream vision_bundle.js:1 process vision_bundle.js:1 processVideoData vision_bundle.js:1 recognizeForVideo vision_bundle.js:1 predictions Video.js:49 Video Video.js:51 React 8 workLoop scheduler.development.js:266 flushWork scheduler.development.js:239 performWorkUntilDeadline scheduler.development.js:533 js scheduler.development.js:571 js scheduler.development.js:633 factory react refresh:6 Webpack 24
Modified code has been pushed to repo: https://github.com/MJKingsbury/Theresynth_JS/blob/main/src/Video.js Created from: https://github.com/MJKingsbury/Theresynth_JS/blob/main/src/App.js
gestureRecognizer:
Object { graphRunner: {…}, processingErrors: [], latestOutputTimestamp: 0, imageStreamName: "image_in", normRectStreamName: "normrect", roiAllowed: false, gestures: [], landmarks: [], worldLandmarks: [], handednesses: [], … } gestures: Array [] graphRunner: Object { autoResizeCanvas: true, audioSize: 0, hasMultiStreamSupport: true, … } handDetectorGraphOptions: Object { wrappers: {}, arrayIndexOffset: -1, pivot: 1.7976931348623157e+308, … } handGestureRecognizerGraphOptions: Object { wrappers: {}, arrayIndexOffset: -1, pivot: 1.7976931348623157e+308, … } handLandmarkerGraphOptions: Object { wrappers: {…}, arrayIndexOffset: -1, pivot: 1.7976931348623157e+308, … } handLandmarksDetectorGraphOptions: Object { wrappers: {}, arrayIndexOffset: -1, pivot_: 1.7976931348623157e+308, … } handednesses: Array [] imageStreamName: "image_in" landmarks: Array [] latestOutputTimestamp: 0 normRectStreamName: "normrect" options: Object { wrappers: {…}, arrayIndexOffset: -1, pivot: 1.7976931348623157e+308, … } processingErrors: Array [] roiAllowed: false worldLandmarks: Array []
Hello @MJKingsbury, Would you please let us know the version you are using, Is older version of gestureRecognizer being used here? if, We can get the information about version of model used that will be more helpful to understand the issue better. Thank you
Hi @kuaashish
I'm just utilising the code written here to retrieve the model: https://developers.google.com/mediapipe/solutions/vision/gesture_recognizer/web_js
// Create task for image file processing: const vision = await FilesetResolver.forVisionTasks( // path/to/wasm/root "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm " ); const gestureRecognizer = await GestureRecognizer.createFromOptions(vision, { baseOptions: { modelAssetPath: "https://storage.googleapis.com/mediapipe-tasks/gesture_recognizer/gesture_recognizer.task" }, numHands: 2 });
I'm adding the additional parameter runningMode: "VIDEO". I assumed the model was provided from the link in modelAssetPath, is that incorrect? Do I need a specific model loaded locally? If so, how would I go about doing this and where would I store it? Thanks!
Hi @schmidt-sebastian, Could you please look into this issue? Thank you
@kuaashish I'm looking to have this project completed ASAP, is there an older version of gestureRecognizer I can use for the time being that allows me to capture hand depth data, positioning and also read specific gestures?
We can take a look at this but it would be very helpful if you could provide a stand-alone reproduction case that we can easily access either as a Web app or as GitHub repo with build instructions.
@schmidt-sebastian Hi, the repo is linked here: https://github.com/MJKingsbury/Theresynth_JS
Does this provide all the necessary files? I'm not sure what else is needed re: build instructions. For repeated gestureRecognition, you may need to request animation frame inside of predictions(), I just removed it to stop the console log clogging up.
Errors from updated code:
Potential issues regarding ROI Width/Height
I0000 00:00:1681574555.212000 1 hand_gesture_recognizer_graph.cc:256] Custom gesture classifier is not defined. vision_wasm_internal.js:1103:8 I0000 00:00:1681574555.227000 1 gl_context_webgl.cc:151] Successfully created a WebGL context with major version 3 and handle 1 vision_wasm_internal.js:1103:8 I0000 00:00:1681574555.228000 1 gl_context.cc:359] GL version: 3.0 (OpenGL ES 3.0 (WebGL 2.0)) vision_wasm_internal.js:1103:8 W0000 00:00:1681574555.229000 1 gl_context.cc:1000] OpenGL error checking is disabled vision_wasm_internal.js:1103:8 Graph successfully started running. vision_wasm_internal.js:1087:8 INFO: Created TensorFlow Lite XNNPACK delegate for CPU. vision_wasm_internal.js:1103:8 E0000 00:00:1681574555.264000 1 image_to_tensor_utils.cc:56] INTERNAL: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0. vision_wasm_internal.js:1103:8 Stack trace: vision_wasm_internal.js:1103:8 E0000 00:00:1681574555.265000 1 calculator_graph.cc:851] INTERNAL: CalculatorGraph::Run() failed in Run: vision_wasm_internal.js:1103:8 Calculator::Process() for node "mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraph__mediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0. [type.googleapis.com/mediapipe.StatusList='\n\xd7\x03\x08\r\x12\xd2\x03\x43\x61lculator::Process() for node \"mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraphmediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator\" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.'] vision_wasm_internal.js:1103:8 === Source Location Trace: === vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56 vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_calculator.cc:223 vision_wasm_internal.js:1103:8 third_party/mediapipe/framework/calculator_node.cc:948 vision_wasm_internal.js:1103:8 E0000 00:00:1681574555.265000 1 calculator_graph.cc:851] INTERNAL: CalculatorGraph::Run() failed in Run: vision_wasm_internal.js:1103:8 Calculator::Process() for node "mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraphmediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0. [type.googleapis.com/mediapipe.StatusList='\n\xd7\x03\x08\r\x12\xd2\x03\x43\x61lculator::Process() for node \"mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraph__mediapipe_tasks_vision_hand_landmarker_handlandmarkergraphmediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator\" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.'] vision_wasm_internal.js:1103:8 === Source Location Trace: === vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56 vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_calculator.cc:223 vision_wasm_internal.js:1103:8 third_party/mediapipe/framework/calculator_node.cc:948 vision_wasm_internal.js:1103:8 E0000 00:00:1681574555.266000 1 calculator_graph.cc:851] INTERNAL: CalculatorGraph::Run() failed in Run: vision_wasm_internal.js:1103:8 Calculator::Process() for node "mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraph__mediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0. [type.googleapis.com/mediapipe.StatusList='\n\xd7\x03\x08\r\x12\xd2\x03\x43\x61lculator::Process() for node \"mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraphmediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator\" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.'] vision_wasm_internal.js:1103:8 === Source Location Trace: === vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56 vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_calculator.cc:223 vision_wasm_internal.js:1103:8 third_party/mediapipe/framework/calculator_node.cc:948 vision_wasm_internal.js:1103:8 WebGL warning: tex(Sub)Image[23]D: Resource has no data (yet?). Uploading zeros. WebGL warning: readPixels: Framebuffer not complete. (status: 0x8cd6) COLOR_ATTACHMENT0: Attachment has no width or height. WebGL warning: readPixels: Framebuffer must be complete. Uncaught (in promise) Error: WaitUntilIdle failed: $CalculatorGraph::Run() failed in Run: Calculator::Process() for node "mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraphmediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.; WaitUntilIdle failed handleErrors vision_bundle.js:1 finishProcessing vision_bundle.js:1 process vision_bundle.js:1 processVideoData vision_bundle.js:1 recognizeForVideo vision_bundle.js:1 predict Video.js:39 setup Video.js:45 promise callback*setup Video.js:30 Video Video.js:48 React 8 workLoop scheduler.development.js:266 flushWork scheduler.development.js:239 performWorkUntilDeadline scheduler.development.js:533 js scheduler.development.js:571 js scheduler.development.js:633 factory react refresh:6 Webpack 24 vision_bundle.js:1 I0000 00:00:1681574555.286000 1 hand_gesture_recognizer_graph.cc:256] Custom gesture classifier is not defined. vision_wasm_internal.js:1103:8 I0000 00:00:1681574555.302000 1 gl_context_webgl.cc:151] Successfully created a WebGL context with major version 3 and handle 1 vision_wasm_internal.js:1103:8 I0000 00:00:1681574555.303000 1 gl_context.cc:359] GL version: 3.0 (OpenGL ES 3.0 (WebGL 2.0)) vision_wasm_internal.js:1103:8 W0000 00:00:1681574555.303000 1 gl_context.cc:1000] OpenGL error checking is disabled vision_wasm_internal.js:1103:8 Graph successfully started running. vision_wasm_internal.js:1087:8 INFO: Created TensorFlow Lite XNNPACK delegate for CPU. vision_wasm_internal.js:1103:8 E0000 00:00:1681574555.325000 1 image_to_tensor_utils.cc:56] INTERNAL: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0. vision_wasm_internal.js:1103:8 Stack trace: vision_wasm_internal.js:1103:8 E0000 00:00:1681574555.325000 1 calculator_graph.cc:851] INTERNAL: CalculatorGraph::Run() failed in Run: vision_wasm_internal.js:1103:8 Calculator::Process() for node "mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraph__mediapipe_tasks_vision_hand_landmarker_handlandmarkergraphmediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0. [type.googleapis.com/mediapipe.StatusList='\n\xd7\x03\x08\r\x12\xd2\x03\x43\x61lculator::Process() for node \"mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraph__mediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator\" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.'] vision_wasm_internal.js:1103:8 === Source Location Trace: === vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56 vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_calculator.cc:223 vision_wasm_internal.js:1103:8 third_party/mediapipe/framework/calculator_node.cc:948 vision_wasm_internal.js:1103:8 E0000 00:00:1681574555.326000 1 calculator_graph.cc:851] INTERNAL: CalculatorGraph::Run() failed in Run: vision_wasm_internal.js:1103:8 Calculator::Process() for node "mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraph__mediapipe_tasks_vision_hand_landmarker_handlandmarkergraphmediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0. [type.googleapis.com/mediapipe.StatusList='\n\xd7\x03\x08\r\x12\xd2\x03\x43\x61lculator::Process() for node \"mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraph__mediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator\" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.'] vision_wasm_internal.js:1103:8 === Source Location Trace: === vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56 vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_calculator.cc:223 vision_wasm_internal.js:1103:8 third_party/mediapipe/framework/calculator_node.cc:948 vision_wasm_internal.js:1103:8 E0000 00:00:1681574555.326000 1 calculator_graph.cc:851] INTERNAL: CalculatorGraph::Run() failed in Run: vision_wasm_internal.js:1103:8 Calculator::Process() for node "mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraph__mediapipe_tasks_vision_hand_landmarker_handlandmarkergraphmediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0. [type.googleapis.com/mediapipe.StatusList='\n\xd7\x03\x08\r\x12\xd2\x03\x43\x61lculator::Process() for node \"mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraph__mediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator\" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.'] vision_wasm_internal.js:1103:8 === Source Location Trace: === vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56 vision_wasm_internal.js:1103:8 third_party/mediapipe/calculators/tensor/image_to_tensor_calculator.cc:223 vision_wasm_internal.js:1103:8 Uncaught (in promise) Error: WaitUntilIdle failed: $CalculatorGraph::Run() failed in Run: Calculator::Process() for node "mediapipe_tasks_vision_gesture_recognizer_gesturerecognizergraphmediapipe_tasks_vision_hand_landmarker_handlandmarkergraph__mediapipe_tasks_vision_hand_detector_handdetectorgraphmediapipe_tasks_components_processors_imagepreprocessinggraphImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.; WaitUntilIdle failed handleErrors vision_bundle.js:1 finishProcessing vision_bundle.js:1 process vision_bundle.js:1 processVideoData vision_bundle.js:1 recognizeForVideo vision_bundle.js:1 predict Video.js:39 setup Video.js:45 promise callback*setup Video.js:30 Video Video.js:48 React 7 workLoop scheduler.development.js:266 flushWork scheduler.development.js:239 performWorkUntilDeadline scheduler.development.js:533 js scheduler.development.js:571 js scheduler.development.js:633 factory react refresh:6
@schmidt-sebastian @kuaashish Any update on this?
I can't find any MediaPipe related sources in the repo: https://github.com/MJKingsbury/Theresynth_JS/search?q=mediapipe
https://github.com/MJKingsbury/Theresynth_JS/blob/main/src/Video.js no longer seems to exist (sorry I should have checked last week).
I suspect that you are using an unsupported model, but it's hard to tell given the information provided.
Hi Sebastian, I decided to switch to HandtrackJS as I need this completed by next week and there was no update for a while, so you can close this issue.
Thanks for the update.
It's kind of late but I can tell this problem is from caching for hot reload when using a router. I was facing the same issue when developing a VueJs app using MediaPie.
I fixed it by clearing gestureRecognizer
before unmounting every time, remember to try to clear your event listener as well
function handlerGestureRecognition(){
if (!gestureRecognizer) {
console.log("gestureRecognizer not Loaded");
return;
}
// your code handle gesture recognition from video stream
}
// clear variable before you destroying component
onBeforeUnmount(() => {
gestureRecognizer = null;
stopStream();
const video = document.getElementById(webcamName.value) as HTMLVideoElement;
video.removeEventListener("loadeddata", predictWebcam);
});`
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
MacBook Pro M2, Ventura 13.0 (22A380)
MediaPipe Tasks SDK version
JavaScript / Web
Task name (e.g. Image classification, Gesture recognition etc.)
Gesture recognition
Programming Language and version (e.g. C++, Python, Java)
JavaScript (ReactJS)
Describe the actual behavior
Describe the expected behaviour
Standalone code/steps you may have used to try to get what you need
Other info / Complete Logs
ERROR UPDATED IN COMMENTS.