Reputation: 910
When trying to run a demo project for Handpose tfjs, I get the below error.
My package.json file has below dependencies:
{
"name": "tensorflowJs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"watch": "cross-env NODE_ENV=development parcel index.html --no-hmr ",
"build": "cross-env NODE_ENV=production parcel build index.html --public-url ./"
},
"browser": {
"crypto": false
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@tensorflow-models/handpose": "0.0.4",
"@tensorflow/tfjs-backend-wasm": "^2.0.0",
"@tensorflow/tfjs-converter": "^1.7.4",
"@tensorflow/tfjs-core": "^2.0.0",
"@tensorflow/tfjs-node": "^2.0.0",
"bootstrap": "^4.5.0",
"cross-env": "^7.0.2"
},
"devDependencies": {
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.2",
"@babel/plugin-transform-runtime": "^7.10.1",
"@babel/polyfill": "^7.10.1",
"@babel/preset-env": "^7.10.2",
"babel-preset-env": "^1.7.0",
"parcel-bundler": "^1.12.4"
}
}
The issue with the registry was supposed to be resolved after version 0.10.3, but even for version-2, I'm still facing the issue. Does anyone know why this issue occurs?
Upvotes: 9
Views: 15842
Reputation: 9321
I was having the same error which "No backend found in registry" but in my case i was working with @tensorflow-models/blazeface
model and a react app.I installed @tensorflow/tfjs-converter
and @tensorflow/tfjs-core
as the Readme link to the Github Readme was suggesting but i was still getting the error. Then i solved my problem by going to the index.html in the public folder of a react app and i added the following scripts at the bottom of the file.
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl"></script>
Good luck
Upvotes: 5
Reputation: 31
For me, the solution was to wait for tf to be ready:
tf.ready().then(()=> {
//Code here
})
Upvotes: 3
Reputation: 632
I have tried all the solutions here, and solutions in the net: for days. Then it occurred to me: most of those problems on those cases are version issues.
Then, I just copied a version working an app found in the net, and it works fine. Final learning: it seems an issue with versioning.
"@tensorflow-models/mobilenet": "1.0.1",//this one you should fix, the issue is here
"@tensorflow/tfjs": "2.0.0",//tested, you can install the latest version
Not sure we have a better solution, but it works just fine!
Upvotes: 1
Reputation: 5412
For me it worked after I added these two packages to the project:
import '@tensorflow/tfjs-backend-cpu';
import '@tensorflow/tfjs-backend-webgl';
Upvotes: 2
Reputation: 28502
I had mistakenly come up with my own import line:
import backend from '@tensorflow/tfjs-backend-webgl'
import '@tensorflow/tfjs-backend-webgl';
Upvotes: 12
Reputation: 300
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/handpose"></script>
Tensorflow released 2.0.0, and now you must choose either tfjs-backend-webgl, tfjs-backend-cpu, or tfjs-backend-wasm to run your model. You're using handpose and for that you should use webgl.
Upvotes: 7