尝试为Handpose tfjs运行演示项目时,出现以下错误。
我的package.json文件具有以下依赖关系:
{
"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"
}
}
注册表问题应该在版本0.10.3之后得到解决,但是即使对于版本2,我仍然面临该问题。有谁知道为什么会发生这个问题?
<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发布了2.0.0,现在你必须选择tfjs-backend-webgl,tfjs-backend-cpu或tfjs-backend-wasm来运行模型。你正在使用handpose,为此你应该使用webgl。
谢谢。!那消除了错误。而且由于@ tensorflow / tfjs包含默认的webGl后端,所以我什至不必包含脚本。