【发布时间】:2021-04-29 22:25:15
【问题描述】:
我有一个关于 ImageDataGenerator 的 flow_from_directory 方法的问题。我的图像是 RGB 形式,我正在使用迁移学习,我想在灰度图像上训练模型,但预训练模型需要 3 个通道。 flow_from_directory 颜色模式中有一种方法,它采用灰度或 RBG 。我的问题是,如果我在这里写灰度,Keras 会自动将 RGB 图像转换为灰度还是其他?
IMAGE_SIZE=[224,224]
resnet = InceptionResNetV2(input_shape=IMAGE_SIZE + [3] , weights='imagenet', include_top=False)
Flow_from_dir 方法:
test_set = test_datagen.flow_from_directory(valid_path,
target_size = (224, 224),
batch_size = 32,
class_mode = 'categorical',color_mode='grayscale')
【问题讨论】:
标签: machine-learning deep-learning conv-neural-network resnet transfer-learning