【发布时间】:2020-04-30 22:44:02
【问题描述】:
test_batches = ImageDataGenerator(
preprocessing_function=preprocess_input
).flow_from_directory(test_path,target_size=(224,224),batch_size=1,class_mode=None,shuffle = "false")
prediction = model.predict_generator(test_batches, steps=1, verbose=1)
np.argmax(prediction)
所以我在这里使用 step_size=1 和 steps=1 来测试一张图片。每当我运行它时,我都会得到不同的预测,这意味着它不会每次都选择相同的图像。如何查看图片名称?
编辑:这是解释我面临的问题的另一种尝试:
test_batches = ImageDataGenerator(
preprocessing_function=preprocess_input
).flow_from_directory(test_path,target_size=(224,224),batch_size=2,class_mode=None,shuffle = "false")
prediction = model.predict_generator(test_batches, steps=1, verbose=2)
预测变量有两个预测概率数组。我如何知道这些预测是针对哪些图像?
【问题讨论】:
-
@Asymptote 您是否设法将文件名与 predict_generator 的预测分数相关联。您可以分享您的代码以供参考吗?我也有同样的要求
标签: python machine-learning neural-network deep-learning keras