# altzits007/torchvprsnn architecture

> Architecture diagram of the GitHub repository altzits007/torchvprsnn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/altzits007/torchvprsnn
- Repository: https://github.com/altzits007/torchvprsnn

## Overview

This repository implements visual place recognition with a rate-encoded spiking neural network (SNN). The principal workflow loads reference and query images, encodes them as spike trains, trains or loads an SNN, assigns neurons to places, and evaluates query matches, including sequential aggregation. The graph includes documented experiment and reporting branches. Some runtime details are unsampled; edges are limited to relationships supported by excerpts, the source index, or README statements.

Main entry points: [`core/snn_model.py`](https://github.com/altzits007/torchvprsnn/blob/main/core/snn_model.py) (Training & Inference), [`core/networks.py`](https://github.com/altzits007/torchvprsnn/blob/main/core/networks.py) (SNN Network), [`core/encoders.py`](https://github.com/altzits007/torchvprsnn/blob/main/core/encoders.py) (Rate Encoding), [`experiments/run_table_iv_real.py`](https://github.com/altzits007/torchvprsnn/blob/main/experiments/run_table_iv_real.py) (Nordland Ablation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["VPR Workflow"]
  node_entry["Training &amp; Inference<br/>[snn_model.py]"]
  node_dataset_loaders["Dataset Loading"]
  node_prediction["Prediction API<br/>[predict.py]"]
  node_checkpoints["Model Checkpoints<br/>[snn_model.py]"]
  node_telemetry["Runtime Profiling"]
end

subgraph group_snn["SNN Runtime"]
  node_encoder["Rate Encoding<br/>[encoders.py]"]
  node_network["SNN Network<br/>[networks.py]"]
  node_mechanisms["Learning Mechanisms<br/>[mechanisms.py]"]
end

subgraph group_evaluation["Assignments &amp; Evaluation"]
  node_assignments["Neuron Assignments"]
  node_evaluation_runtime["Place Recognition"]
  node_metrics["VPR Metrics<br/>[metrics.py]"]
end

subgraph group_experiments["Experiments &amp; Reporting"]
  node_run_real["Nordland Ablation"]
  node_run_oxford["Oxford Ablation"]
  node_run_table_v["Window Study<br/>[run_table_v.py]"]
  node_plot_results["R@100P Reports"]
end

node_user(("Experimenter"))
node_datasets[("Image Datasets")]

node_user -->|"runs"| node_entry
node_datasets -->|"provides images"| node_dataset_loaders
node_entry -->|"loads data"| node_dataset_loaders
node_entry -->|"configures"| node_encoder
node_entry -->|"initializes"| node_network
node_encoder -->|"encodes input"| node_network
node_network -->|"uses learning rules"| node_mechanisms
node_entry -->|"assigns neurons"| node_assignments
node_entry -->|"evaluates places"| node_evaluation_runtime
node_evaluation_runtime -->|"computes PR metrics"| node_metrics
node_entry -->|"saves or loads"| node_checkpoints
node_entry -->|"profiles runtime"| node_telemetry
node_user -.->|"requests prediction"| node_prediction
node_prediction -->|"uses"| node_encoder
node_prediction -->|"uses"| node_network
node_prediction -->|"uses"| node_evaluation_runtime
node_user -->|"runs study"| node_run_real
node_user -->|"runs study"| node_run_oxford
node_user -->|"runs study"| node_run_table_v
node_run_real -->|"encodes images"| node_encoder
node_run_real -->|"trains network"| node_network
node_run_real -->|"builds assignments"| node_assignments
node_run_real -->|"evaluates queries"| node_evaluation_runtime
node_run_oxford -->|"encodes images"| node_encoder
node_run_oxford -->|"trains network"| node_network
node_run_oxford -->|"builds assignments"| node_assignments
node_run_oxford -->|"evaluates queries"| node_evaluation_runtime
node_run_table_v -->|"encodes images"| node_encoder
node_run_table_v -->|"trains network"| node_network
node_run_table_v -->|"aggregates scores"| node_assignments
node_plot_results -->|"produces boxplots"| node_user

click node_entry "https://github.com/altzits007/torchvprsnn/blob/main/core/snn_model.py"
click node_dataset_loaders "https://github.com/altzits007/torchvprsnn/blob/main/core/vprsnn_evaluation.py"
click node_encoder "https://github.com/altzits007/torchvprsnn/blob/main/core/encoders.py"
click node_network "https://github.com/altzits007/torchvprsnn/blob/main/core/networks.py"
click node_mechanisms "https://github.com/altzits007/torchvprsnn/blob/main/core/mechanisms.py"
click node_assignments "https://github.com/altzits007/torchvprsnn/blob/main/core/neuronal_assignments.py"
click node_evaluation_runtime "https://github.com/altzits007/torchvprsnn/blob/main/core/vprsnn_evaluation.py"
click node_metrics "https://github.com/altzits007/torchvprsnn/blob/main/core/metrics.py"
click node_prediction "https://github.com/altzits007/torchvprsnn/blob/main/core/predict.py"
click node_run_real "https://github.com/altzits007/torchvprsnn/blob/main/experiments/run_table_iv_real.py"
click node_run_oxford "https://github.com/altzits007/torchvprsnn/blob/main/experiments/run_table_iv_oxford.py"
click node_run_table_v "https://github.com/altzits007/torchvprsnn/blob/main/experiments/run_table_v.py"
click node_plot_results "https://github.com/altzits007/torchvprsnn/blob/main/tools/plot_r100p_from_extracted_tables.py"
click node_checkpoints "https://github.com/altzits007/torchvprsnn/blob/main/core/snn_model.py"
click node_telemetry "https://github.com/altzits007/torchvprsnn/blob/main/core/vprsnn_evaluation.py"

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_entry,node_dataset_loaders,node_prediction,node_checkpoints,node_telemetry toneBlue
class node_encoder,node_network,node_mechanisms,node_datasets toneAmber
class node_assignments,node_evaluation_runtime,node_metrics toneMint
class node_run_real,node_run_oxford,node_run_table_v,node_plot_results toneRose
class node_user toneIndigo
```

## Components

### VPR Workflow

- [Training & Inference](https://github.com/altzits007/torchvprsnn/blob/main/core/snn_model.py): `core/snn_model.py`
- [Dataset Loading](https://github.com/altzits007/torchvprsnn/blob/main/core/vprsnn_evaluation.py): `core/vprsnn_evaluation.py`
- [Prediction API](https://github.com/altzits007/torchvprsnn/blob/main/core/predict.py): `core/predict.py`
- [Model Checkpoints](https://github.com/altzits007/torchvprsnn/blob/main/core/snn_model.py): `core/snn_model.py`
- [Runtime Profiling](https://github.com/altzits007/torchvprsnn/blob/main/core/vprsnn_evaluation.py): `core/vprsnn_evaluation.py`

### SNN Runtime

- [Rate Encoding](https://github.com/altzits007/torchvprsnn/blob/main/core/encoders.py): `core/encoders.py`
- [SNN Network](https://github.com/altzits007/torchvprsnn/blob/main/core/networks.py): `core/networks.py`
- [Learning Mechanisms](https://github.com/altzits007/torchvprsnn/blob/main/core/mechanisms.py): `core/mechanisms.py`

### Assignments & Evaluation

- [Neuron Assignments](https://github.com/altzits007/torchvprsnn/blob/main/core/neuronal_assignments.py): `core/neuronal_assignments.py`
- [Place Recognition](https://github.com/altzits007/torchvprsnn/blob/main/core/vprsnn_evaluation.py): `core/vprsnn_evaluation.py`
- [VPR Metrics](https://github.com/altzits007/torchvprsnn/blob/main/core/metrics.py): `core/metrics.py`

### Experiments & Reporting

- [Nordland Ablation](https://github.com/altzits007/torchvprsnn/blob/main/experiments/run_table_iv_real.py): `experiments/run_table_iv_real.py`
- [Oxford Ablation](https://github.com/altzits007/torchvprsnn/blob/main/experiments/run_table_iv_oxford.py): `experiments/run_table_iv_oxford.py`
- [Window Study](https://github.com/altzits007/torchvprsnn/blob/main/experiments/run_table_v.py): `experiments/run_table_v.py`
- [R@100P Reports](https://github.com/altzits007/torchvprsnn/blob/main/tools/plot_r100p_from_extracted_tables.py): `tools/plot_r100p_from_extracted_tables.py`

### Other components

- **Experimenter**
- **Image Datasets**

## Connections

- Experimenter → Training & Inference: runs (evidence: `README.md`)
- Image Datasets → Dataset Loading: provides images (evidence: `README.md`)
- Training & Inference → Dataset Loading: loads data (evidence: `core/snn_model.py`)
- Training & Inference → Rate Encoding: configures (evidence: `core/snn_model.py`)
- Training & Inference → SNN Network: initializes (evidence: `core/snn_model.py`)
- Rate Encoding → SNN Network: encodes input (evidence: `README.md`)
- SNN Network → Learning Mechanisms: uses learning rules (evidence: `core/networks.py`)
- Training & Inference → Neuron Assignments: assigns neurons (evidence: `core/snn_model.py`)
- Training & Inference → Place Recognition: evaluates places (evidence: `core/snn_model.py`)
- Place Recognition → VPR Metrics: computes PR metrics (evidence: `core/vprsnn_evaluation.py`)
- Training & Inference → Model Checkpoints: saves or loads (evidence: `README.md`)
- Training & Inference → Runtime Profiling: profiles runtime (evidence: `README.md`)
- Experimenter → Prediction API: requests prediction
- Prediction API → Rate Encoding: uses (evidence: `core/predict.py`)
- Prediction API → SNN Network: uses (evidence: `core/predict.py`)
- Prediction API → Place Recognition: uses (evidence: `core/predict.py`)
- Experimenter → Nordland Ablation: runs study (evidence: `README.md`)
- Experimenter → Oxford Ablation: runs study (evidence: `README.md`)
- Experimenter → Window Study: runs study (evidence: `README.md`)
- Nordland Ablation → Rate Encoding: encodes images (evidence: `experiments/run_table_iv_real.py`)
- Nordland Ablation → SNN Network: trains network (evidence: `experiments/run_table_iv_real.py`)
- Nordland Ablation → Neuron Assignments: builds assignments (evidence: `experiments/run_table_iv_real.py`)
- Nordland Ablation → Place Recognition: evaluates queries (evidence: `experiments/run_table_iv_real.py`)
- Oxford Ablation → Rate Encoding: encodes images (evidence: `experiments/run_table_iv_oxford.py`)
- Oxford Ablation → SNN Network: trains network (evidence: `experiments/run_table_iv_oxford.py`)
- Oxford Ablation → Neuron Assignments: builds assignments (evidence: `experiments/run_table_iv_oxford.py`)
- Oxford Ablation → Place Recognition: evaluates queries (evidence: `experiments/run_table_iv_oxford.py`)
- Window Study → Rate Encoding: encodes images (evidence: `experiments/run_table_v.py`)
- Window Study → SNN Network: trains network (evidence: `experiments/run_table_v.py`)
- Window Study → Neuron Assignments: aggregates scores (evidence: `experiments/run_table_v.py`)
- R@100P Reports → Experimenter: produces boxplots (evidence: `README.md`)
