gpt4 book ai didi

python - 图像预处理和数据增强应该如何用于语义分割?

转载 作者:行者123 更新时间:2023-12-04 12:17:15 25 4
gpt4 key购买 nike

我有一个不平衡的小数据集,其中包含 4116 个 224x224x3 (RGB) 航拍图像。由于数据集不够大,我很可能会遇到过拟合问题。图像预处理和数据增强有助于解决这个问题,如下所述。

"Overfitting is caused by having too few samples to learn from, rendering you unable to train a model that can generalize to new data. Given infinite data, your model would be exposed to every possible aspect of the data distribution at hand: you would never overfit. Data augmentation takes the approach of generating more training data from existing training samples, by augmenting the samples via a number of random transformations that yield believable-looking images."

Deep Learning with Python by François Chollet, page 138-139, 5.2.5 Using data augmentation.


我已阅读 Medium - Image Data Preprocessing for Neural Networks并检查了斯坦福的 CS230 - Data Preprocessing
CS231 - Data Preprocessing培训类。它在 SO question 中再次突出显示我明白没有“一刀切”的解决方案。这是迫使我提出这个问题的原因:

"No translation augmentation was used since we want to achieve high spatial resolution."

Reference: Researchgate - Semantic Segmentation of Small Objects and Modeling of Uncertainty in Urban Remote Sensing Images Using Deep Convolutional Neural Networks



我知道我会用 Keras - ImageDataGenerator Class ,但不知道对小物体任务的语义分割使用哪些技术和参数。有人可以启发我吗?提前致谢。 :)
from keras.preprocessing.image import ImageDataGenerator

datagen = ImageDataGenerator(
rotation_range=20, # is a value in degrees (0–180)
width_shift_range=0.2, # is a range within which to randomly translate pictures horizontally.
height_shift_range=0.2, # is a range within which to randomly translate pictures vertically.
shear_range=0.2, # is for randomly applying shearing transformations.
zoom_range=0.2, # is for randomly zooming inside pictures.
horizontal_flip=True, # is for randomly flipping half the images horizontally
fill_mode='nearest', # is the strategy used for filling in newly created pixels, which can appear after a rotation or a width/height shift
featurewise_center=True,
featurewise_std_normalization=True)

datagen.fit(X_train)

最佳答案

扩充和预处理阶段始终取决于您遇到的问题。你必须考虑所有可以扩大你的数据集的可能的增强。但最重要的是,你不应该进行极端的增强,这会以真实示例中不可能发生的方式产生新的训练样本。如果您不期望真实示例会被水平翻转,请不要执行水平翻转,因为这会给您的模型提供错误信息。考虑输入图像中可能发生的所有变化,并尝试从现有图像人为地生成新图像。您可以使用 Keras 的许多内置函数。但是您应该注意,它不会生成新的示例,这些示例不太可能出现在您的模型输入中。

正如您所说,没有“一刀切”的解决方案,因为一切都取决于数据。分析数据并构建与之相关的一切。

关于小物体 - 您应该检查的一个方向是损失函数,它强调与背景相比目标体积的影响。查看 Dice Loss 或 Generalized Dice Loss。

关于python - 图像预处理和数据增强应该如何用于语义分割?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57133877/

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