【发布时间】:2019-09-12 02:47:54
【问题描述】:
按照this tutorial我想在tensorflowjs中加载并使用一个模型,然后使用classify方法对一个输入进行分类。
我像这样加载和执行模型:
const model = await window.tf.loadGraphModel(MODEL_URL);
const threshold = 0.9;
const labelsToInclude = ["test1"];
model.load(threshold, labelsToInclude).then(model2 => {
model2.classify(["test sentence"])
.then(predictions => {
console.log('prediction: ' + predictions);
return true;
})
});
但我得到了错误:
TypeError: model2.classify is not a function at App.js:23
如何正确使用tensorflowjs中的classify方法?
【问题讨论】: