How cvg/lightglue works
LightGlue is an inference library for matching sparse local features between two images. The main workflow loads images, extracts keypoints and descriptors with a selected feature backend, then passes both feature sets to the matcher, which returns corresponding-point indices and scores. The README documents SuperPoint, DISK, ALIKED, SIFT, and a convenience pair-matching API; the tree also includes DoGHardNet and visualization helpers. The matcher’s adaptive attention and pruning are implemented in its module. Some backend details and internal call paths were not sampled, so those relationships are omitted.
Main entry points: utils.py Extractor preprocessing · lightglue.py LightGlue matcher · sift.py SIFT · superpoint.py SuperPoint
Components 12
Input helpers
- Image utilities
lightglue/utils.py - Extractor preprocessing
lightglue/utils.py - Pair matching API
lightglue/utils.py
Feature extraction
- SuperPoint
lightglue/superpoint.py - DISK
lightglue/disk.py - ALIKED
lightglue/aliked.py - SIFT
lightglue/sift.py - DoGHardNet
lightglue/dog_hardnet.py
Feature matching
- LightGlue matcher
lightglue/lightglue.py
Visualization
- 2D visualization
lightglue/viz2d.py
Other components
- Application user
- Match results
Connections 13
- Application user → Image utilities: loads images
README.md - Image utilities → Application user: returns tensors
lightglue/utils.py - Application user → Extractor preprocessing: selects extractor
README.md - Extractor preprocessing → SuperPoint: preprocesses input
lightglue/superpoint.py - Extractor preprocessing → DISK: preprocesses input
lightglue/disk.py - Extractor preprocessing → ALIKED: preprocesses input
lightglue/aliked.py - Extractor preprocessing → SIFT: preprocesses input
lightglue/sift.py - SIFT → DoGHardNet: provides detections
lightglue/dog_hardnet.py - Application user → Pair matching API: calls convenience API
README.md - Pair matching API → LightGlue matcher: invokes matcher
lightglue/utils.py - Application user → LightGlue matcher: supplies feature pairs
README.md - LightGlue matcher → Match results: returns correspondences
README.md - Application user → 2D visualization: plots matches