Tfjs: Running tfjs posenet demo is failing with error- Uncaught (in promise) Error: Tensor is disposed.

Created on 22 May 2018  ยท  11Comments  ยท  Source: tensorflow/tfjs

TensorFlow.js version

Cloned the latest code from repo _https://github.com/tensorflow/tfjs-models_
Loaded dependencies through yarn.
Build code through parcel.

Browser version

Chrome Version 66.0.3359.181

Describe the problem or feature request

When running the examples(both coco and camera example) in browser it does not work and throws error in console.

Error:
_

node_modules\@tensorflow\tfjs-core\dist\tensor.js:253 Uncaught (in promise) Error: Tensor is disposed.
at Tensor.throwIfDisposed (node_modules\@tensorflow\tfjs-core\dist\tensor.js:253)
at Tensor.div (node_modules\@tensorflow\tfjs-core\dist\tensor.js:418)
at MobileNet.predict (src\mobilenet.ts:183)
at src\posenet.ts:97
at Object.Tracking.tidy (node_modules\@tensorflow\tfjs-core\dist\tracking.js:36)
at PoseNet.predictForMultiPose (src\posenet.ts:96)
at _callee5$ (demos\coco.js:186)
at tryCatch (demos\node_modules\babel-runtime\node_modules\regenerator-runtime\runtime.js:62)
at Generator.invoke [as _invoke] (demos\node_modules\babel-runtime\node_modules\regenerator-runtime\runtime.js:296)
at Generator.prototype.(anonymous function) [as next] (http://localhost:1234/coco.35bde3de.js:216:21)

_

Code to reproduce the bug / link to feature request

I have not written any custom code am just running the demo locally.

Most helpful comment

If you want to get something up and running temporarily until we fix this, checkout commit b00dcd6

git checkout b00dcd6

Then follow the setup instructions again.

All 11 comments

@oveddan

@ithinkiamdevesh what are the exact commands you are using to install the dependencies, build the demos, and run them?

Thanks @oveddan
I am running commands as follows:

C:\Users\dev\Desktop\test-project\tfjs-models>yarn
yarn install v1.6.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.17s.

C:\Users\dev\Desktop\test-project\tfjs-models>cd posenet

C:\Users\dev\Desktop\test-project\tfjs-models\posenet>yarn
yarn install v1.6.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.57s.

C:\Users\dev\Desktop\test-project\tfjs-models\posenet>cd demos

C:\Users\dev\Desktop\test-project\tfjs-models\posenet\demos>yarn
yarn install v1.6.0
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.71s.

C:\Users\dev\Desktop\test-project\tfjs-models\posenet\demos>parcel
Server running at http://localhost:1234
โˆš Built in 67.70s.

Then hitting http://localhost:1234 on browser.

Okay got it. This works.

C:\Users\dev\Desktop\test-project\tfjs-models>yarn
yarn install v1.6.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.18s.

C:\Users\dev\Desktop\test-project\tfjs-models>cd posenet

C:\Users\dev\Desktop\test-project\tfjs-models\posenet>yarn
yarn install v1.6.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.59s.

C:\Users\dev\Desktop\test-project\tfjs-models\posenet>cd demos

C:\Users\dev\Desktop\test-project\tfjs-models\posenet\demos>yarn
yarn install v1.6.0
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.71s.

C:\Users\dev\Desktop\test-project\tfjs-models\posenet\demos>_parcel build index.html_
โˆš Built in 3.41s.

dist\camera.e1c7bba9.js 660.77 KB 35.23s
dist\coco.f523c6d5.js 657.84 KB 35.22s
dist\coco.html 1.26 KB 9ms
dist\camera.html 1.17 KB 10ms
dist\index.html 214 B 9ms
dist\camera.ff62c52e.map 0 B 35.65s
dist\coco.fb1896b7.map 0 B 35.59s

C:\Users\dev\Desktop\test-project\tfjs-models\posenet\demos>_cd dist_

C:\Users\dev\Desktop\test-project\tfjs-models\posenet\demos\dist>_http-server_
Starting up http-server, serving ./
Available on:
http://192.168.56.1:8080
http://10.75.1.119:8080
http://192.168.43.7:8080
http://127.0.0.1:8080

Thanks @oveddan .

I get the same error, even when following the instructions by @ithinkiamdevesh.

Here is what I did:
my-computer-name:tfjs-models-master-3 myname$ yarn
yarn install v1.5.1
[1/4] ๐Ÿ” Resolving packages...
[2/4] ๐Ÿšš Fetching packages...
[3/4] ๐Ÿ”— Linking dependencies...
[4/4] ๐Ÿ“ƒ Building fresh packages...
โœจ Done in 0.26s.
my-computer-name:tfjs-models-master-3 myname$ cd posenet/
my-computer-name:posenet myname$ yarn
yarn install v1.5.1
[1/4] ๐Ÿ” Resolving packages...
[2/4] ๐Ÿšš Fetching packages...
[3/4] ๐Ÿ”— Linking dependencies...
[4/4] ๐Ÿ“ƒ Building fresh packages...
success Saved lockfile.
โœจ Done in 9.17s.
my-computer-name:posenet myname$ cd demos/
my-computer-name:demos myname$ yarn
yarn install v1.5.1
[1/5] ๐Ÿ” Validating package.json...
[2/5] ๐Ÿ” Resolving packages...
[3/5] ๐Ÿšš Fetching packages...
[4/5] ๐Ÿ”— Linking dependencies...
[5/5] ๐Ÿ“ƒ Building fresh packages...
โœจ Done in 8.95s.
my-computer-name:demos myname$ parcel build index.html
โœจ Built in 21.39s.

dist/camera.5c83e267.js โš ๏ธ 1 MB 828.00s
dist/coco.763ac556.js โš ๏ธ 1 MB 825.57s
dist/coco.html 1.26 KB 564ms
dist/camera.html 1.21 KB 595ms
dist/index.html 214 B 1.10s
dist/camera.cd5e1ebd.map 0 B 822.31s
dist/coco.1c49d8dc.map 0 B 819.88s
my-computer-name:demos myname$ cd dist
my-computer-name:dist myname$ http-server
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8080
...
...

Hi @CreativeCode just curious - why are you doing the step yarn install v1.5.1 ? Also you should be starting parcel with yarn watch

I would follow the instructions for setup in the demos folder.

I'm not sure this would solve your issue but can you please try that? First remove the node_modules folders in both tfjs-models/posenet then tfjs-models/posenet/demos and try those instructions.

@oveddan I just deleted node_modules from both folders you pointed to, and ran the instructions from setup in the demos folder,

I still get Uncaught (in promise) Error: Tensor is disposed. when running

@evexoio @CreativeCode I just ran the setup instructions and have the same error. Will re-open.

If you want to get something up and running temporarily until we fix this, checkout commit b00dcd6

git checkout b00dcd6

Then follow the setup instructions again.

@oveddan thanks for the quick temporary solution! Works like a charm. Yes, I have tried with the official instructions first - my process posted above was the result of trying to imitate @ithinkiamdevesh 's solution... (I was not sure why I was doing what I was doing...)

@CreativeCode @ithinkiamdevesh @evexoio Thanks to @dsmilkov this has been fixed.

As part of this fix, The demos now import posenet directly from the public posenet npm package, instead of from ../src

This has a couple of positive side effects:

  • the new setup for the demos takes less steps and is easier, as you no longer need to build the posenet folder.
  • The demos folder can act as a boilerplate, as it can be copied and pasted as is somewhere else to create a new application, without needing to be relative to the ../src folder.

To switch back to master and get the latest:

    git checkout master
    git pull origin master

Follow the new setup instructions.

Was this page helpful?
0 / 5 - 0 ratings