CNN预测

CNN predictions

我已经使用训练集和验证集使用 Keras 构建并训练了一个模型。 我想对未标记的数据进行预测,我有一个文件夹包含 300 张狗、猫和马的图像。在预测中,我得到了每个 class.

的概率

如何获得最终输出,告诉/显示这 300 张图像中有多少属于每个 class?

我上传模型

new_model = tf.keras.models.load_model('model')

然后我重新格式化测试图像

test_batches = train_datagen.flow_from_directory(
    'test_images',
    target_size=(224, 224),
    batch_size=10,
    classes = None,
    class_mode= None)

然后我终于做出预测

predictions = new_model.predict(test_batches, steps=30, verbose=0)
import collections, numpy
collections.Counter(np.argmax(predictions, axis = 1))