# swetha4444/spiking-har-ssl architecture

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

- Interactive diagram: https://gitdiagram.com/swetha4444/spiking-har-ssl
- Repository: https://github.com/swetha4444/spiking-har-ssl

## Overview

Project_SNN is a wearable-sensor human-activity-recognition research package. Its main workflow loads WISDM sensor recordings, preprocesses and windows them, optionally applies research filtering and temporal encoding, then trains a self-supervised model and evaluates learned features with linear classification. The README also documents supervised HAR baselines, multiple SSL objectives and backbone families, and sparsity reporting. Edges follow documented workflows or source-index references; unsampled subsystem details are represented at their supported directory paths.

Main entry points: [`trainer.py`](https://github.com/swetha4444/spiking-har-ssl/blob/main/trainer.py) (Training engine), [`data_preprocess/data_preprocess_wisdm.py`](https://github.com/swetha4444/spiking-har-ssl/blob/main/data_preprocess/data_preprocess_wisdm.py) (WISDM preprocessing), [`trainer_research.py`](https://github.com/swetha4444/spiking-har-ssl/blob/main/trainer_research.py) (Research routing), [`main_ssl_research.py`](https://github.com/swetha4444/spiking-har-ssl/blob/main/main_ssl_research.py) (Research SSL entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_wisdm[("WISDM recordings")]
  node_dataset_loaders["HAR loaders"]
  node_window_utils["Window utilities"]
  node_wisdm_preprocess["WISDM preprocessing"]
  node_research_preprocess["Research preprocessing"]
  node_physics_preprocess["IMU physics processing"]
  node_encoding["Temporal encodings"]
end

subgraph group_experiments["Experiment workflows"]
  node_ssl_entry["Research SSL entry"]
  node_baseline_entry["Standard SSL entry<br/>[main_ssl.py]"]
  node_supervised_entry["Supervised entry<br/>[main.py]"]
  node_research_trainer["Research routing"]
  node_trainer["Training engine<br/>[trainer.py]"]
  node_augmentations["View augmentations<br/>[augmentations.py]"]
end

subgraph group_models["Learning models"]
  node_frameworks["SSL objectives<br/>[frameworks.py]"]
  node_losses["Loss functions<br/>[loss.py]"]
  node_backbones["ANN backbones<br/>[backbones.py]"]
  node_spiking_models["Spiking backbones<br/>[spike.py]"]
  node_resnet["Residual CNN<br/>[resnet1d.py]"]
  node_vit["ViT1D<br/>[vit1d.py]"]
  node_ispikformer["iSpikformer"]
  node_spikeformer["SpikeFormer<br/>[spikeformer.py]"]
  node_attention["Attention layers<br/>[attention.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_linear_eval["Linear evaluation<br/>[trainer.py]"]
  node_probe_checkpoint["Checkpoint probing"]
  node_metrics["Experiment metrics"]
  node_sparsity["Sparsity utilities<br/>[utils.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"configures run"| node_ssl_entry
node_researcher -->|"starts baseline"| node_baseline_entry
node_researcher -->|"starts training"| node_supervised_entry
node_wisdm -->|"provides recordings"| node_wisdm_preprocess
node_dataset_loaders -->|"uses windowing"| node_window_utils
node_dataset_loaders -->|"loads WISDM"| node_wisdm_preprocess
node_wisdm_preprocess -->|"uses window utilities"| node_window_utils
node_research_preprocess -->|"extends pipeline"| node_wisdm_preprocess
node_physics_preprocess -->|"uses WISDM data"| node_wisdm_preprocess
node_ssl_entry -->|"routes research run"| node_research_trainer
node_ssl_entry -->|"reuses entry options"| node_baseline_entry
node_research_trainer -->|"routes preprocessing"| node_research_preprocess
node_research_trainer -->|"routes encoding"| node_encoding
node_research_trainer -->|"delegates training"| node_trainer
node_baseline_entry -->|"starts SSL training"| node_trainer
node_supervised_entry -->|"uses training engine"| node_trainer
node_trainer -->|"generates views"| node_augmentations
node_trainer -->|"selects objective"| node_frameworks
node_frameworks -->|"uses encoders"| node_backbones
node_frameworks -.->|"uses losses"| node_losses
node_trainer -->|"loads HAR datasets"| node_dataset_loaders
node_trainer -->|"supports backbone"| node_resnet
node_trainer -->|"supports backbone"| node_vit
node_trainer -->|"supports backbone"| node_spiking_models
node_trainer -->|"supports backbone"| node_ispikformer
node_trainer -->|"supports backbone"| node_spikeformer
node_backbones -->|"uses attention layers"| node_attention
node_spiking_models -->|"extends backbones"| node_backbones
node_trainer -->|"runs linear probe"| node_linear_eval
node_researcher -->|"probes checkpoint"| node_probe_checkpoint
node_trainer -->|"reports sparsity"| node_sparsity
node_linear_eval -.->|"records results"| node_metrics

click node_dataset_loaders "https://github.com/swetha4444/spiking-har-ssl/tree/main/data_preprocess"
click node_window_utils "https://github.com/swetha4444/spiking-har-ssl/blob/main/data_preprocess/data_preprocess_utils.py"
click node_wisdm_preprocess "https://github.com/swetha4444/spiking-har-ssl/blob/main/data_preprocess/data_preprocess_wisdm.py"
click node_research_preprocess "https://github.com/swetha4444/spiking-har-ssl/blob/main/data_preprocess/data_preprocess_wisdm_research.py"
click node_physics_preprocess "https://github.com/swetha4444/spiking-har-ssl/blob/main/data_preprocess/wisdm_imu_physics_preprocess.py"
click node_encoding "https://github.com/swetha4444/spiking-har-ssl/blob/main/input_encoding_research.py"
click node_ssl_entry "https://github.com/swetha4444/spiking-har-ssl/blob/main/main_ssl_research.py"
click node_baseline_entry "https://github.com/swetha4444/spiking-har-ssl/blob/main/main_ssl.py"
click node_supervised_entry "https://github.com/swetha4444/spiking-har-ssl/blob/main/main.py"
click node_research_trainer "https://github.com/swetha4444/spiking-har-ssl/blob/main/trainer_research.py"
click node_trainer "https://github.com/swetha4444/spiking-har-ssl/blob/main/trainer.py"
click node_augmentations "https://github.com/swetha4444/spiking-har-ssl/blob/main/augmentations.py"
click node_frameworks "https://github.com/swetha4444/spiking-har-ssl/blob/main/models/frameworks.py"
click node_losses "https://github.com/swetha4444/spiking-har-ssl/blob/main/models/loss.py"
click node_backbones "https://github.com/swetha4444/spiking-har-ssl/blob/main/models/backbones.py"
click node_spiking_models "https://github.com/swetha4444/spiking-har-ssl/blob/main/models/spike.py"
click node_resnet "https://github.com/swetha4444/spiking-har-ssl/blob/main/models/resnet1d.py"
click node_vit "https://github.com/swetha4444/spiking-har-ssl/blob/main/models/vit1d.py"
click node_ispikformer "https://github.com/swetha4444/spiking-har-ssl/tree/main/models/local_ispikformer"
click node_spikeformer "https://github.com/swetha4444/spiking-har-ssl/blob/main/models/exp_spikeformer/spikeformer.py"
click node_attention "https://github.com/swetha4444/spiking-har-ssl/blob/main/models/attention.py"
click node_linear_eval "https://github.com/swetha4444/spiking-har-ssl/blob/main/trainer.py"
click node_probe_checkpoint "https://github.com/swetha4444/spiking-har-ssl/blob/main/mlp_lincls_from_simclr_ckpt.py"
click node_metrics "https://github.com/swetha4444/spiking-har-ssl/tree/main/results"
click node_sparsity "https://github.com/swetha4444/spiking-har-ssl/blob/main/utils.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_wisdm,node_dataset_loaders,node_window_utils,node_wisdm_preprocess,node_research_preprocess,node_physics_preprocess,node_encoding toneBlue
class node_ssl_entry,node_baseline_entry,node_supervised_entry,node_research_trainer,node_trainer,node_augmentations toneAmber
class node_frameworks,node_losses,node_backbones,node_spiking_models,node_resnet,node_vit,node_ispikformer,node_spikeformer,node_attention toneMint
class node_linear_eval,node_probe_checkpoint,node_metrics,node_sparsity toneRose
class node_researcher toneIndigo
```

## Components

### Data preparation

- **WISDM recordings**
- [HAR loaders](https://github.com/swetha4444/spiking-har-ssl/tree/main/data_preprocess): `data_preprocess`
- [Window utilities](https://github.com/swetha4444/spiking-har-ssl/blob/main/data_preprocess/data_preprocess_utils.py): `data_preprocess/data_preprocess_utils.py`
- [WISDM preprocessing](https://github.com/swetha4444/spiking-har-ssl/blob/main/data_preprocess/data_preprocess_wisdm.py): `data_preprocess/data_preprocess_wisdm.py`
- [Research preprocessing](https://github.com/swetha4444/spiking-har-ssl/blob/main/data_preprocess/data_preprocess_wisdm_research.py): `data_preprocess/data_preprocess_wisdm_research.py`
- [IMU physics processing](https://github.com/swetha4444/spiking-har-ssl/blob/main/data_preprocess/wisdm_imu_physics_preprocess.py): `data_preprocess/wisdm_imu_physics_preprocess.py`
- [Temporal encodings](https://github.com/swetha4444/spiking-har-ssl/blob/main/input_encoding_research.py): `input_encoding_research.py`

### Experiment workflows

- [Research SSL entry](https://github.com/swetha4444/spiking-har-ssl/blob/main/main_ssl_research.py): `main_ssl_research.py`
- [Standard SSL entry](https://github.com/swetha4444/spiking-har-ssl/blob/main/main_ssl.py): `main_ssl.py`
- [Supervised entry](https://github.com/swetha4444/spiking-har-ssl/blob/main/main.py): `main.py`
- [Research routing](https://github.com/swetha4444/spiking-har-ssl/blob/main/trainer_research.py): `trainer_research.py`
- [Training engine](https://github.com/swetha4444/spiking-har-ssl/blob/main/trainer.py): `trainer.py`
- [View augmentations](https://github.com/swetha4444/spiking-har-ssl/blob/main/augmentations.py): `augmentations.py`

### Learning models

- [SSL objectives](https://github.com/swetha4444/spiking-har-ssl/blob/main/models/frameworks.py): `models/frameworks.py`
- [Loss functions](https://github.com/swetha4444/spiking-har-ssl/blob/main/models/loss.py): `models/loss.py`
- [ANN backbones](https://github.com/swetha4444/spiking-har-ssl/blob/main/models/backbones.py): `models/backbones.py`
- [Spiking backbones](https://github.com/swetha4444/spiking-har-ssl/blob/main/models/spike.py): `models/spike.py`
- [Residual CNN](https://github.com/swetha4444/spiking-har-ssl/blob/main/models/resnet1d.py): `models/resnet1d.py`
- [ViT1D](https://github.com/swetha4444/spiking-har-ssl/blob/main/models/vit1d.py): `models/vit1d.py`
- [iSpikformer](https://github.com/swetha4444/spiking-har-ssl/tree/main/models/local_ispikformer): `models/local_ispikformer`
- [SpikeFormer](https://github.com/swetha4444/spiking-har-ssl/blob/main/models/exp_spikeformer/spikeformer.py): `models/exp_spikeformer/spikeformer.py`
- [Attention layers](https://github.com/swetha4444/spiking-har-ssl/blob/main/models/attention.py): `models/attention.py`

### Evaluation

- [Linear evaluation](https://github.com/swetha4444/spiking-har-ssl/blob/main/trainer.py): `trainer.py`
- [Checkpoint probing](https://github.com/swetha4444/spiking-har-ssl/blob/main/mlp_lincls_from_simclr_ckpt.py): `mlp_lincls_from_simclr_ckpt.py`
- [Experiment metrics](https://github.com/swetha4444/spiking-har-ssl/tree/main/results): `results`
- [Sparsity utilities](https://github.com/swetha4444/spiking-har-ssl/blob/main/utils.py): `utils.py`

### Other components

- **Researcher**

## Connections

- Researcher → Research SSL entry: configures run (evidence: `README.md`)
- Researcher → Standard SSL entry: starts baseline (evidence: `README.md`)
- Researcher → Supervised entry: starts training (evidence: `README.md`)
- WISDM recordings → WISDM preprocessing: provides recordings (evidence: `data_preprocess/data_preprocess_wisdm.py`)
- HAR loaders → Window utilities: uses windowing (evidence: `data_preprocess/data_preprocess_hhar.py`)
- HAR loaders → WISDM preprocessing: loads WISDM (evidence: `trainer.py`)
- WISDM preprocessing → Window utilities: uses window utilities (evidence: `data_preprocess/data_preprocess_wisdm.py`)
- Research preprocessing → WISDM preprocessing: extends pipeline (evidence: `data_preprocess/data_preprocess_wisdm_research.py`)
- IMU physics processing → WISDM preprocessing: uses WISDM data (evidence: `data_preprocess/wisdm_imu_physics_preprocess.py`)
- Research SSL entry → Research routing: routes research run (evidence: `main_ssl_research.py`)
- Research SSL entry → Standard SSL entry: reuses entry options (evidence: `main_ssl_research.py`)
- Research routing → Research preprocessing: routes preprocessing (evidence: `trainer_research.py`)
- Research routing → Temporal encodings: routes encoding (evidence: `trainer_research.py`)
- Research routing → Training engine: delegates training (evidence: `trainer_research.py`)
- Standard SSL entry → Training engine: starts SSL training (evidence: `main_ssl.py`)
- Supervised entry → Training engine: uses training engine (evidence: `main.py`)
- Training engine → View augmentations: generates views (evidence: `trainer.py`)
- Training engine → SSL objectives: selects objective (evidence: `trainer.py`)
- SSL objectives → ANN backbones: uses encoders (evidence: `models/frameworks.py`)
- SSL objectives → Loss functions: uses losses
- Training engine → HAR loaders: loads HAR datasets (evidence: `trainer.py`)
- Training engine → Residual CNN: supports backbone (evidence: `trainer.py`)
- Training engine → ViT1D: supports backbone (evidence: `trainer.py`)
- Training engine → Spiking backbones: supports backbone (evidence: `trainer.py`)
- Training engine → iSpikformer: supports backbone (evidence: `trainer.py`)
- Training engine → SpikeFormer: supports backbone (evidence: `README.md`)
- ANN backbones → Attention layers: uses attention layers (evidence: `models/backbones.py`)
- Spiking backbones → ANN backbones: extends backbones (evidence: `models/spike.py`)
- Training engine → Linear evaluation: runs linear probe (evidence: `README.md`)
- Researcher → Checkpoint probing: probes checkpoint (evidence: `README.md`)
- Training engine → Sparsity utilities: reports sparsity (evidence: `trainer.py`)
- Linear evaluation → Experiment metrics: records results
