在python中向图像生成器添加元数据
是否有办法将更多信息放入在python中向图像生成器添加元数据,python,tensorflow,Python,Tensorflow,是否有办法将更多信息放入生成器变量中 目前,我有一个带有20300个图像的生成器,代码如下: train_dataGen = ImageDataGenerator(rescale=1./255,horizontal_flip=True,vertical_flip=True, preprocessing_function=rotate_image) train_generator = train_dataGen.flow_fr
生成器
变量中
目前,我有一个带有20300个图像的生成器,代码如下:
train_dataGen = ImageDataGenerator(rescale=1./255,horizontal_flip=True,vertical_flip=True,
preprocessing_function=rotate_image)
train_generator = train_dataGen.flow_from_directory(directory="/content/train_pad_cc",
class_mode="categorical",
batch_size=32,
target_size=(224,224),
shuffle = True, seed = 2)
我还有一个大小为(20300,30)的数组中的元数据。30列包含相关数据。
有没有办法将元数据数组插入到图像生成器中
我的意图是使用这个组合发电机来训练2个输入的CNN。我假设fit模型会自动将输入分配到各自的位置(第一个输入中的图像和第二个输入中的元数据)。我这么想是不是错了
下面的代码显示了我正在尝试实现和训练的CNN模型
#MY MODEL
resnet = ResNet101(include_top=False, weights='imagenet', input_shape=(224, 224, 3))
first_input = Input((224,224,3))
x = resnet(first_input )
first_dense = layers.GlobalAveragePooling2D()(x)
second_input = Input(shape=(28, ))
second_dense = Dense(500,activation='relu')(second_input)
merge = concatenate([first_dense, second_dense])
merge_dense= Dense(100, activation='relu')(merge)
softmax= Dense(3,activation='softmax' )(merge_dense)
model = Model(inputs=[first_input , second_input], outputs=softmax)
#TRAINING MODEL
History= model.fit(combined_generator,epochs = 50,batch_size=32).history