Skip to main content
QUICK REVIEW

[Paper Review] Differentiable Data Augmentation with Kornia

Jian Shi, Edgar Riba|arXiv (Cornell University)|Nov 19, 2020
Advanced Neural Network ApplicationsComputer Science11 references8 citations
TL;DR

This paper introduces Kornia DDA, a PyTorch-native, differentiable data augmentation framework that integrates spatial and color transformations into neural network computation graphs for end-to-end backpropagation. By leveraging PyTorch's autograd and enabling optimization of augmentation parameters, Kornia DDA achieves GPU-accelerated, reproducible, and composable data augmentation pipelines, demonstrating superior performance under high-resource conditions and enabling novel approaches like differentiable augmentation policy search.

ABSTRACT

In this paper we present a review of the Kornia differentiable data augmentation (DDA) module for both for spatial (2D) and volumetric (3D) tensors. This module leverages differentiable computer vision solutions from Kornia, with an aim of integrating data augmentation (DA) pipelines and strategies to existing PyTorch components (e.g. autograd for differentiability, optim for optimization). In addition, we provide a benchmark comparing different DA frameworks and a short review for a number of approaches that make use of Kornia DDA.

Motivation & Objective

  • To address the limitation of non-differentiable data augmentation in deep learning by enabling gradient flow through augmentation operations.
  • To provide a PyTorch-native, modular, and composable API for differentiable data augmentation that integrates seamlessly with neural network training.
  • To enable optimization of augmentation hyperparameters (e.g., brightness, rotation) via backpropagation using standard PyTorch training workflows.
  • To benchmark Kornia DDA against established libraries like TorchVision and Albumentations under varying hardware and data conditions.
  • To demonstrate practical applications of differentiable augmentation in advanced tasks such as local feature learning and automated augmentation policy search.

Proposed method

  • Kornia DDA implements data augmentation as differentiable layers (e.g., RandomAffine, ColorJitter) that are integrated directly into the computation graph using PyTorch’s autograd engine.
  • The framework uses PyTorch’s nn.Module and nn.Parameter to allow differentiable parameters (e.g., brightness, contrast) to be optimized during backpropagation.
  • Transformations are implemented using differentiable operations such as grid_sample, enabling gradient computation through spatial and color space manipulations.
  • The framework supports both 2D and 3D tensors, with dedicated layers for volumetric data augmentation (e.g., CenterCrop3D, Affine3D).
  • Augmentation pipelines are constructed as modular, serializable components that can be saved and loaded with trained models using torch.save and torch.load.
  • The system enables on-device computation (CPU/GPU/TPU) and ensures reproducibility via PyTorch’s random seed control.

Experimental results

Research questions

  • RQ1Can differentiable data augmentation be efficiently integrated into PyTorch’s native training pipeline to enable end-to-end optimization of augmentation parameters?
  • RQ2How does Kornia DDA compare in performance to non-differentiable frameworks like TorchVision and Albumentations under varying hardware and data sizes?
  • RQ3To what extent can differentiable augmentation improve the learning of local feature descriptors through gradient-based optimization?
  • RQ4Can Kornia DDA enable effective automated augmentation policy search, such as in Faster AutoAugment or MADAO?
  • RQ5Does the differentiable nature of Kornia DDA allow for novel training paradigms, such as joint optimization of model and augmentation policies?

Key findings

  • Kornia DDA achieves superior inference speed compared to TorchVision and Albumentations when using 4 GPUs and larger image sizes (e.g., 512×512), with a 16.87s runtime vs. 18.99s and 16.12s for Albumentations and TorchVision, respectively.
  • The framework incurs negligible GPU memory overhead, making it suitable for deployment in high-performance training pipelines.
  • Kornia DDA enables a 20x reduction in code complexity—implementing complex differentiable transformations in 30 lines instead of ~600 lines of custom PyTorch code.
  • The optimized ColorJitter parameters after training were brightness: [0.8048, 0.8363], contrast: [0.7030, 0.7323], saturation: [0.5999, 0.5976], demonstrating successful gradient-based tuning.
  • Kornia DDA successfully supports end-to-end training of models with differentiable augmentation, enabling frameworks like Faster AutoAugment and MADAO to learn optimal augmentation policies via gradient descent.
  • The framework enables reproducible, device-agnostic, and serializable augmentation pipelines, enhancing model portability and experimental consistency.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.