# jm-dtckt/eventtransformer architecture

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

- Interactive diagram: https://gitdiagram.com/jm-dtckt/eventtransformer
- Repository: https://github.com/jm-dtckt/eventtransformer

## Overview

This repository implements Event Transformer (EvT), a sparse event-data classifier. The principal workflow converts downloaded event datasets into sparse frame representations, loads and batches them into event-patch sequences, and classifies them with EvT. Separate entry points train models and evaluate pretrained models, reporting accuracy, latency, FLOPs, parameters, and activated-patch statistics. The graph preserves the README’s dataset-preprocessing and evaluation capabilities; links between preprocessing scripts and stored data are documented at the README level, while detailed unsampled implementation links are omitted.

Main entry points: [`trainer.py`](https://github.com/jm-dtckt/eventtransformer/blob/main/trainer.py) (Training orchestration), [`evaluation_stats.py`](https://github.com/jm-dtckt/eventtransformer/blob/main/evaluation_stats.py) (Evaluation statistics), [`dataset_scripts`](https://github.com/jm-dtckt/eventtransformer/tree/main/dataset_scripts) (Sparse frame data), [`data_generation.py`](https://github.com/jm-dtckt/eventtransformer/blob/main/data_generation.py) (Event data module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Dataset preparation"]
  node_asl_prep["ASL conversion<br/>[asl.py]"]
  node_caltech_prep["Caltech conversion<br/>[caltech_101.py]"]
  node_dvs_split["DVS128 split"]
  node_dvs_prep["DVS128 conversion<br/>[dvs128.py]"]
  node_animals_prep["SL-Animals conversion<br/>[sl_animals.py]"]
end

subgraph group_input["Event data input"]
  node_sparse_data[("Sparse frame data")]
  node_event_data["Event data module<br/>[data_generation.py]"]
end

subgraph group_model["EvT model"]
  node_model["EvT backbone<br/>[EvT.py]"]
  node_positional["Fourier positions"]
  node_classifier["Classification head<br/>[EvT.py]"]
end

subgraph group_use["Training and evaluation"]
  node_train_entry["Training entry<br/>[train.py]"]
  node_trainer["Training orchestration<br/>[trainer.py]"]
  node_train_utils["Training utilities<br/>[training_utils.py]"]
  node_eval_entry["Evaluation statistics"]
  node_eval_utils["Evaluation utilities"]
  node_results["Metrics and predictions"]
end

node_user(("Researcher"))
node_datasets[("Downloaded datasets")]
node_pretrained[("Pretrained models")]

node_user -->|"downloads"| node_datasets
node_datasets -->|"provides events"| node_asl_prep
node_datasets -->|"provides events"| node_caltech_prep
node_datasets -->|"provides events"| node_dvs_split
node_dvs_split -->|"splits first"| node_dvs_prep
node_datasets -->|"provides events"| node_dvs_prep
node_datasets -->|"provides events"| node_animals_prep
node_asl_prep -->|"creates frames"| node_sparse_data
node_caltech_prep -->|"creates frames"| node_sparse_data
node_dvs_prep -->|"creates frames"| node_sparse_data
node_animals_prep -->|"creates frames"| node_sparse_data
node_sparse_data -->|"loads samples"| node_event_data
node_user -->|"starts training"| node_train_entry
node_train_entry -->|"calls train"| node_trainer
node_trainer -->|"builds data module"| node_event_data
node_trainer -->|"instantiates backbone"| node_model
node_model -->|"uses features"| node_positional
node_trainer -->|"creates classifier"| node_classifier
node_trainer -->|"creates result folder"| node_train_utils
node_user -->|"starts evaluation"| node_eval_entry
node_eval_entry -->|"loads validation data"| node_event_data
node_eval_entry -->|"loads model class"| node_trainer
node_eval_entry -->|"uses evaluation helpers"| node_eval_utils
node_eval_entry -->|"evaluates checkpoint"| node_pretrained
node_eval_entry -->|"reports statistics"| node_results
node_eval_utils -->|"loads validation data"| node_event_data
node_eval_utils -->|"loads model class"| node_trainer

click node_asl_prep "https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/asl.py"
click node_caltech_prep "https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/caltech_101.py"
click node_dvs_split "https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/dvs128_split_dataset.py"
click node_dvs_prep "https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/dvs128.py"
click node_animals_prep "https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/sl_animals.py"
click node_sparse_data "https://github.com/jm-dtckt/eventtransformer/tree/main/dataset_scripts"
click node_event_data "https://github.com/jm-dtckt/eventtransformer/blob/main/data_generation.py"
click node_train_entry "https://github.com/jm-dtckt/eventtransformer/blob/main/train.py"
click node_trainer "https://github.com/jm-dtckt/eventtransformer/blob/main/trainer.py"
click node_train_utils "https://github.com/jm-dtckt/eventtransformer/blob/main/training_utils.py"
click node_model "https://github.com/jm-dtckt/eventtransformer/blob/main/models/EvT.py"
click node_positional "https://github.com/jm-dtckt/eventtransformer/blob/main/models/positional_encoding.py"
click node_classifier "https://github.com/jm-dtckt/eventtransformer/blob/main/models/EvT.py"
click node_eval_entry "https://github.com/jm-dtckt/eventtransformer/blob/main/evaluation_stats.py"
click node_eval_utils "https://github.com/jm-dtckt/eventtransformer/blob/main/evaluation_utils.py"
click node_results "https://github.com/jm-dtckt/eventtransformer/blob/main/evaluation_stats.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_asl_prep,node_caltech_prep,node_dvs_split,node_dvs_prep,node_animals_prep toneBlue
class node_sparse_data,node_event_data,node_datasets,node_pretrained toneAmber
class node_model,node_positional,node_classifier toneMint
class node_train_entry,node_trainer,node_train_utils,node_eval_entry,node_eval_utils,node_results toneRose
class node_user toneIndigo
```

## Components

### Dataset preparation

- [ASL conversion](https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/asl.py): `dataset_scripts/asl.py`
- [Caltech conversion](https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/caltech_101.py): `dataset_scripts/caltech_101.py`
- [DVS128 split](https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/dvs128_split_dataset.py): `dataset_scripts/dvs128_split_dataset.py`
- [DVS128 conversion](https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/dvs128.py): `dataset_scripts/dvs128.py`
- [SL-Animals conversion](https://github.com/jm-dtckt/eventtransformer/blob/main/dataset_scripts/sl_animals.py): `dataset_scripts/sl_animals.py`

### Event data input

- [Sparse frame data](https://github.com/jm-dtckt/eventtransformer/tree/main/dataset_scripts): `dataset_scripts`
- [Event data module](https://github.com/jm-dtckt/eventtransformer/blob/main/data_generation.py): `data_generation.py`

### EvT model

- [EvT backbone](https://github.com/jm-dtckt/eventtransformer/blob/main/models/EvT.py): `models/EvT.py`
- [Fourier positions](https://github.com/jm-dtckt/eventtransformer/blob/main/models/positional_encoding.py): `models/positional_encoding.py`
- [Classification head](https://github.com/jm-dtckt/eventtransformer/blob/main/models/EvT.py): `models/EvT.py`

### Training and evaluation

- [Training entry](https://github.com/jm-dtckt/eventtransformer/blob/main/train.py): `train.py`
- [Training orchestration](https://github.com/jm-dtckt/eventtransformer/blob/main/trainer.py): `trainer.py`
- [Training utilities](https://github.com/jm-dtckt/eventtransformer/blob/main/training_utils.py): `training_utils.py`
- [Evaluation statistics](https://github.com/jm-dtckt/eventtransformer/blob/main/evaluation_stats.py): `evaluation_stats.py`
- [Evaluation utilities](https://github.com/jm-dtckt/eventtransformer/blob/main/evaluation_utils.py): `evaluation_utils.py`
- [Metrics and predictions](https://github.com/jm-dtckt/eventtransformer/blob/main/evaluation_stats.py): `evaluation_stats.py`

### Other components

- **Researcher**
- **Downloaded datasets**
- **Pretrained models**

## Connections

- Researcher → Downloaded datasets: downloads (evidence: `README.md`)
- Downloaded datasets → ASL conversion: provides events (evidence: `README.md`)
- Downloaded datasets → Caltech conversion: provides events (evidence: `README.md`)
- Downloaded datasets → DVS128 split: provides events (evidence: `README.md`)
- DVS128 split → DVS128 conversion: splits first (evidence: `README.md`)
- Downloaded datasets → DVS128 conversion: provides events (evidence: `README.md`)
- Downloaded datasets → SL-Animals conversion: provides events (evidence: `README.md`)
- ASL conversion → Sparse frame data: creates frames (evidence: `README.md`)
- Caltech conversion → Sparse frame data: creates frames (evidence: `README.md`)
- DVS128 conversion → Sparse frame data: creates frames (evidence: `README.md`)
- SL-Animals conversion → Sparse frame data: creates frames (evidence: `README.md`)
- Sparse frame data → Event data module: loads samples (evidence: `README.md`)
- Researcher → Training entry: starts training (evidence: `README.md`)
- Training entry → Training orchestration: calls train (evidence: `train.py`)
- Training orchestration → Event data module: builds data module (evidence: `trainer.py`)
- Training orchestration → EvT backbone: instantiates backbone (evidence: `trainer.py`)
- EvT backbone → Fourier positions: uses features (evidence: `models/EvT.py`)
- Training orchestration → Classification head: creates classifier (evidence: `trainer.py`)
- Training orchestration → Training utilities: creates result folder (evidence: `trainer.py`)
- Researcher → Evaluation statistics: starts evaluation (evidence: `README.md`)
- Evaluation statistics → Event data module: loads validation data (evidence: `evaluation_stats.py`)
- Evaluation statistics → Training orchestration: loads model class (evidence: `evaluation_stats.py`)
- Evaluation statistics → Evaluation utilities: uses evaluation helpers (evidence: `evaluation_stats.py`)
- Evaluation statistics → Pretrained models: evaluates checkpoint (evidence: `README.md`)
- Evaluation statistics → Metrics and predictions: reports statistics (evidence: `evaluation_stats.py`)
- Evaluation utilities → Event data module: loads validation data (evidence: `evaluation_utils.py`)
- Evaluation utilities → Training orchestration: loads model class (evidence: `evaluation_utils.py`)
