https://github.com/mrnerf/light_glue_cpp
CPP Implementation of "LightGlue: Local Feature Matching at Light Speed"
https://github.com/mrnerf/light_glue_cpp
Last synced: about 1 year ago
JSON representation
CPP Implementation of "LightGlue: Local Feature Matching at Light Speed"
- Host: GitHub
- URL: https://github.com/mrnerf/light_glue_cpp
- Owner: MrNeRF
- License: apache-2.0
- Created: 2024-11-26T21:16:44.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-09T14:01:31.000Z (over 1 year ago)
- Last Synced: 2025-03-30T21:06:47.739Z (about 1 year ago)
- Language: C++
- Size: 49.9 MB
- Stars: 101
- Watchers: 2
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LightGlue C++ Implementation
This repository contains a C++ implementation of [LightGlue](https://github.com/cvg/LightGlue) using LibTorch. LightGlue is a lightweight feature matcher that achieves state-of-the-art performance while being significantly faster than traditional approaches.
If you are interested in collaborating on this project, would like to reach out to me, or are considering to contribute to the discussion of the overall NeRF/GS pipeline, please join the Discord: https://discord.gg/NqwTqVYVmj
## Features
- Complete C++ implementation of LightGlue using LibTorch
- CUDA acceleration support
- Integration with OpenCV for image handling
- [ALIKED](https://github.com/MrNeRF/ALIKED_CPP) feature extractor implementation
- Efficient memory management with move semantics
- Visualization support for matches and pruning
## Prerequisites
- CMake >= 3.26
- CUDA >= 12.1
- LibTorch (C++ distribution of PyTorch)
- OpenCV
- C++20 compliant compiler
- git-lfs (for model weights)
## Building
```bash
mkdir build && cd build
cmake ..
make -j
```
## Usage
The repository includes a sample application demonstrating feature matching between two images:
```bash
./LightGlue path/to/image1.jpg path/to/image2.jpg
```
## Project Structure
```
.
├── include/
│ ├── feature/ # Feature extraction components
│ └── matcher/ # LightGlue matcher implementation
├── src/
│ ├── feature/ # Feature extraction implementations
│ └── matcher/ # Matcher implementations
├── examples/ # Example applications
├── models/ # Directory for model weights
└── CMakeLists.txt
```
## Implementation Details
The implementation follows the original Python architecture while leveraging C++ and LibTorch features:
- CUDA optimizations for performance
- Move semantics for efficient memory handling
- LibTorch's automatic differentiation (though primarily used for inference)
- OpenCV integration for image processing and visualization
## Model Weights
Place the model weights in the `models/` directory. The following models are supported:
- ALIKED feature extractor weights
- LightGlue matcher weights
## Future Development
### TODO
- [ ] Batch Processing Support
- Implement efficient batch processing for multiple image pairs
- Optimize memory usage for batch operations
- Add batch-specific configuration options
- [ ] Flash Attention Implementation
- Add efficient Flash Attention mechanism
- Optimize for different GPU architectures
- Implement memory-efficient attention patterns
## Contributing
Contributions are welcome! Please feel free to submit pull requests or create issues for bugs and feature requests.
## Citations
If you use this implementation, please cite both the original LightGlue paper and the C++ implementation:
```bibtex
@inproceedings{lindenberger2023lightglue,
author = {Philipp Lindenberger and
Paul-Edouard Sarlin and
Marc Pollefeys},
title = {{LightGlue: Local Feature Matching at Light Speed}},
booktitle = {ICCV},
year = {2023}
}
@misc{patas2024lightgluecpp,
author = {Janusch Patas},
title = {LightGlue C++ Implementation},
year = {2024},
publisher = {GitHub},
journal = {GitHub Repository},
howpublished = {\url{https://github.com/MrNeRF/Light_Glue_CPP}}
}
```