文件夹结构Keras ImageDataGenerator
我有一组经过训练的乳腺癌图像,其结构如下:
cancer_images/
begnin/
adenosis/
* lots of png images *
tubular_adenoma/
* lots of png images *
fibroadenoma/
* lots of png images *
phyllodes_tumor/
* lots of png images *
malignant/
mucinous_carcinoma/
* lots of png images *
papillary_carcinoma/
* lots of png images *
ductal_carcinoma/
* lots of png images *
lobular_carcinoma/
* lots of png images *
我使用Keras ImageDataGenerator
data_generator = ImageDataGenerator(rotation_range=10., width_shift_range=0.1, height_shift_range=0.1, shear_range=0., zoom_range=1., horizontal_flip=True, vertical_flip=True)
train_batches = data_generator.flow_from_directory("breast_cancer", save_to_dir="breast_cancer", target_size=(224, 224), batch_size=32)
i = 0
for batch in train_batches:
i += 1
if i > 5429:
break
当我增加数据时,我需要保留文件夹结构
扩充图像时如何保留原始目录结构?