Albumentations to Kornia Transform Mapping

On this page

This page maps Albumentations transforms to Kornia equivalents where Kornia has a direct benchmark implementation. The benchmark source of truth is benchmark/transforms/kornia_impl.py, with shared canonical parameters in benchmark/transforms/specs.py.

If the Kornia column is -, the benchmark has no direct Kornia implementation for that Albumentations transform. Kornia still has useful lower-level tensor and geometry APIs; the table is about direct augmentation primitives used by the benchmark.

Migration Rules

  • Albumentations expects NumPy arrays, usually per sample as H,W,C.
  • Kornia expects PyTorch tensors, usually batched as B,C,H,W.
  • Kornia often exposes same_on_batch, p_batch, align_corners, keepdim, and tensor interpolation settings.
  • Albumentations exposes target-aware behavior through A.Compose.
  • RGB/color-space transforms are not arbitrary-channel transforms in either library.

Color and Pixel Transforms

Albumentations transformKornia transformNotes
ColorJitterColorJitter / ColorJiggleSimilar brightness, contrast, saturation, and hue concept. Defaults and color math differ.
AutoContrastRandomAutoContrastAlbumentations adds normal pipeline probability and mask options where supported.
BlurRandomBoxBlurKornia uses fixed kernel tuples; Albumentations uses blur_range.
RandomBrightnessContrastRandomBrightness / RandomContrastKornia exposes brightness and contrast as separate transforms; Albumentations commonly combines them.
ChannelDropoutRandomChannelDropoutBoth drop channels; verify semantics for non-RGB channel stacks.
ChannelShuffleRandomChannelShuffleSame idea. Only valid when channel order is exchangeable for your data.
CLAHERandomClaheDefaults differ; Albumentations uses clip_limit and tile_grid_size.
EqualizeRandomEqualizeAlbumentations exposes mode, by_channels, and mask parameters.
RandomGammaRandomGammaKornia uses gamma as a float; Albumentations uses percentage-like gamma_range.
GaussianBlurRandomGaussianBlurSimilar concept with different kernel/sigma parameterization.
GaussNoiseRandomGaussianNoiseAlbumentations has dtype-aware scaling, ranges, and per-channel options.
ToGrayRandomGrayscaleKornia is RGB-oriented; Albumentations has multiple grayscale methods and configurable output channels.
HueSaturationValue / ColorJitterRandomHue / RandomSaturationKornia exposes hue and saturation separately; Albumentations offers HSV and jitter-style APIs.
InvertImgRandomInvertAlbumentations determines max value from dtype.
ImageCompressionRandomJPEGAlbumentations supports JPEG and WebP.
MedianBlurRandomMedianBlurAlbumentations enforces odd kernel sizes.
MotionBlurRandomMotionBlurParameter ranges differ.
PlanckianJitterRandomPlanckianJitterSimilar physics-based color-temperature concept. RGB-specific.
PosterizeRandomPosterizeAlbumentations supports per-channel and ranged bit settings.
RGBShift / AdditiveNoiseRandomRGBShiftRGBShift is direct RGB-style behavior; AdditiveNoise is the broader noise primitive.
SaltAndPepperRandomSaltAndPepperNoiseSimilar salt-and-pepper corruption.
SharpenRandomSharpnessDifferent parameterization and implementation methods.
RandomSnowRandomSnowAlbumentations exposes multiple snow methods and richer simulation controls.
SolarizeRandomSolarizeThreshold handling differs.
NormalizeNormalizeAlbumentations normalizes arrays; Kornia normalizes tensors.
ErasingRandomErasingAlbumentations adds mask fill and inpainting options.
Colorize-No direct Kornia benchmark implementation.
Dithering-No direct Kornia benchmark implementation.
Downscale-No direct Kornia benchmark implementation for downscale-upscale degradation.
PixelSpread-No direct Kornia benchmark implementation.
Emboss-No direct Kornia benchmark implementation.
ChromaticAberration-No direct Kornia benchmark implementation.
ISONoise-No direct Kornia benchmark implementation.
ShotNoise-No direct Kornia benchmark implementation.
MultiplicativeNoise-No direct Kornia benchmark implementation.
RandomToneCurve-No direct Kornia benchmark implementation.
RingingOvershoot-No direct Kornia benchmark implementation.
Spatter-No direct Kornia benchmark implementation.
UnsharpMask-No direct Kornia benchmark implementation.
FancyPCA-No direct Kornia benchmark implementation.
Superpixels-No direct Kornia benchmark implementation.
ToSepia-No direct Kornia benchmark implementation.

Illumination, Weather, and Procedural Effects

Albumentations transformKornia transformNotes
Illumination with linear modeRandomLinearIlluminationSimilar concept, different parameters.
Illumination with corner modeRandomLinearCornerIlluminationSimilar concept, different parameters.
Illumination with Gaussian modeRandomGaussianIlluminationSimilar concept, different parameters.
PlasmaBrightnessContrastRandomPlasmaBrightness / RandomPlasmaContrastAlbumentations combines brightness and contrast variants.
PlasmaShadowRandomPlasmaShadowSimilar fractal shadow concept.
RandomRainRandomRainAlbumentations exposes slant, blur, brightness, and rain presets.
RandomFog-No direct Kornia benchmark implementation.
RandomShadow-No direct Kornia benchmark implementation.
RandomSunFlare-No direct Kornia benchmark implementation.
RandomGravel-No direct Kornia benchmark implementation.
AtmosphericFog-No direct Kornia benchmark implementation.
Vignetting-No direct Kornia benchmark implementation.
FilmGrain-No direct Kornia benchmark implementation.
Halftone-No direct Kornia benchmark implementation.
LensFlare-No direct Kornia benchmark implementation.
GridMask-No direct Kornia benchmark implementation.
WaterRefraction-No direct Kornia benchmark implementation.

Geometric Transforms

Albumentations transformKornia transformNotes
ResizeResizeKornia works on tensors; Albumentations works on arrays and targets.
LongestMaxSizeLongestMaxSizeAspect-ratio preserving resize by longest side.
SmallestMaxSizeSmallestMaxSizeAspect-ratio preserving resize by shortest side.
CenterCropCenterCropAlbumentations can pad small images and update targets.
RandomCropRandomCropAlbumentations updates masks, boxes, and keypoints.
AffineRandomAffine / RandomShearAlbumentations models shear as part of affine transformation.
ElasticTransformRandomElasticTransformSimilar concept; parameterization differs.
OpticalDistortionRandomFisheyeSimilar fisheye goal, different distortion models and parameters.
HorizontalFlipRandomHorizontalFlipAlbumentations updates supported targets; Kornia exposes batch controls.
PerspectiveRandomPerspectiveKornia exposes align_corners and tensor settings; Albumentations exposes border/fill/mask behavior.
RandomResizedCropRandomResizedCropSimilar policy with different implementation details.
RandomRotate90RandomRotation90Similar 90-degree rotation policy.
RotateRandomRotationAlbumentations has explicit bbox rotation options and crop behavior.
ThinPlateSplineRandomThinPlateSplineSimilar smooth non-rigid deformation; control-point configuration differs.
VerticalFlipRandomVerticalFlipAlbumentations updates supported targets; Kornia exposes batch controls.
Pad-No direct Kornia benchmark implementation.
PadIfNeeded-No direct Kornia benchmark implementation for padding to minimum size constraints.
SquareSymmetry-No direct Kornia benchmark implementation for the full 8-way square symmetry group.
Transpose-No direct Kornia benchmark implementation.
SafeRotate-No direct Kornia benchmark implementation for rotation that preserves full image content.
RandomScale-No direct Kornia benchmark implementation.
ShiftScaleRotate-No direct Kornia benchmark implementation for the combined augmentation primitive.
GridDistortion-No direct Kornia benchmark implementation for grid-based non-rigid distortion.
RandomGridShuffle-No direct Kornia benchmark implementation.
Morphological-No direct Kornia benchmark implementation for morphology operations.
CropAndPad-No direct Kornia benchmark implementation.
RandomSizedCrop-No direct Kornia benchmark implementation.

Dropout and Annotation-Aware Transforms

Albumentations transformKornia transformNotes
CoarseDropout-No direct Kornia benchmark implementation for the Albumentations multi-hole dropout primitive.
GridDropout-No direct Kornia benchmark implementation.
PixelDropout-No direct Kornia benchmark implementation.
ConstrainedCoarseDropout-No direct Kornia benchmark implementation for object-constrained dropout.
CopyAndPaste-No direct Kornia benchmark implementation for annotation-aware copy-paste.

Channel Notes

Kornia and Albumentations can both operate on non-RGB tensors/arrays for many channel-agnostic transforms. The trap is color semantics: RGBShift, HueSaturationValue, ColorJitter, PlanckianJitter, RandomRain, and RandomSnow are RGB/color transforms.

Blur, crop, resize, flip, affine, perspective, noise, dropout, and normalization are usually safer for arbitrary-channel data. For medical, hyperspectral, remote-sensing, or sensor-fusion inputs, document whether each channel is exchangeable, geometric-only, or color-like before choosing transforms.

Migration Example

import albumentations as A

pipeline = A.Compose([
    A.HorizontalFlip(p=0.5),
    A.Rotate(angle_range=(-15, 15), p=0.5),
    A.GaussNoise(std_range=(0.05, 0.2), p=0.2),
])

For annotation-aware pipelines:

pipeline = A.Compose(
    [
        A.RandomCrop(height=512, width=512, p=1.0),
        A.HorizontalFlip(p=0.5),
    ],
    bbox_params=A.BboxParams(coord_format="pascal_voc", label_fields=["labels"]),
)

Benchmark Pages