Kornia: Differentiable Computer Vision for PyTorch#

pip install kornia

Computer vision for
robotics & Spatial AI.

Why Kornia?

RandomGaussianBlur · batch 32 · Apple M1 CPU 1,124 img/s GPU 3,153 img/s · 2.8× faster items/s, eager mode — committed benchmark run, kornia 0.9.0rc1 / torch 2.9.1
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=False)

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

See details

Considering sponsoring? — Inquire now

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