# ethos-lab/biosignal-auth-harmful architecture

> Architecture diagram of the GitHub repository ethos-lab/biosignal-auth-harmful, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ethos-lab/biosignal-auth-harmful
- Repository: https://github.com/ethos-lab/biosignal-auth-harmful

## Overview

This repository supports biosignal-spoofing research: shared dataset loading and processing feed CycleGAN-style signal generation, while a collection of ECG, PPG, BCG, and SCG authentication implementations evaluates original and spoofed signals. The principal workflow is configure/load paired biosignals, train a translator, then prepare or segment authentication data, train or load an identity model, and evaluate spoof acceptance. Edges reflect README statements and shown source references; several authentication implementations are represented by their directory because their runtime wiring was not sampled.

Main entry points: [`custom_datasets/custom_datasets/datasets.py`](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/custom_datasets/custom_datasets/datasets.py) (Dataset access), [`model_training/train_contrastive_cardiogan.py`](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/train_contrastive_cardiogan.py) (Translator training), [`authentication_systems/ECG/EDITH`](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/ECG/EDITH) (EDITH authentication), [`model_training/datasets`](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/model_training/datasets) (Dataset adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Shared data"]
  node_dataset_api["Dataset access<br/>[datasets.py]"]
  node_dataset_props["Dataset properties<br/>[properties.py]"]
  node_signal_ops["Signal processing<br/>[processing.py]"]
end

subgraph group_spoof["Spoof generation"]
  node_dual_dataset["Paired datasets"]
  node_dataset_metadata["Dataset metadata"]
  node_dataset_utils["Training data utilities<br/>[dataset_utils.py]"]
  node_dataset_adapters["Dataset adapters"]
  node_gan_train["Translator training"]
  node_gan_models["Generator networks<br/>[yhcardiogan.py]"]
  node_gan_losses["Training losses<br/>[losses.py]"]
  node_training_utils["Generation utilities<br/>[utils.py]"]
end

subgraph group_ecg["ECG authentication"]
  node_deepecg_data["DeepECG preparation<br/>[dataset.py]"]
  node_deepecg_signal["DeepECG signals"]
  node_deepecg_system["DeepECG authentication"]
  node_extractor_prepare["ECGXtractor preparation<br/>[prepare_dataset.py]"]
  node_extractor_loader["ECGXtractor loader<br/>[loader.py]"]
  node_extractor_network["Siamese network"]
  node_extractor_runtime["ECGXtractor runtime<br/>[util.py]"]
  node_edith_segments["EDITH segmentation<br/>[segment_signals.py]"]
  node_edith_models["EDITH models<br/>[torchmodels.py]"]
  node_edith_utils["EDITH training utilities<br/>[train_utils.py]"]
  node_edith_system["EDITH authentication"]
  node_keyheart_system["KeyToYourHeart"]
end

subgraph group_other_auth["Other authentication"]
  node_cornet_data["CorNET data<br/>[datasets.py]"]
  node_cornet_model["CorNET model<br/>[model.py]"]
  node_cornet_system["CorNET training and evaluation"]
  node_hwang_system["Hwang2020 authentication"]
  node_bcg_systems["BCG authentication"]
  node_scg_systems["SCG authentication"]
end

node_researcher(("Researcher"))

node_researcher -->|"requests signals"| node_dataset_api
node_dataset_api -->|"reads configuration"| node_dataset_props
node_dataset_api -->|"uses processing"| node_signal_ops
node_dual_dataset -->|"uses metadata"| node_dataset_metadata
node_dataset_adapters -->|"extends dataset"| node_dual_dataset
node_dataset_adapters -->|"uses utilities"| node_dataset_utils
node_dataset_adapters -->|"loads raw pairs"| node_dataset_api
node_researcher -->|"starts training"| node_gan_train
node_gan_train -->|"loads batches"| node_dataset_adapters
node_gan_train -->|"builds networks"| node_gan_models
node_gan_train -->|"selects losses"| node_gan_losses
node_gan_train -->|"uses utilities"| node_training_utils
node_researcher -->|"prepares evaluation data"| node_extractor_prepare
node_extractor_prepare -->|"loads signals"| node_dataset_api
node_extractor_runtime -->|"uses loader"| node_extractor_loader
node_extractor_runtime -->|"uses network"| node_extractor_network
node_extractor_network -->|"compiles through"| node_extractor_runtime
node_deepecg_data -->|"loads signals"| node_dataset_api
node_deepecg_data -->|"processes signals"| node_deepecg_signal
node_edith_system -->|"loads signals"| node_dataset_api
node_edith_system -->|"segments signals"| node_edith_segments
node_edith_system -->|"uses models"| node_edith_models
node_edith_system -->|"uses utilities"| node_edith_utils
node_cornet_system -->|"prepares data"| node_cornet_data
node_cornet_system -->|"evaluates model"| node_cornet_model
node_hwang_system -->|"loads signals"| node_dataset_api
node_hwang_system -->|"uses processing"| node_signal_ops
node_bcg_systems -->|"loads signals"| node_dataset_api
node_scg_systems -->|"loads signals"| node_dataset_api
node_scg_systems -->|"uses processing"| node_signal_ops
node_researcher -->|"trains and evaluates"| node_deepecg_system
node_researcher -->|"trains and evaluates"| node_edith_system
node_researcher -->|"trains and evaluates"| node_keyheart_system
node_researcher -->|"trains and evaluates"| node_cornet_system
node_researcher -->|"evaluates"| node_hwang_system
node_researcher -.->|"evaluates"| node_bcg_systems
node_researcher -.->|"evaluates"| node_scg_systems

click node_dataset_api "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/custom_datasets/custom_datasets/datasets.py"
click node_dataset_props "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/custom_datasets/custom_datasets/properties.py"
click node_signal_ops "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/custom_datasets/custom_datasets/processing.py"
click node_dual_dataset "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/datasets/base_dual_dataset.py"
click node_dataset_metadata "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/datasets/dataset_metadata.py"
click node_dataset_utils "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/datasets/dataset_utils.py"
click node_dataset_adapters "https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/model_training/datasets"
click node_gan_train "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/train_contrastive_cardiogan.py"
click node_gan_models "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/models/yhcardiogan.py"
click node_gan_losses "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/losses.py"
click node_training_utils "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/utils.py"
click node_deepecg_data "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/DeepECG/dataset.py"
click node_deepecg_signal "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/DeepECG/signal_processing.py"
click node_deepecg_system "https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/ECG/DeepECG"
click node_extractor_prepare "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/ECGXtractor/src/prepare_dataset.py"
click node_extractor_loader "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/ECGXtractor/src/loader.py"
click node_extractor_network "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/ECGXtractor/src/network_authentication_siamese_CNN.py"
click node_extractor_runtime "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/ECGXtractor/src/util.py"
click node_edith_segments "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/EDITH/segment_signals.py"
click node_edith_models "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/EDITH/torchmodels.py"
click node_edith_utils "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/EDITH/train_utils.py"
click node_edith_system "https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/ECG/EDITH"
click node_keyheart_system "https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/ECG/KeyToYourHeart"
click node_cornet_data "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/PPG/CorNet/datasets.py"
click node_cornet_model "https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/PPG/CorNet/model.py"
click node_cornet_system "https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/PPG/CorNet"
click node_hwang_system "https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/PPG/Hwang2020"
click node_bcg_systems "https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/BCG"
click node_scg_systems "https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/SCG"

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_dataset_api,node_dataset_props,node_signal_ops toneBlue
class node_dual_dataset,node_dataset_metadata,node_dataset_utils,node_dataset_adapters,node_gan_train,node_gan_models,node_gan_losses,node_training_utils toneAmber
class node_deepecg_data,node_deepecg_signal,node_deepecg_system,node_extractor_prepare,node_extractor_loader,node_extractor_network,node_extractor_runtime,node_edith_segments,node_edith_models,node_edith_utils,node_edith_system,node_keyheart_system toneMint
class node_cornet_data,node_cornet_model,node_cornet_system,node_hwang_system,node_bcg_systems,node_scg_systems toneRose
class node_researcher toneIndigo
```

## Components

### Shared data

- [Dataset access](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/custom_datasets/custom_datasets/datasets.py): `custom_datasets/custom_datasets/datasets.py`
- [Dataset properties](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/custom_datasets/custom_datasets/properties.py): `custom_datasets/custom_datasets/properties.py`
- [Signal processing](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/custom_datasets/custom_datasets/processing.py): `custom_datasets/custom_datasets/processing.py`

### Spoof generation

- [Paired datasets](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/datasets/base_dual_dataset.py): `model_training/datasets/base_dual_dataset.py`
- [Dataset metadata](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/datasets/dataset_metadata.py): `model_training/datasets/dataset_metadata.py`
- [Training data utilities](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/datasets/dataset_utils.py): `model_training/datasets/dataset_utils.py`
- [Dataset adapters](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/model_training/datasets): `model_training/datasets`
- [Translator training](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/train_contrastive_cardiogan.py): `model_training/train_contrastive_cardiogan.py`
- [Generator networks](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/models/yhcardiogan.py): `model_training/models/yhcardiogan.py`
- [Training losses](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/losses.py): `model_training/losses.py`
- [Generation utilities](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/model_training/utils.py): `model_training/utils.py`

### ECG authentication

- [DeepECG preparation](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/DeepECG/dataset.py): `authentication_systems/ECG/DeepECG/dataset.py`
- [DeepECG signals](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/DeepECG/signal_processing.py): `authentication_systems/ECG/DeepECG/signal_processing.py`
- [DeepECG authentication](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/ECG/DeepECG): `authentication_systems/ECG/DeepECG`
- [ECGXtractor preparation](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/ECGXtractor/src/prepare_dataset.py): `authentication_systems/ECG/ECGXtractor/src/prepare_dataset.py`
- [ECGXtractor loader](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/ECGXtractor/src/loader.py): `authentication_systems/ECG/ECGXtractor/src/loader.py`
- [Siamese network](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/ECGXtractor/src/network_authentication_siamese_CNN.py): `authentication_systems/ECG/ECGXtractor/src/network_authentication_siamese_CNN.py`
- [ECGXtractor runtime](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/ECGXtractor/src/util.py): `authentication_systems/ECG/ECGXtractor/src/util.py`
- [EDITH segmentation](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/EDITH/segment_signals.py): `authentication_systems/ECG/EDITH/segment_signals.py`
- [EDITH models](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/EDITH/torchmodels.py): `authentication_systems/ECG/EDITH/torchmodels.py`
- [EDITH training utilities](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/ECG/EDITH/train_utils.py): `authentication_systems/ECG/EDITH/train_utils.py`
- [EDITH authentication](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/ECG/EDITH): `authentication_systems/ECG/EDITH`
- [KeyToYourHeart](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/ECG/KeyToYourHeart): `authentication_systems/ECG/KeyToYourHeart`

### Other authentication

- [CorNET data](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/PPG/CorNet/datasets.py): `authentication_systems/PPG/CorNet/datasets.py`
- [CorNET model](https://github.com/ethos-lab/biosignal-auth-harmful/blob/main/authentication_systems/PPG/CorNet/model.py): `authentication_systems/PPG/CorNet/model.py`
- [CorNET training and evaluation](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/PPG/CorNet): `authentication_systems/PPG/CorNet`
- [Hwang2020 authentication](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/PPG/Hwang2020): `authentication_systems/PPG/Hwang2020`
- [BCG authentication](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/BCG): `authentication_systems/BCG`
- [SCG authentication](https://github.com/ethos-lab/biosignal-auth-harmful/tree/main/authentication_systems/SCG): `authentication_systems/SCG`

### Other components

- **Researcher**

## Connections

- Researcher → Dataset access: requests signals
- Dataset access → Dataset properties: reads configuration (evidence: `custom_datasets/custom_datasets/datasets.py`)
- Dataset access → Signal processing: uses processing (evidence: `custom_datasets/custom_datasets/datasets.py`)
- Paired datasets → Dataset metadata: uses metadata (evidence: `model_training/datasets/base_dual_dataset.py`)
- Dataset adapters → Paired datasets: extends dataset (evidence: `model_training/datasets/ecgppg_dalia.py`)
- Dataset adapters → Training data utilities: uses utilities (evidence: `model_training/datasets/ecgppg_dalia.py`)
- Dataset adapters → Dataset access: loads raw pairs (evidence: `model_training/datasets/ecgppg_dalia.py`)
- Researcher → Translator training: starts training
- Translator training → Dataset adapters: loads batches (evidence: `model_training/train_contrastive_cardiogan.py`)
- Translator training → Generator networks: builds networks (evidence: `model_training/train_contrastive_cardiogan.py`)
- Translator training → Training losses: selects losses (evidence: `model_training/train_contrastive_cardiogan.py`)
- Translator training → Generation utilities: uses utilities (evidence: `model_training/train_contrastive_cardiogan.py`)
- Researcher → ECGXtractor preparation: prepares evaluation data
- ECGXtractor preparation → Dataset access: loads signals
- ECGXtractor runtime → ECGXtractor loader: uses loader (evidence: `authentication_systems/ECG/ECGXtractor/src/util.py`)
- ECGXtractor runtime → Siamese network: uses network (evidence: `authentication_systems/ECG/ECGXtractor/src/util.py`)
- Siamese network → ECGXtractor runtime: compiles through (evidence: `authentication_systems/ECG/ECGXtractor/src/network_authentication_siamese_CNN.py`)
- DeepECG preparation → Dataset access: loads signals (evidence: `authentication_systems/ECG/DeepECG/dataset.py`)
- DeepECG preparation → DeepECG signals: processes signals (evidence: `authentication_systems/ECG/DeepECG/dataset.py`)
- EDITH authentication → Dataset access: loads signals (evidence: `authentication_systems/ECG/EDITH/train_siamese.py`)
- EDITH authentication → EDITH segmentation: segments signals (evidence: `authentication_systems/ECG/EDITH/train_siamese.py`)
- EDITH authentication → EDITH models: uses models (evidence: `authentication_systems/ECG/EDITH/train_siamese.py`)
- EDITH authentication → EDITH training utilities: uses utilities (evidence: `authentication_systems/ECG/EDITH/train_siamese.py`)
- CorNET training and evaluation → CorNET data: prepares data (evidence: `authentication_systems/PPG/CorNet/eval.py`)
- CorNET training and evaluation → CorNET model: evaluates model (evidence: `authentication_systems/PPG/CorNet/eval.py`)
- Hwang2020 authentication → Dataset access: loads signals (evidence: `authentication_systems/PPG/Hwang2020/eval.py`)
- Hwang2020 authentication → Signal processing: uses processing (evidence: `authentication_systems/PPG/Hwang2020/eval.py`)
- BCG authentication → Dataset access: loads signals (evidence: `authentication_systems/BCG/ZhangRNN/eval.py`)
- SCG authentication → Dataset access: loads signals (evidence: `authentication_systems/SCG/MotionArtifactResilient/eval.py`)
- SCG authentication → Signal processing: uses processing (evidence: `authentication_systems/SCG/HsuWaveletTransform/train_and_eval.py`)
- Researcher → DeepECG authentication: trains and evaluates
- Researcher → EDITH authentication: trains and evaluates
- Researcher → KeyToYourHeart: trains and evaluates
- Researcher → CorNET training and evaluation: trains and evaluates
- Researcher → Hwang2020 authentication: evaluates
- Researcher → BCG authentication: evaluates
- Researcher → SCG authentication: evaluates
