【发布时间】:2020-11-15 13:06:02
【问题描述】:
对于猫狗图片的二元分类,我的目录结构是train_dir/cats和train_dir/dogs。
train_datagen = ImageDataGenerator(rescale=1/255)
train_generator = train_datagen.flow_from_directory(
'/train_dir/', # This is the source directory for training images
target_size=(300, 300), # All images will be resized to 150x150
batch_size=128,
# Since we use binary_crossentropy loss, we need binary labels
class_mode='binary')
model.predict(images, batch_size=10)
如何知道model.predict()返回的概率属于哪个类?是猫=1 还是狗=1? 我在某处读到,对于多类分类,返回的概率按类名的字母顺序排列。但我认为二进制分类并非如此。
【问题讨论】:
标签: python tensorflow computer-vision conv-neural-network imagedata