# hsd1503/resnet1d architecture

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

- Interactive diagram: https://gitdiagram.com/hsd1503/resnet1d
- Repository: https://github.com/hsd1503/resnet1d

## Overview

This repository provides PyTorch models for classifying one-dimensional signals, with ECG classification as a documented use case. In the PhysioNet workflow, preprocessing and dataset utilities prepare labeled, windowed signals; a selected backbone produces class scores, and the supplied checkpoint offers pretrained parameters. The README also documents synthetic-data exercise and optional Ray training/serving, but their implementations are not sampled, so those links are shown as unverified. The graph distinguishes dataset preparation from model architectures; no training orchestrator is inferred.

Main entry points: [`util.py`](https://github.com/hsd1503/resnet1d/blob/master/util.py) (Windowed datasets), [`resnet1d.py`](https://github.com/hsd1503/resnet1d/blob/master/resnet1d.py) (ResNet1D), [`net1d.py`](https://github.com/hsd1503/resnet1d/blob/master/net1d.py) (Net1D), [`acnn1d.py`](https://github.com/hsd1503/resnet1d/blob/master/acnn1d.py) (Attention CNN)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Signal data"]
  node_preprocess["ECG preprocessing<br/>[util.py]"]
  node_dataset["Windowed datasets<br/>[util.py]"]
  node_synthetic["Synthetic signals<br/>[util.py]"]
end

subgraph group_models["Model zoo"]
  node_resnet["ResNet1D<br/>[resnet1d.py]"]
  node_net["Net1D<br/>[net1d.py]"]
  node_acnn["Attention CNN<br/>[acnn1d.py]"]
  node_cnn["CNN Transformer<br/>[cnn1d.py]"]
  node_crnn["CNN LSTM<br/>[crnn1d.py]"]
end

subgraph group_assets["Model assets"]
  node_checkpoint["Pretrained model<br/>[model.pth]"]
end

subgraph group_serving["Serving"]
  node_ray["Ray runtime"]
end

node_physionet(("PhysioNet ECG"))
node_user(("Model user"))

node_physionet -->|"provides recordings"| node_preprocess
node_preprocess -->|"prepares data"| node_dataset
node_dataset -.->|"model input"| node_resnet
node_dataset -.->|"model input"| node_net
node_dataset -.->|"model input"| node_acnn
node_dataset -.->|"model input"| node_cnn
node_dataset -.->|"model input"| node_crnn
node_synthetic -.->|"generates examples"| node_user
node_user -->|"loads parameters"| node_checkpoint
node_user -.->|"trains or serves"| node_ray

click node_preprocess "https://github.com/hsd1503/resnet1d/blob/master/util.py"
click node_dataset "https://github.com/hsd1503/resnet1d/blob/master/util.py"
click node_synthetic "https://github.com/hsd1503/resnet1d/blob/master/util.py"
click node_resnet "https://github.com/hsd1503/resnet1d/blob/master/resnet1d.py"
click node_net "https://github.com/hsd1503/resnet1d/blob/master/net1d.py"
click node_acnn "https://github.com/hsd1503/resnet1d/blob/master/acnn1d.py"
click node_cnn "https://github.com/hsd1503/resnet1d/blob/master/cnn1d.py"
click node_crnn "https://github.com/hsd1503/resnet1d/blob/master/crnn1d.py"
click node_checkpoint "https://github.com/hsd1503/resnet1d/blob/master/trained_model/model.pth"

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_preprocess,node_dataset,node_synthetic,node_user toneBlue
class node_resnet,node_net,node_acnn,node_cnn,node_crnn toneAmber
class node_checkpoint toneMint
class node_ray toneRose
class node_physionet toneIndigo
```

## Components

### Signal data

- [ECG preprocessing](https://github.com/hsd1503/resnet1d/blob/master/util.py): `util.py`
- [Windowed datasets](https://github.com/hsd1503/resnet1d/blob/master/util.py): `util.py`
- [Synthetic signals](https://github.com/hsd1503/resnet1d/blob/master/util.py): `util.py`

### Model zoo

- [ResNet1D](https://github.com/hsd1503/resnet1d/blob/master/resnet1d.py): `resnet1d.py`
- [Net1D](https://github.com/hsd1503/resnet1d/blob/master/net1d.py): `net1d.py`
- [Attention CNN](https://github.com/hsd1503/resnet1d/blob/master/acnn1d.py): `acnn1d.py`
- [CNN Transformer](https://github.com/hsd1503/resnet1d/blob/master/cnn1d.py): `cnn1d.py`
- [CNN LSTM](https://github.com/hsd1503/resnet1d/blob/master/crnn1d.py): `crnn1d.py`

### Model assets

- [Pretrained model](https://github.com/hsd1503/resnet1d/blob/master/trained_model/model.pth): `trained_model/model.pth`

### Serving

- **Ray runtime**

### Other components

- **PhysioNet ECG**
- **Model user**

## Connections

- PhysioNet ECG → ECG preprocessing: provides recordings (evidence: `util.py`)
- ECG preprocessing → Windowed datasets: prepares data (evidence: `util.py`)
- Windowed datasets → ResNet1D: model input
- Windowed datasets → Net1D: model input
- Windowed datasets → Attention CNN: model input
- Windowed datasets → CNN Transformer: model input
- Windowed datasets → CNN LSTM: model input
- Synthetic signals → Model user: generates examples (evidence: `README.md`)
- Model user → Pretrained model: loads parameters (evidence: `README.md`)
- Model user → Ray runtime: trains or serves (evidence: `README.md`)
