我很困惑下面的代码中的图像和遮罩是什么意思?
image_datagen.fit(images, augment=True, seed=seed)
mask_datagen.fit(masks, augment=True, seed=seed)
下面的代码是在Tensorflow documentaion中提供的使用ImageDataGenerator遮罩的示例。
# we create two instances with the same arguments
data_gen_args = dict(featurewise_center=True,
featurewise_std_normalization=True,
rotation_range=90.,
width_shift_range=0.1,
height_shift_range=0.1,
zoom_range=0.2)
image_datagen = ImageDataGenerator(**data_gen_args)
mask_datagen = ImageDataGenerator(**data_gen_args)
# Provide the same seed and keyword arguments to the fit and flow methods
seed = 1
image_datagen.fit(images, augment=True, seed=seed)
mask_datagen.fit(masks, augment=True, seed=seed)
image_generator = image_datagen.flow_from_directory(
'data/images', target_size=(img_row, img_col), color_mode='grayscale',
class_mode=None,
seed=seed, save_to_dir='data/aug_images')
mask_generator = mask_datagen.flow_from_directory(
'data/masks', target_size=(img_row, img_col), color_mode='grayscale',
class_mode=None,
seed=seed, save_to_dir='data/aug_images')
# combine generators into one which yields image and masks
train_generator = zip(image_generator, mask_generator)
model.fit_generator(
train_generator,
steps_per_epoch=2000,
epochs=50)
预先感谢