# fabio-sim/lightglue-onnx architecture

> Architecture diagram of the GitHub repository fabio-sim/lightglue-onnx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fabio-sim/lightglue-onnx
- Repository: https://github.com/fabio-sim/lightglue-onnx

## Overview

LightGlue ONNX exports and runs feature-matching pipelines on image pairs, with CLI inference/export and a browser WebGPU demo. The core path preprocesses two images, extracts local features, matches them, and returns correspondences for visualization. README capabilities also include adaptive-depth export, several feature extractors, ONNX Runtime providers, pure TensorRT inference, FP8 quantization, and optional GPU JPEG preprocessing. Source excerpts were partial, so links for unsampled CLI behavior are limited to documented capabilities and supported module paths.

Main entry points: [`lightglue_dynamo/cli.py`](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/cli.py) (CLI commands), [`lightglue_dynamo/models`](https://github.com/fabio-sim/lightglue-onnx/tree/main/lightglue_dynamo/models) (Feature extractors), [`web/main.js`](https://github.com/fabio-sim/lightglue-onnx/blob/main/web/main.js) (WebGPU demo), [`web/serve.py`](https://github.com/fabio-sim/lightglue-onnx/blob/main/web/serve.py) (Demo server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_webui["WebGPU demo<br/>[main.js]"]
  node_demo_server["Demo server<br/>[serve.py]"]
end

subgraph group_runtime["Inference runtime"]
  node_pair_prep["Image pair prep<br/>[io.py]"]
  node_cuda_prep["GPU JPEG prep<br/>[cuda.py]"]
  node_pipeline["Extractor matcher<br/>[pipeline.py]"]
end

subgraph group_models["Feature models"]
  node_extractors["Feature extractors"]
  node_aliked["ALIKED<br/>[aliked.py]"]
  node_raco["RaCo ranker<br/>[raco.py]"]
  node_superpoint["SuperPoint<br/>[superpoint.py]"]
  node_disk["DISK extractor<br/>[disk.py]"]
  node_matcher["LightGlue matcher<br/>[lightglue.py]"]
end

subgraph group_export["Export and optimization"]
  node_adaptive["Adaptive depth<br/>[adaptive_depth.py]"]
  node_quantize["FP8 quantization<br/>[quantize.py]"]
  node_ranker_quant["Ranker quantization"]
  node_benchmark["Benchmarking<br/>[benchmark.py]"]
end

subgraph group_integrations["Execution integrations"]
  node_ort["ONNX Runtime"]
  node_tensorrt["TensorRT runtime"]
  node_openvino["OpenVINO runtime"]
  node_webgpu["WebGPU runtime<br/>[main.js]"]
  node_release["GitHub releases"]
  node_weights[("Model files")]
end

node_engineer(("CLI user"))
node_browser_user(("Browser user"))
node_matches["Match results"]

node_engineer -->|"invokes"| node_cli
node_cli -->|"prepares inputs"| node_pair_prep
node_cli -.->|"selects optional"| node_cuda_prep
node_pair_prep -->|"passes tensors"| node_pipeline
node_cuda_prep -->|"provides GPU inputs"| node_cli
node_pipeline -->|"extracts features"| node_extractors
node_extractors -->|"supports"| node_aliked
node_extractors -->|"supports"| node_raco
node_extractors -->|"supports"| node_superpoint
node_extractors -->|"supports"| node_disk
node_pipeline -->|"matches keypoints"| node_matcher
node_matcher -->|"returns correspondences"| node_matches
node_cli -->|"runs model"| node_ort
node_cli -.->|"dispatches inference"| node_tensorrt
node_cli -.->|"selects provider"| node_openvino
node_cli -.->|"exports adaptive graph"| node_adaptive
node_cli -.->|"runs quantization"| node_quantize
node_cli -.->|"runs ranker quantization"| node_ranker_quant
node_cli -.->|"benchmarks inference"| node_benchmark
node_cli -->|"reads or writes"| node_weights
node_browser_user -->|"runs demo"| node_webui
node_webui -->|"executes model"| node_webgpu
node_webui -->|"requests model"| node_demo_server
node_demo_server -->|"serves local model"| node_weights
node_demo_server -.->|"proxies model"| node_release
node_webui -->|"renders matches"| node_matches

click node_cli "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/cli.py"
click node_webui "https://github.com/fabio-sim/lightglue-onnx/blob/main/web/main.js"
click node_demo_server "https://github.com/fabio-sim/lightglue-onnx/blob/main/web/serve.py"
click node_pair_prep "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/preprocessors/io.py"
click node_cuda_prep "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/preprocessors/cuda.py"
click node_pipeline "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/pipeline.py"
click node_extractors "https://github.com/fabio-sim/lightglue-onnx/tree/main/lightglue_dynamo/models"
click node_aliked "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/aliked.py"
click node_raco "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/raco.py"
click node_superpoint "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/superpoint.py"
click node_disk "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/disk/disk.py"
click node_matcher "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/lightglue.py"
click node_adaptive "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/adaptive_depth.py"
click node_quantize "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/scripts/quantize.py"
click node_ranker_quant "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/scripts/quantize_ranker_fp8.py"
click node_benchmark "https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/scripts/benchmark.py"
click node_webgpu "https://github.com/fabio-sim/lightglue-onnx/blob/main/web/main.js"
click node_weights "https://github.com/fabio-sim/lightglue-onnx/tree/main/weights"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_webui,node_demo_server,node_engineer,node_browser_user toneBlue
class node_pair_prep,node_cuda_prep,node_pipeline toneAmber
class node_extractors,node_aliked,node_raco,node_superpoint,node_disk,node_matcher toneMint
class node_adaptive,node_quantize,node_ranker_quant,node_benchmark toneRose
class node_ort,node_tensorrt,node_openvino,node_webgpu,node_release,node_weights,node_matches toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/cli.py): `lightglue_dynamo/cli.py`
- [WebGPU demo](https://github.com/fabio-sim/lightglue-onnx/blob/main/web/main.js): `web/main.js`
- [Demo server](https://github.com/fabio-sim/lightglue-onnx/blob/main/web/serve.py): `web/serve.py`

### Inference runtime

- [Image pair prep](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/preprocessors/io.py): `lightglue_dynamo/preprocessors/io.py`
- [GPU JPEG prep](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/preprocessors/cuda.py): `lightglue_dynamo/preprocessors/cuda.py`
- [Extractor matcher](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/pipeline.py): `lightglue_dynamo/models/pipeline.py`

### Feature models

- [Feature extractors](https://github.com/fabio-sim/lightglue-onnx/tree/main/lightglue_dynamo/models): `lightglue_dynamo/models`
- [ALIKED](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/aliked.py): `lightglue_dynamo/models/aliked.py`
- [RaCo ranker](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/raco.py): `lightglue_dynamo/models/raco.py`
- [SuperPoint](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/superpoint.py): `lightglue_dynamo/models/superpoint.py`
- [DISK extractor](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/disk/disk.py): `lightglue_dynamo/models/disk/disk.py`
- [LightGlue matcher](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/models/lightglue.py): `lightglue_dynamo/models/lightglue.py`

### Export and optimization

- [Adaptive depth](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/adaptive_depth.py): `lightglue_dynamo/adaptive_depth.py`
- [FP8 quantization](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/scripts/quantize.py): `lightglue_dynamo/scripts/quantize.py`
- [Ranker quantization](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/scripts/quantize_ranker_fp8.py): `lightglue_dynamo/scripts/quantize_ranker_fp8.py`
- [Benchmarking](https://github.com/fabio-sim/lightglue-onnx/blob/main/lightglue_dynamo/scripts/benchmark.py): `lightglue_dynamo/scripts/benchmark.py`

### Execution integrations

- **ONNX Runtime**
- **TensorRT runtime**
- **OpenVINO runtime**
- [WebGPU runtime](https://github.com/fabio-sim/lightglue-onnx/blob/main/web/main.js): `web/main.js`
- **GitHub releases**
- [Model files](https://github.com/fabio-sim/lightglue-onnx/tree/main/weights): `weights`

### Other components

- **CLI user**
- **Browser user**
- **Match results**

## Connections

- CLI user → CLI commands: invokes
- CLI commands → Image pair prep: prepares inputs
- CLI commands → GPU JPEG prep: selects optional
- Image pair prep → Extractor matcher: passes tensors
- GPU JPEG prep → CLI commands: provides GPU inputs
- Extractor matcher → Feature extractors: extracts features
- Feature extractors → ALIKED: supports
- Feature extractors → RaCo ranker: supports
- Feature extractors → SuperPoint: supports
- Feature extractors → DISK extractor: supports
- Extractor matcher → LightGlue matcher: matches keypoints
- LightGlue matcher → Match results: returns correspondences
- CLI commands → ONNX Runtime: runs model
- CLI commands → TensorRT runtime: dispatches inference
- CLI commands → OpenVINO runtime: selects provider
- CLI commands → Adaptive depth: exports adaptive graph
- CLI commands → FP8 quantization: runs quantization
- CLI commands → Ranker quantization: runs ranker quantization
- CLI commands → Benchmarking: benchmarks inference
- CLI commands → Model files: reads or writes
- Browser user → WebGPU demo: runs demo
- WebGPU demo → WebGPU runtime: executes model
- WebGPU demo → Demo server: requests model
- Demo server → Model files: serves local model
- Demo server → GitHub releases: proxies model
- WebGPU demo → Match results: renders matches
