1

我正在使用 keras inception 预训练模型(使用 imagenet 数据) https://github.com/fchollet/keras/blob/master/keras/applications/inception_v3.py

我的短节目是

model = InceptionV3(weights='imagenet')

img_path = 'data/rockcliff.jpg'
img = image.load_img(img_path, target_size=(299, 299))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)

preds = model.predict(x)
print('Predicted:', decode_predictions(preds))

我尝试了 3 张图片,cropped_pa​​nda、rockcliff 和 pitcher。在每种情况下,预测都将起重机作为首选。确切的回报是

('预测:', [[(u'n03126707', u'crane', 0.77817649), (u'n04041544', u'radio', 0.098524272), (u'n03450230', u'gown', 0.084664099), (u'n02128925', u'jaguar', 0.015732178), (u'n03459775', u'grille', 0.011028509)]])

知道有什么问题吗?

4

0 回答 0