我已经使用训练集和验证集使用Keras构建和训练了一个模型。我想对未标记的数据进行预测,我有一个文件夹,其中包含300张狗、猫和马的图像。在预测中,我得到了每一类的概率。
如何获得最终输出,告诉/显示这300张图片中有多少张属于每个类?
我上传模型
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)发布于 2020-07-25 04:49:22
import collections, numpy
collections.Counter(np.argmax(predictions, axis = 1)) https://stackoverflow.com/questions/63077867
复制相似问题