实践过程中的得出的经验,做此记录。
from keras.preprocessing.image import ImageDataGenerator
# 设置图像数据生成器参数,具体参数不详细讲
aug = ImageDataGenerator(rotation_range=30, width_shift_range=0.1,
height_shift_range=0.1, shear_range=0.2, zoom_range=0.2,
horizontal_flip=True, fill_mode="nearest")
# 创建图像数据生成器
imageGen = aug.flow(image, batch_size=1)
# 返回迭代器中的下一组值
next(imageGen)
注意:此处的 image 为四维 numpy 数组,第一维为 batch_size, 第2 , 3,4维为图像的三个维度。
next(imageGen) 返回的图像数量为 min(len(image),batch_size)
1万+

被折叠的 条评论
为什么被折叠?



