kornia/kornia

🐍 Geometric Computer Vision Library for Spatial AI

What it solves

Kornia solves the problem of building computer vision pipelines that need to be differentiable and GPU-accelerated. In deep learning, you often want to apply image operations (like blurring, warping, or augmentations) inside a neural network where gradients need to flow backward. Traditional CV libraries are not designed for that. Kornia provides hundreds of differentiable image processing and geometric vision operators that plug directly into PyTorch, so you can train models that learn to transform or understand images.

How it works

Kornia is built on top of PyTorch. Every operator is implemented as a PyTorch module or function, so it supports automatic differentiation, batched processing, and GPU acceleration out of the box. The library is organized into modules such as filters, color conversions, geometry (homography, camera models, epipolar geometry), augmentation sequences, feature detection and matching, and deep learning layers. It also includes pre-trained models for tasks like face detection, feature matching, and segmentation. Recent additions include ONNX model chaining and Stable Diffusion-based dissolving operations. The project also has an explicit testing and conformance framework, tracking half-precision (float16/bfloat16) support and CUDA behavior across modules.

Who it's for

Kornia is for researchers and engineers working in computer vision and deep learning with PyTorch. It suits anyone who needs differentiable image transforms, geometric operations, augmentation pipelines, or pre-trained vision models inside a neural network training loop.

Highlights

  • Over 500 differentiable operations across filtering, color, geometry, morphology, augmentation, and more
  • Seamless integration with PyTorch: auto-differentiation, batching, and GPU acceleration
  • Pre-trained models including YuNet (face detection), LoFTR and LightGlue (feature matching), SAM (segmentation), and Vision Transformers
  • Advanced augmentation pipelines: sequential, patch-based, video, and automatic methods like AutoAugment and RandAugment
  • ONNX support for chaining and exporting models
  • Extensive half-precision (float16/bfloat16) testing infrastructure with known-failure manifests to track support
  • Open-source with a roadmap to become the reference implementation for differentiable CV and geometry in the PyTorch ecosystem

Related

  • Project
  • Project
  • Project
  • Project
  • Project