赞
踩
物体在图像中的清晰度取决于场景照明和相机灵敏度。通过随机增加或减少图像亮度来增加输入图像的虚拟变化,改善了网络的照明不变形。对比度就是图像中最暗和最亮区域之间的分隔。通过随机增强来增加这个范围有助于增加对阴影的不变形,并且通常会提高网络在低光照条件下的性能。
from albumentations import (
Compose,
RandomBrightnessContrast
)
aug = Compose([RandomBrightnessContrast(brightness_limit=(0, 0.4), contrast_limit=(0, 0.4), p=1)])
augmented = aug(image=image, mask=gt)
image_bright_contrast = augmented['image']
gt_bright_contrast = augmented['mask']
色调的取值范围是0-360度,用来表示颜色的类别,其中红色是0度,绿色是120度,蓝色是240度。饱和度高,颜色则深而艳。
from albumentations import (
Compose,
HueSaturationValue
)
aug = Compose([HueSaturationValue(hue_shift_limit=20,
sat_shift_limit=30,
val_shift_limit=20,
p=1)])
augmented = aug(image=image, mask=gt)
image_hsv = augmented['image']
gt_hsv = augmented['mask']
对图像进行模糊可以模拟部分拍摄场景的运动模糊,让网络对模糊图像的边界也具有较强的识别能力。
from albumentations import (
Compose,
MotionBlur
)
aug = Compose([MotionBlur(blur_limit=7, p=1.0)])
augmented = aug(image=image, mask=gt)
image_MotionBlur = augmented['image']
gt_MotionBlur = augmented['mask']
向每个RGB像素添加小的随机噪声有助于获得对一些相机失真的不变形。
from albumentations import (
Compose,
RGBShift
)
aug = Compose([RGBShift(r_shift_limit=20,
g_shift_limit=20,
b_shift_limit=20,
p=1.0)])
augmented = aug(image=image, mask=gt)
image_rgbshift = augmented['image']
gt_rgbshift = augmented['mask']
随机将图像上某个超像素块内的颜色替换为超像素的均值。
from albumentations import Compose
from albumentations.imgaug.transforms import IAASuperpixels
aug = Compose([IAASuperpixels(p_replace=0.1,
n_segments=500,
p=1)])
augmented = aug(image=image, mask=gt)
image_Superpixels = augmented['image']
gt_Superpixels = augmented['mask']
增强图像细节。
from albumentations import Compose
from albumentations.imgaug.transforms import IAASharpen
aug = Compose([IAASharpen(p=1)])
augmented = aug(image=image, mask=gt)
image_Sharpen = augmented['image']
gt_Sharpen = augmented['mask']
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。