# besteaydogan/smart-vest-ai architecture

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

- Interactive diagram: https://gitdiagram.com/besteaydogan/smart-vest-ai
- Repository: https://github.com/besteaydogan/smart-vest-ai

## Overview

Smart Vest AI is a fall-detection prototype: SisFall recordings are transformed into window features, used to train and evaluate classifiers, then processed as streaming decisions and optionally exported for embedded inference. The graph preserves the documented preprocessing, LOSO evaluation, threshold/FSM analysis, real-time simulation, stress testing, and model-export branches. README statements support the high-level workflow; source excerpts and the SOURCE INDEX support the narrower implementation links. Several listed modules were not sampled, so their internal calls are not inferred.

Main entry points: [`models`](https://github.com/besteaydogan/smart-vest-ai/tree/main/models) (Saved models), [`pencere_motoru.py`](https://github.com/besteaydogan/smart-vest-ai/blob/main/pencere_motoru.py) (Window decision engine), [`train_model.py`](https://github.com/besteaydogan/smart-vest-ai/blob/main/train_model.py) (Model training), [`preprocess.py`](https://github.com/besteaydogan/smart-vest-ai/blob/main/preprocess.py) (Window preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Signal preparation"]
  node_utils["Signal utilities<br/>[utils.py]"]
  node_preprocess["Window preprocessing<br/>[preprocess.py]"]
  node_feature["Feature extraction<br/>[utils.py]"]
end

subgraph group_learning["Modeling and evaluation"]
  node_train["Model training<br/>[train_model.py]"]
  node_strong_model["Model comparison<br/>[guclu_model.py]"]
  node_small_model["Compact model training"]
  node_loso["Subject-independent evaluation<br/>[loso_testi.py]"]
  node_threshold["Confidence analysis<br/>[esik_analizi.py]"]
  node_fsm_opt["FSM tuning<br/>[fsm_optimize.py]"]
  node_model_store[("Saved models")]
  node_reports[("Evaluation reports")]
end

subgraph group_runtime["Fall decision runtime"]
  node_engine["Window decision engine<br/>[pencere_motoru.py]"]
  node_classifier["Streaming classifier"]
  node_realtime_sim["Stream simulation"]
  node_stress["Runtime stress test<br/>[stres_testi.py]"]
  node_fast_stress["Fast stress test"]
end

subgraph group_deployment["Export and integration"]
  node_exporter["C++ model export"]
  node_cpp_header["Embedded model header<br/>[model.h]"]
end

node_dataset[("SisFall recordings")]
node_sensor(("Sensor stream"))
node_alarm(("Alarm or protection"))
node_target["ESP32-S3 firmware"]

node_dataset -->|"provides recordings"| node_preprocess
node_preprocess -->|"uses signal helpers"| node_utils
node_preprocess -->|"extracts features"| node_feature
node_preprocess -->|"prepares training data"| node_train
node_feature -->|"feeds training"| node_train
node_train -->|"persists model"| node_model_store
node_strong_model -->|"exports model"| node_model_store
node_small_model -->|"trains compact model"| node_model_store
node_train -->|"evaluated by"| node_loso
node_train -->|"supports analysis"| node_threshold
node_threshold -->|"tunes confirmation"| node_fsm_opt
node_loso -->|"records results"| node_reports
node_sensor -->|"feeds samples"| node_engine
node_engine -->|"uses filter"| node_utils
node_engine -->|"loads classifier"| node_model_store
node_engine -->|"confirms fall"| node_alarm
node_sensor -->|"feeds samples"| node_classifier
node_classifier -->|"uses filtering"| node_utils
node_classifier -->|"loads classifier"| node_model_store
node_realtime_sim -->|"feeds stream"| node_engine
node_realtime_sim -->|"publishes alarm"| node_alarm
node_stress -->|"exercises engine"| node_engine
node_fast_stress -->|"loads classifier"| node_model_store
node_fast_stress -->|"uses data helpers"| node_utils
node_model_store -->|"supplies trained model"| node_exporter
node_exporter -->|"generates header"| node_cpp_header
node_cpp_header -->|"included for inference"| node_target

click node_utils "https://github.com/besteaydogan/smart-vest-ai/blob/main/utils.py"
click node_preprocess "https://github.com/besteaydogan/smart-vest-ai/blob/main/preprocess.py"
click node_feature "https://github.com/besteaydogan/smart-vest-ai/blob/main/utils.py"
click node_train "https://github.com/besteaydogan/smart-vest-ai/blob/main/train_model.py"
click node_strong_model "https://github.com/besteaydogan/smart-vest-ai/blob/main/guclu_model.py"
click node_small_model "https://github.com/besteaydogan/smart-vest-ai/blob/main/kucuk_model_egit.py"
click node_loso "https://github.com/besteaydogan/smart-vest-ai/blob/main/loso_testi.py"
click node_threshold "https://github.com/besteaydogan/smart-vest-ai/blob/main/esik_analizi.py"
click node_fsm_opt "https://github.com/besteaydogan/smart-vest-ai/blob/main/fsm_optimize.py"
click node_model_store "https://github.com/besteaydogan/smart-vest-ai/tree/main/models"
click node_engine "https://github.com/besteaydogan/smart-vest-ai/blob/main/pencere_motoru.py"
click node_classifier "https://github.com/besteaydogan/smart-vest-ai/blob/main/real_time_classifier.py"
click node_realtime_sim "https://github.com/besteaydogan/smart-vest-ai/blob/main/gercek_zamanli_sim.py"
click node_stress "https://github.com/besteaydogan/smart-vest-ai/blob/main/stres_testi.py"
click node_fast_stress "https://github.com/besteaydogan/smart-vest-ai/blob/main/stres_testi_hizli.py"
click node_exporter "https://github.com/besteaydogan/smart-vest-ai/blob/main/model_translator.py"
click node_cpp_header "https://github.com/besteaydogan/smart-vest-ai/blob/main/models/model.h"
click node_reports "https://github.com/besteaydogan/smart-vest-ai/tree/main/reports"

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_utils,node_preprocess,node_feature toneBlue
class node_train,node_strong_model,node_small_model,node_loso,node_threshold,node_fsm_opt,node_model_store,node_reports,node_dataset toneAmber
class node_engine,node_classifier,node_realtime_sim,node_stress,node_fast_stress toneMint
class node_exporter,node_cpp_header toneRose
class node_sensor,node_alarm,node_target toneIndigo
```

## Components

### Signal preparation

- [Signal utilities](https://github.com/besteaydogan/smart-vest-ai/blob/main/utils.py): `utils.py`
- [Window preprocessing](https://github.com/besteaydogan/smart-vest-ai/blob/main/preprocess.py): `preprocess.py`
- [Feature extraction](https://github.com/besteaydogan/smart-vest-ai/blob/main/utils.py): `utils.py`

### Modeling and evaluation

- [Model training](https://github.com/besteaydogan/smart-vest-ai/blob/main/train_model.py): `train_model.py`
- [Model comparison](https://github.com/besteaydogan/smart-vest-ai/blob/main/guclu_model.py): `guclu_model.py`
- [Compact model training](https://github.com/besteaydogan/smart-vest-ai/blob/main/kucuk_model_egit.py): `kucuk_model_egit.py`
- [Subject-independent evaluation](https://github.com/besteaydogan/smart-vest-ai/blob/main/loso_testi.py): `loso_testi.py`
- [Confidence analysis](https://github.com/besteaydogan/smart-vest-ai/blob/main/esik_analizi.py): `esik_analizi.py`
- [FSM tuning](https://github.com/besteaydogan/smart-vest-ai/blob/main/fsm_optimize.py): `fsm_optimize.py`
- [Saved models](https://github.com/besteaydogan/smart-vest-ai/tree/main/models): `models`
- [Evaluation reports](https://github.com/besteaydogan/smart-vest-ai/tree/main/reports): `reports`

### Fall decision runtime

- [Window decision engine](https://github.com/besteaydogan/smart-vest-ai/blob/main/pencere_motoru.py): `pencere_motoru.py`
- [Streaming classifier](https://github.com/besteaydogan/smart-vest-ai/blob/main/real_time_classifier.py): `real_time_classifier.py`
- [Stream simulation](https://github.com/besteaydogan/smart-vest-ai/blob/main/gercek_zamanli_sim.py): `gercek_zamanli_sim.py`
- [Runtime stress test](https://github.com/besteaydogan/smart-vest-ai/blob/main/stres_testi.py): `stres_testi.py`
- [Fast stress test](https://github.com/besteaydogan/smart-vest-ai/blob/main/stres_testi_hizli.py): `stres_testi_hizli.py`

### Export and integration

- [C++ model export](https://github.com/besteaydogan/smart-vest-ai/blob/main/model_translator.py): `model_translator.py`
- [Embedded model header](https://github.com/besteaydogan/smart-vest-ai/blob/main/models/model.h): `models/model.h`

### Other components

- **SisFall recordings**
- **Sensor stream**
- **Alarm or protection**
- **ESP32-S3 firmware**

## Connections

- SisFall recordings → Window preprocessing: provides recordings (evidence: `README.md`)
- Window preprocessing → Signal utilities: uses signal helpers (evidence: `preprocess.py`)
- Window preprocessing → Feature extraction: extracts features (evidence: `preprocess.py`)
- Window preprocessing → Model training: prepares training data (evidence: `README.md`)
- Feature extraction → Model training: feeds training (evidence: `README.md`)
- Model training → Saved models: persists model (evidence: `README.md`)
- Model comparison → Saved models: exports model (evidence: `guclu_model.py`)
- Compact model training → Saved models: trains compact model (evidence: `README.md`)
- Model training → Subject-independent evaluation: evaluated by (evidence: `README.md`)
- Model training → Confidence analysis: supports analysis (evidence: `README.md`)
- Confidence analysis → FSM tuning: tunes confirmation (evidence: `README.md`)
- Subject-independent evaluation → Evaluation reports: records results (evidence: `README.md`)
- Sensor stream → Window decision engine: feeds samples (evidence: `README.md`)
- Window decision engine → Signal utilities: uses filter (evidence: `pencere_motoru.py`)
- Window decision engine → Saved models: loads classifier (evidence: `pencere_motoru.py`)
- Window decision engine → Alarm or protection: confirms fall (evidence: `README.md`)
- Sensor stream → Streaming classifier: feeds samples (evidence: `README.md`)
- Streaming classifier → Signal utilities: uses filtering (evidence: `real_time_classifier.py`)
- Streaming classifier → Saved models: loads classifier (evidence: `real_time_classifier.py`)
- Stream simulation → Window decision engine: feeds stream (evidence: `gercek_zamanli_sim.py`)
- Stream simulation → Alarm or protection: publishes alarm (evidence: `gercek_zamanli_sim.py`)
- Runtime stress test → Window decision engine: exercises engine (evidence: `stres_testi.py`)
- Fast stress test → Saved models: loads classifier (evidence: `stres_testi_hizli.py`)
- Fast stress test → Signal utilities: uses data helpers (evidence: `stres_testi_hizli.py`)
- Saved models → C++ model export: supplies trained model (evidence: `README.md`)
- C++ model export → Embedded model header: generates header (evidence: `README.md`)
- Embedded model header → ESP32-S3 firmware: included for inference (evidence: `README.md`)
