A collection of information about Data Augmentation libraries for Image Processing.

Kornia

last updated on 10/10/2023

Supported languages:
  • Python
Supported ML libraries:
  • PyTorch
kornia
kornia
augmentation
augmentation
color
color
contrib
contrib
enhance
enhance
feature
feature
filters
filters
geometry
geometry
losses
losses
morphology
morphology
utils
utils
Text is not SVG - cannot display
Transformations Description Tags
1.

from kornia.enhance

Calculates the weighted sum of two image tensors.

MIXED SAMPLE
Original Augmented
out = K.enhance.AddWeighted(0.5, 0.5, 0)(img, img_2)
2.

from kornia.enhance

Adjusts log correction on the input image. Reference,

PHOTOMETRY
Original Augmented
aug = K.enhance.AdjustLog(gain=0.5, inv=False, clip_output=True)
Original Augmented
aug = K.enhance.AdjustLog(gain=1.3, inv=False, clip_output=True)
Original Augmented
aug = K.enhance.AdjustLog(gain=0.5, inv=True, clip_output=True)
Original Augmented
aug = K.enhance.AdjustLog(gain=1.3, inv=True, clip_output=True)
3.

from kornia.enhance

Adjusts the contrast of the image or performs sigmoid correction on the input image. Reference.

PHOTOMETRY
Original Augmented
aug = K.enhance.AdjustSigmoid(cutoff=0.35, gain=7, inv=False)
Original Augmented
aug = K.enhance.AdjustSigmoid(cutoff=0.45, gain=7, inv=False)
4.

from kornia.augmentation.auto

Applies AutoAugment searched strategies.

Original Augmented
Original Augmented
aug = K.augmentation.auto.AutoAugment(policy='imagenet')
5.

from kornia.filters

Blurs an image using a Bilateral filter.

BLUR
Original Augmented
aug = K.filters.BilateralBlur(kernel_size=(5, 5), sigma_color=2.0, sigma_space=(1.5, 1.5))
6.

from kornia.filters

Computes blur (anti-aliasing) and downsamples a given feature map. Reference.

BLUR
Original Augmented
aug = K.filters.BlurPool2D(kernel_size=5, stride=3)
7.

from kornia.augmentation

Crops a given image at the center.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.CenterCrop(size=(1000,1000), p=1.0, cropping_mode='slice')
8.

from kornia.augmentation

Applies a random transformation to the brightness, contrast, saturation and hue of an image.

PHOTOMETRY
Original Augmented
Original Augmented
aug = K.augmentation.ColorJiggle(brightness=0.2, contrast=0.1, saturation=0.4, hue=0.1, p=1.0)
9.

from kornia.augmentation

Applies a random transformation to the brightness, contrast, saturation and hue of an image.

PHOTOMETRY
Original Augmented
Original Augmented
aug = K.augmentation.ColorJitter(brightness=0.2, contrast=0.1, saturation=0.4, hue=0.1, p=1.0)
10.

from kornia.filters

Blurs an image using a Guided filter.

BLUR
11.

from kornia.filters

Blurs an image using a Joint Bilateral filter.

BLUR
12.

from kornia.augmentation

Rescales an image so that maximum side is equal to max_size, keeping the aspect ratio of the initial image.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.LongestMaxSize(max_size=400, p=1.0)
13.

from kornia.filters

Computes pools and blurs and downsamples a given feature map.

BLUR
Original Augmented
aug = K.filters.MaxBlurPool2D(kernel_size=(5, 5))
14.

from kornia.augmentation

Pads the given sample to a specific size.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.PadTo(size=(2000, 1500), pad_mode='constant', pad_value=0.5)
Original Augmented
aug = K.augmentation.PadTo(size=(1500, 2000), pad_mode='constant', pad_value=0.5)
15.

from kornia.augmentation.auto

Applies RandAugment augmentation strategies.

Original Augmented
Original Augmented
aug = K.augmentation.auto.RandAugment(n=3, m=15)
16.

from kornia.augmentation

Applies a random 2D affine transformation to an image.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.RandomAffine(degrees=(20, 20), translate=(0.2, 0.3), scale=None, shear=None, padding_mode='reflection', p=1)
17.

from kornia.augmentation

Adds random blur with a box filter to an image.

BLUR
Original Augmented
aug = K.augmentation.RandomBoxBlur(kernel_size=(15, 15), p=1)
18.

from kornia.augmentation

Applies a random transformation to the brightness of an image.

PHOTOMETRY
Original Augmented
Original Augmented
aug = K.augmentation.RandomBrightness(brightness=(0.7, 1.3), p=1.0)
19.

from kornia.augmentation

Shuffles the channels of a batch of multi-dimensional images.

PHOTOMETRY
Original Augmented
Original Augmented
aug = K.augmentation.RandomChannelShuffle(p=1)
20.

from kornia.augmentation

Applies a random transformation to the contrast of an image.

PHOTOMETRY
Original Augmented
Original Augmented
aug = K.augmentation.RandomContrast(contrast=(0.8, 1.2), p=1.0)
21.

from kornia.augmentation

Crops random patches of an image on a given size.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.RandomCrop(size=(1880, 1200), padding=(100, 0), fill=200, padding_mode='constant', p=1.0, cropping_mode='slice')
22.

from kornia.augmentation

Implementation for CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features.

MIXED SAMPLE
Original Augmented
aug = K.augmentation.RandomCutMixV2()
out = aug(images, labels)
23.

from kornia.augmentation

Adds random elastic transformation to an image.

DISTORTION
Original Augmented
aug = K.augmentation.RandomElasticTransform(kernel_size=(63, 63), sigma=(32.0, 32.0), alpha=(1.0, 1.0), padding_mode='zeros', p=1)
24.

from kornia.augmentation

Equalizes given image(s) randomly.

PHOTOMETRY
Original Augmented
aug = K.augmentation.RandomEqualize(p=1)
25.

from kornia.augmentation

Erases a random rectangle of an image according to a probability p value.

DROPOUT
Original Augmented
aug = K.augmentation.RandomErasing(scale=(0.02, 0.33), ratio=(0.3, 3.3), value=0.0, p=1)
26.

from kornia.augmentation

Adds random camera radial distortion.

DISTORTION
Original Augmented
center_x = torch.tensor([-.3, .3])
center_y = torch.tensor([-.3, .3])
gamma = torch.tensor([.9, 1.])
aug = K.augmentation.RandomFisheye(center_x, center_y, gamma, p=1)
27.

from kornia.augmentation

Applies a random transformation to the gamma of an image.

PHOTOMETRY
Original Augmented
aug = K.augmentation.RandomGamma(gamma=(0.75, 0.75), gain=(1.0, 1.0), p=1.0)
Original Augmented
aug = K.augmentation.RandomGamma(gamma=(0.75, 0.75), gain=(1.5, 1.5), p=1.0)
Original Augmented
aug = K.augmentation.RandomGamma(gamma=(1.2, 1.2), gain=(1.5, 1.5), p=1.0)
28.

from kornia.augmentation

Applies gaussian blur given image(s) randomly. The standard deviation is sampled for each instance.

BLUR
Original Augmented
aug = K.augmentation.RandomGaussianBlur(kernel_size=(11, 11), sigma=(2.5, 2.5), p=1)
29.

from kornia.augmentation

Adds gaussian noise.

NOISE
Original Augmented
aug = K.augmentation.RandomGaussianNoise(mean=0.0, std=0.5, p=1)
30.

from kornia.augmentation

Applies random transformation to Grayscale according to a probability p value.

PHOTOMETRY
Original Augmented
aug = K.augmentation.RandomGrayscale(p=1)
31.

from kornia.augmentation

Applies a random horizontal flip to image(s) with a given probability.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.RandomHorizontalFlip(p=1)
32.

from kornia.augmentation

Applies a random transformation to the hue of an image.

PHOTOMETRY
Original Augmented
Original Augmented
aug = K.augmentation.RandomHue(hue=(-0.5, 0.5), p=1.0)
33.

from kornia.augmentation

Inverts the images values randomly.

PHOTOMETRY
Original Augmented
aug = K.augmentation.RandomInvert(max_val=torch.tensor(1.0), p=1)
34.

from kornia.augmentation

RandomJigsaw augmentation.

MIXED SAMPLE
Original Augmented
aug = K.augmentation.RandomJigsaw(grid=(2, 2), p=1)
35.

from kornia.augmentation

Adds random blur with a median filter to an image.

BLUR
Original Augmented
aug = K.augmentation.RandomMedianBlur(kernel_size=(5, 5), p=1)
36.

from kornia.augmentation

Implementation for mixup: BEYOND EMPIRICAL RISK MINIMIZATION.

MIXED SAMPLE
Original Augmented
aug = K.augmentation.RandomMixUpV2()
out = aug(images, labels)
37.

from kornia.augmentation

Mosaic augmentation.

MIXED SAMPLE
Original Augmented
aug = K.augmentation.RandomMosaic(p=1)
38.

from kornia.augmentation

Performs motion blur on 2D images (4D tensor).

BLUR
Original Augmented
aug = K.augmentation.RandomMotionBlur(kernel_size=(15, 15), angle=(10, 10), direction=1.0, p=1)
39.

from kornia.augmentation

Applies a random perspective transformation to an image with a given probability.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.RandomPerspective(distortion_scale=0.5, p=1, sampling_method='basic')
40.

from kornia.augmentation

Applies planckian jitter transformation.

PHOTOMETRY
Original Augmented
Original Augmented
aug = K.augmentation.RandomPlanckianJitter(mode='blackbody', select_from=None, p=1)
41.

from kornia.augmentation

Adds brightness to the image based on a fractal map generated by the diamond square algorithm. Based on TorMentor: Deterministic dynamic-path, data augmentations with fractals.

Original Augmented
Original Augmented
aug = K.augmentation.RandomPlasmaBrightness(roughness=(0.1, 0.7), intensity=(0.0, 1.0), p=1)
42.

from kornia.augmentation

Adds contrast to the image based on a fractal map generated by the diamond square algorithm. Based on TorMentor: Deterministic dynamic-path, data augmentations with fractals.

Original Augmented
Original Augmented
aug = K.augmentation.RandomPlasmaContrast(roughness=(0.1, 0.7), p=1)
43.

from kornia.augmentation

Adds a particular shadow. Based on TorMentor: Deterministic dynamic-path, data augmentations with fractals.

Original Augmented
Original Augmented
aug = K.augmentation.RandomPlasmaShadow(roughness=(0.1, 0.7), shade_intensity=(-1.0, 0.0),
                                        shade_quantity=(0.0, 1.0), p=1)
44.

from kornia.augmentation

Posterizes given image(s) randomly.

STYLE FILTER
Original Augmented
Original Augmented
aug = K.augmentation.RandomPosterize(bits=3, p=1)
45.

from kornia.augmentation

Randomly shifts each channel of an image.

PHOTOMETRY
Original Augmented
aug = K.augmentation.RandomRGBShift(r_shift_limit=0.2, g_shift_limit=0.2, b_shift_limit=0.2, p=1)
46.

from kornia.augmentation

Adds random rain to the image.

WEATHER
Original Augmented
aug = K.augmentation.RandomRain(p=1, number_of_drops=(20000, 20000),
                                drop_height=(5, 20), drop_width=(-5, 5))
47.

from kornia.augmentation

Crops random patches in an image and resizes to a given size.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.RandomResizedCrop(size=(1800, 1200), scale=(0.08, 1.0),
                                       ratio=(3.0 / 4.0, 4.0 / 3.0), p=1.0,
                                       cropping_mode='slice')
48.

from kornia.augmentation

Applies a random rotation to image(s) given an amount of degrees.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.RandomRotation(degrees=(-15,-15), p=1)
49.

from kornia.augmentation

Applies a random transformation to the saturation of an image.

PHOTOMETRY
Original Augmented
Original Augmented
aug = K.augmentation.RandomSaturation(saturation=(0.5, 2), p=1.0)
50.

from kornia.augmentation

Sharpens given image(s) randomly.

SHARPNESS
Original Augmented
aug = K.augmentation.RandomSharpness(sharpness=(7, 7), p=1)
51.

from kornia.augmentation

Generates snow effect on given image(s).

WEATHER
Original Augmented
aug = K.augmentation.RandomSnow(snow_coefficient=(0.5, 0.5), brightness=(2, 2), p=1.0)
52.

from kornia.augmentation

Solarizes given image(s) randomly.

PHOTOMETRY
Original Augmented
Original Augmented
aug = K.augmentation.RandomSolarize(thresholds=0.1, additions=0.1, p=1)
53.

from kornia.augmentation

Adds random noise to the Thin Plate Spline algorithm.

DISTORTION
Original Augmented
Original Augmented
aug = K.augmentation.RandomThinPlateSpline(p=1)
54.

from kornia.augmentation

Applies a random vertical flip to image(s) with a given probability.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.RandomVerticalFlip(p=1)
55.

from kornia.augmentation

Resizes to size.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.Resize(size=(280), side='short', p=1.0)
56.

from kornia.color

Applies the sepia filter to the image.

PHOTOMETRY
Original Augmented
# assuming input image as BGR

aug = K.color.Sepia(rescale=False)
out = aug(img)
out = K.color.bgr_to_rgb(out)
57.

from kornia.augmentation

Rescales an image so that minimum side is equal to max_size, keeping the aspect ratio of the initial image.

BASIC GEOMETRY
Original Augmented
aug = K.augmentation.SmallestMaxSize(max_size=300, p=1.0)
58.

from kornia.augmentation.auto

Applies TrivialAugment augmentation strategies.

Original Augmented
Original Augmented
aug = K.augmentation.auto.TrivialAugment(policy=None)
59.

from kornia.filters

Creates an operator that sharpens image.

SHARPNESS
Original Augmented
aug = K.filters.UnsharpMask(kernel_size=(9, 9), sigma=(1.5, 1.5))
60.

from kornia.enhance

61.

from kornia.morphology

Returns the closed image (erosion after a dilation), applying the same kernel in each channel.

MORPHOLOGY
Original Augmented
img = img[None, :]
kernel = torch.ones(7, 7)
out = K.morphology.closing(img, kernel)
62.

from kornia.morphology

Returns the dilated image applying the same kernel in each channel.

MORPHOLOGY
Original Augmented
img = img[None, :]
kernel = torch.ones(7, 7)
out = K.morphology.dilation(img, kernel)
63.

from kornia.morphology

Returns the eroded image applying the same kernel in each channel.

MORPHOLOGY
Original Augmented
img = img[None, :]
kernel = torch.ones(7, 7)
out = K.morphology.erosion(img, kernel)
64.

from kornia.morphology

Returns the opened image (dilation after an erosion), applying the same kernel in each channel.

MORPHOLOGY
Original Augmented
img = img[None, :]
kernel = torch.ones(7, 7)
out = K.morphology.opening(img, kernel)