keras_dataAug.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:FCN_train 作者: 315386775 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号