image-processing - Keras:可视化 ImageDataGenerator 输出

标签 image-processing plot colors keras

我想看看我的 ImageDataGenerator 给我的网络带来了什么。

编辑:
去掉了channel_shift_range,不小心把它留在了代码中

发电机

genNorm = ImageDataGenerator(rotation_range=10, width_shift_range=0.1, 
       height_shift_range=0.1, zoom_range=0.1, horizontal_flip=True)

获取批次
batches = genNorm.flow_from_directory(path+'train', target_size=(224,224),
      class_mode='categorical', batch_size=64)

x_batch, y_batch = next(batches)

绘制图像
for i in range (0,32):
    image = x_batch[i]
    plt.imshow(image.transpose(2,1,0))
    plt.show()

结果

Generator Output

这是正常的还是我在这里做错了什么?

最佳答案

尝试这个;更改生成器如下:

import numpy as np

def my_preprocessing_func(img):
    image = np.array(img)
    return image / 255

genNorm = ImageDataGenerator(rotation_range=10, width_shift_range=0.1, 
       height_shift_range=0.1, zoom_range=0.1, horizontal_flip=True, 
       preprocessing_function=my_preprocessing_func)

这对我有用,

布鲁诺

关于image-processing - Keras:可视化 ImageDataGenerator 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45797852/

相关文章:

OpenCV:基本矩阵和移动相机

matlab - 在matlab中寻找瀑布图的变体

r - 当只有一个绘图具有轴标签时,如何创建多个绘图,每个绘图具有相同的绘图区域大小?

excel - 如何将RGB颜色存储在变量中?

r - ggplot : scale_color_steps()-like color scale for ordered factors

opencv - BackgroundSubtraction Mog2 错误

c++ - OpenCV/C++:warpPerspective产生过度扭曲的结果

python - 如何创建具有任意数量 channel 的图像? (Python)

r - 如何在 R 中将密度表示为百分比?

vba - CorelDraw VBA 填充颜色