# verlab/accelerated_features architecture

> Architecture diagram of the GitHub repository verlab/accelerated_features, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/verlab/accelerated_features
- Repository: https://github.com/verlab/accelerated_features

## Overview

##### Main Components Identification

The system can be broken down into these major components:

a) Core Model Components:
- Feature Detector
- Descriptor Extractor
- Match Refinement Module

b) Supporting Infrastructure:
- Training Pipeline
- Evaluation System
- Dataset Management
- Inference Pipeline

**┌─ Input Layer ─────┐    ┌─ Core Processing ──────┐    ┌─ Output Layer ─┐**
- ┌─ Detection Branch ─┐  │    │               │
- Image Input  ────┼───►│ │  Keypoint Map     │  │    │  Keypoints    │
- (B,3,H,W)       │    │ └──────────────────┬─┘  │    │  Descriptors  │
- ┌─ Feature Branch ─┤    │───►│  Reliability  │
- Descriptor Map  │    │    │  Scores       │
- ┘    │    │               │
- ┘    └──────────────────────┬──┘    └───────────────┘

- ┌─────────────────────┐ │
- Match Refinement    │◄┘
- Module (Optional)   │
- ┘

**┌─ Training System ───────┐    ┌─ Inference System ────┐    ┌─ Evaluation ─────┐**
- Data Augmentation     │    │ - XFeat Core Model    │    │ - MegaDepth1500  │
- Loss Functions        │    │ - LighterGlue         │    │ - ScanNet1500    │
- Training Utils        │    │ - Real-time Demo      │    │ - Metrics        │
- ┘    └─────────────────────┬──┘    └─────────────────┘

- ┌─────────────────────┴──┐
- Dataset Management     │
- MegaDepth           │
- COCO                │
- ┘

##### Important Elements

b) Component Labels:
- Processing stage names
- Key parameters (e.g., descriptor dimension: 64D)

c) Integration Points:
- LighterGlue connection
- Dataset interfaces
- Training pipeline connections

##### Implementation Details

**modules/**
- dataset/      # Data management
- eval/         # Evaluation tools
- training/     # Training pipeline
- xfeat.py      # Core model
- lighterglue.py # Matcher integration

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        I[Image Input<br>B,3,H,W]
    end

    subgraph Core["Core Processing Layer"]
        subgraph Detection["Detection Branch"]
            D["Feature Detector"]:::core
        end
        
        subgraph Feature["Feature Branch"]
            F["Descriptor Extractor"]:::core
        end
        
        MR["Match Refinement<br>Module"]:::core
    end

    subgraph Output
        O1["Keypoints"]
        O2["Descriptors"]
        O3["Reliability Scores"]
    end

    subgraph Training["Training Infrastructure"]
        TP["Training Pipeline"]:::training
        LF["Loss Functions"]:::training
        TU["Training Utils"]:::training
        TE["Training Example"]:::training
    end

    subgraph Evaluation["Evaluation System"]
        ME["MegaDepth1500<br>Evaluation"]:::eval
        SE["ScanNet1500<br>Evaluation"]:::eval
    end

    subgraph Dataset["Dataset Management"]
        DC["Dataset Core"]:::data
        DA["Data Augmentation"]:::data
        MD["MegaDepth Dataset"]:::data
        DD["Dataset Download<br>Utilities"]:::data
    end

    subgraph Inference["Inference Pipeline"]
        RTD["Real-time Demo"]:::inference
        ME2["Minimal Example"]:::inference
        MW["Model Weights"]:::inference
    end

    subgraph Integration["Integration Components"]
        PI["PyTorch Hub<br>Integration"]:::integration
        TPI["Third-party<br>Integration"]:::integration
    end

    I --> D
    D --> F
    F --> MR
    D --> O1
    F --> O2
    F --> O3
    DC --> TP
    DA --> TP
    TP --> D
    TP --> F
    ME --> Evaluation
    SE --> Evaluation
    RTD --> D
    RTD --> F
    ME2 --> D
    ME2 --> F

    %% Click Events
    click D "https://github.com/verlab/accelerated_features/blob/main/modules/model.py"
    click F "https://github.com/verlab/accelerated_features/blob/main/modules/xfeat.py"
    click MR "https://github.com/verlab/accelerated_features/blob/main/modules/lighterglue.py"
    click TP "https://github.com/verlab/accelerated_features/tree/main/modules/training/"
    click LF "https://github.com/verlab/accelerated_features/blob/main/modules/training/losses.py"
    click TU "https://github.com/verlab/accelerated_features/blob/main/modules/training/utils.py"
    click TE "https://github.com/verlab/accelerated_features/blob/main/notebooks/XFeat_training_example.ipynb"
    click ME "https://github.com/verlab/accelerated_features/blob/main/modules/eval/megadepth1500.py"
    click SE "https://github.com/verlab/accelerated_features/blob/main/modules/eval/scannet1500.py"
    click DC "https://github.com/verlab/accelerated_features/tree/main/modules/dataset/"
    click DA "https://github.com/verlab/accelerated_features/blob/main/modules/dataset/augmentation.py"
    click MD "https://github.com/verlab/accelerated_features/tree/main/modules/dataset/megadepth/"
    click DD "https://github.com/verlab/accelerated_features/blob/main/modules/dataset/download.py"
    click RTD "https://github.com/verlab/accelerated_features/blob/main/realtime_demo.py"
    click ME2 "https://github.com/verlab/accelerated_features/blob/main/minimal_example.py"
    click MW "https://github.com/verlab/accelerated_features/blob/main/weights/xfeat.pt"
    click PI "https://github.com/verlab/accelerated_features/blob/main/hubconf.py"
    click TPI "https://github.com/verlab/accelerated_features/blob/main/third_party/alike_wrapper.py"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef training fill:#e67e22,stroke:#d35400,color:white
    classDef eval fill:#9b59b6,stroke:#8e44ad,color:white
    classDef data fill:#2ecc71,stroke:#27ae60,color:white
    classDef inference fill:#e74c3c,stroke:#c0392b,color:white
    classDef integration fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Training Components"]:::training
        L3["Evaluation Components"]:::eval
        L4["Data Components"]:::data
        L5["Inference Components"]:::inference
        L6["Integration Components"]:::integration
    end
```
