我想看看我的 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/