python - 使用 Keras 进行数据扩充产生几乎是白色的图像

标签 python keras data-augmentation

我正在尝试使用 keras ImageDataGenerator 进行数据扩充。 我从数据框中提取图像,其中一列包含图像路径,另一列包含标签。现在,我只是想水平翻转图像。但是当我绘制图像时,图像看起来亮度被推到了最大。我想知道这里发生了什么......有什么想法吗?

datagen = ImageDataGenerator(horizontal_flip=True)


# Configure batch size and retrieve one batch of images
for X_batch, y_batch in datagen.flow_from_dataframe(dataframe=data,
    x_col="File name",
    y_col="Driving direction",
    directory = "Self-Driving-Car/Training Data/",
    target_size = (480, 640),
    class_mode = "other"):
    # Show 9 images
    for i in range(0, 9):
        plt.subplot(330 + 1 + i)
        plt.imshow(X_batch[i])
    plt.show()
    break

Here is one original image

Here are the augmented images

最佳答案

好的,这只是一个绘图问题,这解决了它:

    plt.imshow(X_batch[i]/255)

关于python - 使用 Keras 进行数据扩充产生几乎是白色的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55568931/

相关文章:

python - Pandas 中的分组和列差异计算

python - 下载图片 Python Telegram API

python - 数据增强映射函数中的 Tensorflow 随机数

machine-learning - Keras 保存的模型预测不同 session 上的不同值

machine-learning - 使用predict_generator和flow_from_directory时如何获取对应的image_id和label

python - 数据增强: What proportion of training dataset needs to be augmented?

python - 将 AdditiveGaussianNoise 添加到单个图像 - AssertionError : Expected boolean as argument for 'return_batch'

python - Flask 被 OpenCV 卡住

python - matplotlib 股票代码 FuncFormatter

python - 尚未在model.summary()上建立此模型错误