DEV Community

Run PoseNet with Nodejs

0xkoji on June 05, 2019

What is Posenet? https://medium.com/tensorflow/real-time-human-pose-estimation-in-the-browser-with-tensorflow-js-7dd0bc881cd5 https://gi...
Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
0xkoji profile image
0xkoji

i just used npm install @tensorflow-models/posenet to use the model.

nodejs v10.15.0
npm v6.9.0

Collapse
 
gaelguedia profile image
Geekster🇨🇲

I am always receiving this error: UnhandledPromiseRejectionWarning: Error: Image given has not completed loading

Collapse
 
0xkoji profile image
0xkoji

with my sample code?

Collapse
 
gaelguedia profile image
Geekster🇨🇲

Yes, after installing all the dependencies I ended up with this error code : FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.

Thread Thread
 
0xkoji profile image
0xkoji

can you tell me your os version, nodejs version and your package.json's dependencies

Thread Thread
 
gaelguedia profile image
Geekster🇨🇲

linux subsystem on windows 10, "dependencies": {
"@tensorflow-models/posenet": "2.1.3",
"body-parser": "1.19.0",
"express": "4.17.1",
"morgan": "1.9.1",
"typescript": "3.6.3"
},
"devDependencies": {
"@tensorflow/tfjs": "1.2.9",
"@tensorflow/tfjs-node": "1.2.9",
"botkit": "4.5.0",
"canvas": "2.6.0",
"rollup": "1.21.2"
}

Thread Thread
 
0xkoji profile image
0xkoji

tensorflor-models/posenet has been updated so you need to update code.

just checked my package.json

"dependencies": {
    "@tensorflow-models/posenet": "^1.0.3",
    "@tensorflow/tfjs": "^1.1.2",
    "@tensorflow/tfjs-node": "^1.1.2",
    "botkit": "^4.0.2",
    "canvas": "^2.5.0",
    "rollup": "^1.13.1"
  }
Collapse
 
yalomdd profile image
yalomdd

I ended up uninstalling everything and reinstalling. But now when I run the code I get " (node:87485) UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'architecture' on number '0.75'" which seems to be an error within posenet. maybe not everything is completely installed correctly? what do you think thank you for the help

Collapse
 
oveddan profile image
Dan Oved • Edited

It's because posenet api has been updated in version 2.0. See:
github.com/tensorflow/tfjs-models/...

Example new loading code:

const net = await posenet.load({
  architecture: 'MobileNetV1',
  outputStride: 16,
  inputResolution: 513,
  multiplier: 0.75
});
Collapse
 
cvramanan profile image
Venkataramanan Chockalingam

Can you please add video inference support for posenet?

Collapse
 
0xkoji profile image
0xkoji • Edited

sorry i don't have time now.
i recommend you to check tfjs repo and dan's repos dev.to/oveddan since he is the peron who has implemented posenet to tfjs.
my code is outdated.

Collapse
 
0xkoji profile image
0xkoji • Edited

@gaelguedia
can you tell me your os version, nodejs version, npm/yarn and your package.json's dependencies

Collapse
 
gaelguedia profile image
Geekster🇨🇲

The above error was on windows 10, js 10. The issue seems to be related to canvas dependency. It's not easy to have it running on windows. It's easier on ubuntu especially easier to install cairo dependencies for Jpg/jpeg support