gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 03:17:59 24 4
gpt4 key购买 nike

我正在尝试使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com