使用keras.preprocessing.image.ImageDataGenerator进行图像数据论证的技巧? [英] Image data agumentation tequniques using keras.preprocessing.image.ImageDataGenerator?

查看:137
本文介绍了使用keras.preprocessing.image.ImageDataGenerator进行图像数据论证的技巧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过随机旋转,平移,剪切和翻转来生成图像的增强数据.

I would like to generate augmented data for images by Random rotation, shifts, shear and flips.

我发现了 keras函数.

函数keras.preprocessing.image.ImageDataGenerator但是我已经看到它被用于直接训练网络.

The function keras.preprocessing.image.ImageDataGenerator But I've seen this being used to directly train networks.

是否可以输入图像,然后将转换后的图像保存在HDD上,而不是当前

Is there a way to input images and then save the transformed images on HDD instead of how if currently works in examples in this link

还是有另一个简单的即插即用python包,我可以使用它代替使用numpyopencv来实现所有功能?

Or is there another simple plug and use python package I can use instead of implementing everything with numpy or opencv ?

推荐答案

基本上-这是generator,它会无限返回一批图像.一个人可以做以下事情:

Basically - this is generator which is infinitely returning a batches of images. One could do the following:

def save_images_from_generator(maximal_nb_of_images, generator):
    nb_of_images_processed = 0
    for x, _ in generator:
        nb_of_images += x.shape[0]
        if nb_of_images <= maximal_nb_of_images:
            for image_nb in range(x.shape[0]):
                your_custom_save(x[image_nb]) # your custom function for saving images
        else:
            break

keras图像生成器保存图像.

to save images from keras image generator.

这篇关于使用keras.preprocessing.image.ImageDataGenerator进行图像数据论证的技巧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆