【发布时间】:2021-05-14 21:16:56
【问题描述】:
我的模型是:
我想为此使用图像数据生成器 我为 3vgg inpu 编写了这段代码,它提供图像作为输入,但我也不知道如何为 mlp 生成...
from keras.preprocessing.image import ImageDataGenerator
batch_size=2
# Define the image transformations here
gen = ImageDataGenerator(rotation_range=10,
zoom_range=0.10,
width_shift_range=0.2,
height_shift_range=0.2,
shear_range=0.15,
horizontal_flip=True,
# brightness_range=[0.2,1.0],
fill_mode="nearest")
# Here is the function that merges our two generators
# We use the exact same generator with the same random seed for both the y and angle arrays
def generator_three_img(X1, X2, X3, y, batch_size):
genX1 = gen.flow(X1, y, batch_size=batch_size, seed=1)
genX2 = gen.flow(X2, y, batch_size=batch_size, seed=1)
genX3 = gen.flow(X3, y, batch_size=batch_size, seed=1)
while True:
X1i = genX1.next()
X2i = genX2.next()
X3i = genX3.next()
# X4i = genX4.next()
yield [X1i[0], X2i[0], X3i[0]], X1i[1]
# Finally create generator
gen_flow = generator_three_img(im_train_whole,im_train_L,im_train_R,y_train_whole,2)
【问题讨论】:
-
您不应该将 stack sn-p 用于 JS 以外的语言。 // 还包括一个标签语言——我给你加了一个。
-
看起来您已经有了一些工作代码,那么损坏的代码及其错误消息是什么?
标签: python keras model data-augmentation