Kornia: Differentiable Computer Vision for PyTorch#

pip install kornia

Computer vision for
robotics & Spatial AI.

Why Kornia?

RandomGaussianBlur · batch 32 · I7 14700K Rtx 4090 CPU 1,544 img/s GPU 47,015 img/s · 30.5× faster items/s, eager mode — committed benchmark run, kornia 0.9.0rc1 / torch 2.14.0+cu130
edges = kornia.filters.sobel(images.cuda())  # whole batch, one call

Same code, any device. Operators run wherever the tensor lives — no flags, no per-image loops.

See details

Two images progressively aligned by gradient descent

gradient descent on a homography

warped = warp_perspective(src, H, size) loss = (warped - dst).abs().mean() loss.backward(); optimizer.step()

repeat until aligned

Registration by pure gradient descent. Gradients flow through every operator, so vision ops can sit inside your model or your loss — no labels, no training data.

See details

PyTorch module → ONNX graph → one deployable file kornia module RgbToGrayscale() torch.onnx gray.onnx ONNXSequential + hf://…/Resize_512x512 runs on ONNX Runtime CPU CUDA no Python needed
torch.onnx.export(kornia.color.RgbToGrayscale(), (x,), "gray.onnx", dynamo=True)

Export once, run anywhere ONNX Runtime does — chained with Hub-hosted operators into one graph.

See details

Kornia is a non-profit building the stack for spatial AI — from differentiable vision for research to real-time perception on robots — maintained by a small team and funded by the people who use it.

Features#

1,200+ differentiable operators — functions and nn.Module layers, batched and device-agnostic — across geometry, feature matching, filtering, color, augmentation, losses and pretrained models. Six places to start below; the full map is the API reference.

Prefer to learn by example? Image matching, registration, stitching, denoising, face detection and visual prompting each walk through one task end to end — and Conventions & pitfalls is the one page to read before writing code.

Support

Sponsor

Official Links

Twitter LinkedIn Newsletter (under construction)

Official libs

kornia kornia-rs