我用python制作了一个模型,并将其导出到tensorflow js。该模型将面部图像分类为情感,应该有7个类别。
我根据图像制作了一个张量,并使用了预测,如下所示:
const prediction = model.predict(imageTensor);我的预测是:
Tensor {
"dataId": Object {},
"dtype": "float32",
"id": 415,
"isDisposedInternal": false,
"kept": false,
"rankType": "2",
"scopeId": 197,
"shape": Array [
1,
7,
],
"size": 7,
"strides": Array [
7,
],
}如何从这里提取结果?
发布于 2020-10-06 02:59:10
找到了答案,我正在使用typescript,它是必需的:常量预测= (model.predict( imageTensor ) as tf.Tensor).dataSync();
发布于 2020-10-06 02:48:15
预测是一个张量。如果要访问数据,则需要使用prediction.dataSync()
https://stackoverflow.com/questions/64211494
复制相似问题