def data_augmentation(image_files, dir):
image_list = []
new_file_name = dir
save_dir = "xxx" + new_file_name
for image_file in image_files:
image_list.append(misc.imread(image_file))
for image in image_list:
x = img_to_array(image) # this is a Numpy array with shape (3, 150, 150)
x = x.reshape((1,) + x.shape) # this is a Numpy array with shape (1, 3, 150, 150)
i = 0
for batch in datagen.flow(x, batch_size=1, save_to_dir=save_dir,
save_prefix=dir, save_format='jpg'):
i += 1
if i > 99:
break
return image_list
# List all the files
评论列表
文章目录