我正在尝试在我的节点服务器上加载本地 tensorflowjs 模型,但出现错误:
UnhandledPromiseRejectionWarning: TypeError: Only HTTP(S) protocols are supported.
这就是我导入 Tensorflowjs 包的方式:
const tf = require('@tensorflow/tfjs');
require('@tensorflow/tfjs-node');
global.fetch = require('node-fetch')
并像这样加载模型:
const ssd_model_path =
'file://models/ssd_model/model.json'
this.model = await tf.loadLayersModel(ssd_model_path);
我的依赖项如下:
"dependencies": {
"@tensorflow/tfjs": "^1.5.2",
"@tensorflow/tfjs-core": "^1.2.11",
"@tensorflow/tfjs-node": "^1.2.3",
"electron-reload": "^1.5.0",
"esm": "^3.2.25",
"jimp": "^0.9.3",
"node-fetch": "^2.6.0"
}