Keras实时增强功能增加了噪声和对比度 [英] Keras Realtime Augmentation adding Noise and Contrast
问题描述
Keras提供了一个 ImageDataGenerator 类用于实时增强,但不包括对比度调整和添加噪声。
Keras provides an ImageDataGenerator class for realtime augmentation, but it does not include contrast adjustment and addition of noise.
在训练过程中如何应用随机的噪声水平和随机的对比度调整?是否可以将这些函数添加到datagen的 preprocessing_function参数中?
How can we apply a random level of noise and a random contrast adjustment during training? Could these functions be added to the 'preprocessing_function' parameter in the datagen?
谢谢。
推荐答案
来自Keras文档:
preprocessing_function:每个输入都会隐含的函数。该功能将在对其进行任何其他修改之前运行。该函数应采用一个参数:一个图像(秩为3的Numpy张量),并应输出具有相同形状的Numpy张量。
preprocessing_function: function that will be implied on each input. The function will run before any other modification on it. The function should take one argument: one image (Numpy tensor with rank 3), and should output a Numpy tensor with the same shape.
因此,我创建了一个简单的函数然后使用 imgaug模块中的图像增强功能。请注意,imgaug要求图片的排名为4。
So, I created a simple function and then used the image augmentation functions from the imgaug module. Note that imgaug requires images to be rank 4.
这篇关于Keras实时增强功能增加了噪声和对比度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!