Hello,
I'm trying to setup BodyPix via the tutorial on the TensorFlow website, and I'm getting the following error
Uncaught (in promise) Error: No backend found in registry.
at Engine.getSortedBackends (engine.js:248)
at Engine.initializeBackendsAndReturnBest (engine.js:257)
at Engine.get backend [as backend] (engine.js:94)
at Engine.makeTensor (engine.js:556)
at makeTensor (tensor_ops_util.js:57)
at tensor (tensor.js:48)
at Module.decodeWeights (io_utils.js:212)
at GraphModel.loadSync (graph_model.js:118)
at GraphModel.load (graph_model.js:102)
at async loadGraphModel (graph_model.js:348)
I tried installing several packages that I thought might help, but I'm really not sure what to do now.. appreciate any input I could get. Below are my package.json and index.js files.
package.json
```
"dependencies": {
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
"@tensorflow-models/body-pix": "^2.0.5",
"@tensorflow/tfjs": "^2.3.0",
"@tensorflow/tfjs-converter": "^2.3.0",
"@tensorflow/tfjs-core": "^2.3.0",
"@tensorflow/tfjs-node-gpu": "^2.3.0"
},
"devDependencies": {
"babel-loader": "^8.1.0",
"webpack-dev-server": "^3.11.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
}
index.js
import * as bodyPix from '@tensorflow-models/body-pix';
const img = document.getElementById('image');
async function loadAndPredict() {
const net = await bodyPix.load(/* optional arguments, see below */);
/**
We recently release v2.0.0 (see the message at the top of the readme https://github.com/tensorflow/tfjs), the release notes have instructions on how to upgrade, or you can pin your version
Are you running in the browser or in node.js env?
If you are in the browser, try to add following line to your index.js file
import * as tfjs from '@tensorflow/tfjs';
also in your package.json, if you have include the union package '@tensorflow/tfjs',
you don't need to include other individual packages (i.e. core, converter, tfjs-node).
Hi thanks for the responses.
I did adding the line you suggested to my index.js file, but it's still giving me the same error.
I ended up just using the CDN. I'm trying to experiment using bodyPix with matter.js for a program project. I can try to revisit this after I'm done.
Most helpful comment
Are you running in the browser or in node.js env?
If you are in the browser, try to add following line to your index.js file
import * as tfjs from '@tensorflow/tfjs';
also in your package.json, if you have include the union package '@tensorflow/tfjs',
you don't need to include other individual packages (i.e. core, converter, tfjs-node).