Kornia
Kornia is a differentiable computer vision library for PyTorch, offering batched, GPU-accelerated operators for image processing, geometry, feature matching, augmentation, and pretrained models for spatial AI.
Visit kornia/korniaOverview
Kornia is a differentiable computer vision library built on PyTorch. It provides 1,200+ differentiable operators across geometry, feature matching, filtering, color, augmentation, losses, and pretrained models, with batched and device-agnostic execution for research and real-time perception on robots.
Key Features
- 1,200+ differentiable operators for geometry, feature matching, filtering, color, augmentation, losses, and pretrained models.
- Batched, device-agnostic operators that run where the tensor lives, with GPU acceleration.
- Differentiable geometry for warping, registration, camera models, homographies, Lie groups, RANSAC, and depth-to-3D.
- AugmentationSequential applies one sampled transform to images, masks, boxes, and keypoints together, in 2D or 3D.
- Pretrained model families include YuNet faces, RT-DETR objects, SAM masks, DexiNed edges, LoFTR, and LightGlue.
- Nearly all probed operator configurations run under torch.compile, and over 1,000 export to ONNX.
Use Cases
- Image matching, registration, stitching, denoising, face detection, and visual prompting workflows.
- Training AI models with complex 2D or 3D augmentation pipelines.
- Optimizing pose, depth, and camera parameters through differentiable geometry.
- Exporting vision operators to ONNX graphs for ONNX Runtime on CPU or CUDA.
Getting Started
- Install Kornia with pip install kornia.
- Use the browser playground, tutorials, and examples to explore workflows.
- Process a whole batch in one call, for example kornia.filters.sobel(images.cuda()).
Deployment & Requirements
- Built on PyTorch and integrates into PyTorch-based AI workflows.
- Operators run on the input tensor's device, allowing GPU execution when tensors are on the GPU.
- ONNX-exported graphs can run on ONNX Runtime on CPU or CUDA without Python.
- kornia-rs is available for edge devices.
Before You Adopt
- License: Apache-2.0. Review its terms before using, modifying, or distributing the project.
- On the small overlap with torchvision on the same GPU, eager Kornia is slower.
- CUDA and MPS half-precision are not covered by CI, and CPU half-precision results do not establish support on those backends.