我想拥有一个将图像和遮罩一起转换的管道。我不确定如何确保扩展名匹配,以确保我使用具有正确img的正确遮罩并同时生成它们。例如,我的图像“ 123.jpg”应与各自文件夹中的蒙版“ m_123.jpg”匹配。
seed = 1 # I know I need this so they get the same augmentation
image_datagen = ImageDataGenerator(**some_args)
mask_datagen = ImageDataGenerator(**some_args)
img_gen = image_datagen.flow_from_directory('../data/imgs/',target_size=target_size,class_mode=None,seed=seed,batch_size=batch_size)
mask_gen = image_datagen.flow_from_directory('../data/masks/',target_size=target_size,class_mode=None,seed=seed,batch_size=batch_size)
train_generator = zip(img_gen, mask_gen) # call fit on this generator