【发布时间】:2020-09-01 19:27:22
【问题描述】:
当我尝试在我的网络应用程序上加载我的训练模型时出现以下错误,从路径正确到达 json(我尝试使用 console.log 打印并且没关系),似乎问题是当 tf.loadLayers 尝试加载它时......
Vue 应用代码
import * as tf from '@tensorflow/tfjs';
export default {
data(){
return {
modelJSON: require('../model/jsmodel/model.json'),
}
},
mounted(){
this.loadModel();
},
methods: {
async loadModel(){
this.model = await tf.loadLayersModel(this.modelJSON)
},
...
错误
models.js?411e:207 Uncaught (in promise) Error: Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.
at loadLayersModelFromIOHandler (models.js?411e:207)
at loadLayersModelInternal (models.js?411e:190)
at Module.loadLayersModel (exports.js?79b0:220)
at _callee$ (SingleTweet.vue?b47c:40)
at tryCatch (runtime.js?96cf:63)
at Generator.invoke [as _invoke] (runtime.js?96cf:293)
at Generator.eval [as next] (runtime.js?96cf:118)
at asyncGeneratorStep (asyncToGenerator.js?1da1:3)
at _next (asyncToGenerator.js?1da1:25)
at eval (asyncToGenerator.js?1da1:32)
【问题讨论】:
-
我遇到了完全一样的问题,我试过用webpack导入ES6,还是不行,我试试看源码。
标签: javascript tensorflow keras tensorflow.js