tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.36k stars 1.92k forks source link

[tfjs-models] memory access out of bounds error in pose-detection demo #5248

Closed haoyunfeix closed 3 years ago

haoyunfeix commented 3 years ago

Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

System information

Describe the current behavior Met RuntimeError: memory access out of bounds when use wasm backend in posenet model.

Describe the expected behavior Should not met Error

Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/CodePen/any notebook.

  1. Add wasm backend to poseNet model.

    diff --git a/pose-detection/demos/live_video/src/params.js b/pose-detection/demos/live_video/src/params.js
    index 3ddf62e..66cdb98 100644
    --- a/pose-detection/demos/live_video/src/params.js
    +++ b/pose-detection/demos/live_video/src/params.js
    @@ -80,7 +80,7 @@ export const BACKEND_FLAGS_MAP = {
    };
    
    export const MODEL_BACKEND_MAP = {
    -  [posedetection.SupportedModels.PoseNet]: ['tfjs-webgl'],
    +  [posedetection.SupportedModels.PoseNet]: ['tfjs-webgl', 'tfjs-wasm'],
    [posedetection.SupportedModels.MoveNet]: ['tfjs-webgl', 'tfjs-wasm'],
    [posedetection.SupportedModels.BlazePose]:
       isiOS() ? ['tfjs-webgl'] : ['mediapipe-gpu', 'tfjs-webgl']
  2. yarn watch
  3. Visit http://localhost:1234/?model=posenet
  4. select "tfjs-wasm"

Other info / 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.

rthadur commented 3 years ago

In order to expedite the trouble-shooting process, please provide a code snippet to reproduce the issue reported here. Thanks!

haoyunfeix commented 3 years ago

Reproduce code is here: https://github.com/tensorflow/tfjs-models/pull/756

rthadur commented 3 years ago

Wasm is not supported in posenet , @lina128 can you please confirm if this is supported ?

lina128 commented 3 years ago

Right, WASM is not supported, it's either too slow to run or throws memory access out of bounds error.

google-ml-butler[bot] commented 3 years ago

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