DISK + LightGlue for Kornia
lightweight image matching on CPU
2 min readupdated
This package combines the DISK keypoint detector and the LightGlue matching algorithm into a single lightweight model.safetensors weights file for the Kornia computer vision library. It aligns overlapping photos and computes the homography matrix (the geometric transformation mapping one frame onto the plane of another) directly on the CPU. Unlike Kornia's default setup, which downloads 52.01 MB and stores everything in float32, the matcher weights here are converted to float16 (half precision), shrinking the download to 28.17 MB without losing registration accuracy. Ideal for developers building photogrammetry pipelines, panorama stitching, and local navigation on memory- or bandwidth-constrained devices.
Key features
- Compact weights size: The file takes up 28.17 MB compared to 52.01 MB for the standard DISK and LightGlue checkpoints in Kornia.
- Hybrid precision storage: The DISK detector is stored in float32 and the LightGlue matcher in float16; during inference, Kornia runs both modules in float32.
- Preserved accuracy on HPatches: Successfully matched 60 out of 72 image pairs within a 5-pixel error threshold, retaining all 58 successful matches from the original version.
- Runs on CPU: The model card example was tested on an Arm Mac processor and requires no discrete GPU.
What you can do
- Align overlapping frames: Detect shared keypoints between two photos of the same scene and calculate the homography matrix to warp and align them.
- Stitch panoramas and maps: Run feature matching inside panorama-stitching or aerial-mapping pipelines on lightweight servers and single-board computers without a GPU.
- Speed up CV deployments: Cut cold-start times and reduce artifact download sizes in Kornia Docker containers using a single
safetensorsfile.
Example
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
import kornia.feature as features
path = hf_hub_download("strangelab/disk-lightglue-kornia-fp16-storage", "model.safetensors")
weights = load_file(path)
detector = features.DISK().eval()
matcher = features.LightGlue(features=None, input_dim=128).eval()
Read more
DetailsParameters: ~0.01B (10M), weights file size: 28.17 MB.
HPatches benchmark (640×480 resolution, mean corner projection error < 5 px): 60/72 pairs (vs. 58/72 for stock); on a 24-pair control subset, both versions solved 22.
Tested on Python 3.12 with torch 2.8.0, kornia 0.8.2, and safetensors 0.8.0 on an Arm Mac CPU.
Limitation: This checkpoint only works with Kornia and is not compatible with the Transformers library loader.










Comments