预测图像分类

时间:2019-10-04 17:20:11

标签: python matlab deep-learning

我使用googlenet在matlab上训练了神经网络,然后使用以下代码将.mat文件模型导出到python。但是当我尝试预测图像时,它说字典没有属性预测。那么如何在将NN模型导出到python时预测输入图像

我尝试了以下代码进行预测:

prediction = annots.predict([image])
prediction = list(prediction[0])
print(CATEGORIES[prediction.index(max(prediction))])

.mat到python代码:

import scipy
from scipy.io import loadmat
annots = loadmat('Anet.mat')
image = "1.jpg" #your image path
print(type(annots))

错误:

Traceback (most recent call last):
File "C:\Users\prajw\OneDrive\Desktop\pi3", line 7, in <module>
prediction = annots.predict([image])
AttributeError: 'dict' object has no attribute 'predict'
[Finished in 0.7s]

0 个答案:

没有答案