kornia: A differentiable computer vision library for image processing and geometric vision in PyTorch workflows.
What problem it solves
AI workflows need image-processing and geometric-vision routines that integrate with PyTorch while preserving differentiability. Hand-written implementations can become long or fragile, while implementations that leave the GPU can limit batched workflows.
Key features
Differentiable image processing — The library provides image-processing operators for filters, transformations, enhancements, edge detection, morphology, color, and losses, with many designed for integration into deep-learning pipelines.
Source: README, kornia
Geometric vision and robust estimation — Its geometry components cover camera models, epipolar geometry, pose estimation, depth projection, homography, Lie groups, minimal solvers, and device-side RANSAC estimation.
Source: README
Annotated augmentation pipelines — AugmentationSequential applies one sampled transform consistently to images, masks, boxes, and keypoints. Its 2D pipelines can also be inverted.
Source: README
Local feature detection and matching — The feature component includes local detectors and descriptors, along with mutual-nearest-neighbor and ratio-test matchers for image correspondence.
Source: README
Compilation and ONNX export — Operator configurations are tested with torch.compile, and the library also supports exporting operators to ONNX through dedicated interfaces.
Source: README, kornia
Quick start
Copied verbatim from the project's README.
pip install kornia pip install -e .import numpy as np
import kornia_rs as kr
from kornia.augmentation import AugmentationSequential, RandomAffine, RandomBrightness
from kornia.filters import StableDiffusionDissolving
# Load and prepare your image
img: np.ndarray = kr.read_image_any("img.jpeg")
img = kr.resize(img, (256, 256), interpolation="bilinear")
# alternatively, load image with PIL
# img = Image.open("img.jpeg").resize((256, 256))
# img = np.array(img)
img = np.stack([img] * 2) # batch images
# Define an augmentation pipeline
augmentation_pipeline = AugmentationSequential(RandomAffine((-45.0, 45.0), p=1.0), RandomBrightness((0.0, 1.0), p=1.0))
# Leveraging StableDiffusion models
dslv_op = StableDiffusionDissolving()
img = augmentation_pipeline(img)
dslv_op(img, step_number=500)
dslv_op.save("Kornia-enhanced.jpg")Who it may suit
This may suit PyTorch developers and researchers building differentiable image-processing, augmentation, geometric-vision, feature-matching, or ONNX-export workflows.
Topics to discuss
Which geometric-vision contracts should receive additional conformance tests and reference implementations?
How should the community organize coverage for CUDA and MPS half-precision support?
Which augmentation and image-processing workflows would benefit from new annotated pipeline capabilities?
Written by ReadmeX AI from the project's README, source and public GitHub data; it may contain mistakes.
Read the original README https://github.com/kornia/kornia#readme
ReadmeX opened this community for a trending project; it is not run by the project. Maintainers can claim it from the community page.
Comments
…