# ciaranm1999/thesis-edge-ai architecture

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

- Interactive diagram: https://gitdiagram.com/ciaranm1999/thesis-edge-ai
- Repository: https://github.com/ciaranm1999/thesis-edge-ai

## Overview

Thesis-Edge-AI is a multi-node cold-chain mould-monitoring research system. Sensor nodes collect environmental readings; ESP-NOW delivers them to a master, which forwards them over UART to Raspberry Pi collection and camera-based labelling. Offline preparation and training produce datasets and models deployed to ESP32 benchmarks for inference or on-device learning, with energy measured using a PPK2. The README documents the end-to-end workflow and capabilities; source excerpts and the index clarify selected dataset/model dependencies, but do not establish every runtime connection.

Main entry points: [`RaspberryPi`](https://github.com/ciaranm1999/thesis-edge-ai/tree/main/RaspberryPi) (Batch data), [`ML_Training/energy_analysis.ipynb`](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/energy_analysis.ipynb) (Energy profiling), [`ML_Training/esp32_datasets/mould_prediction_dataset.h`](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/mould_prediction_dataset.h) (Prediction dataset), [`ESP32/src/tinyol_benchmark.cpp`](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/tinyol_benchmark.cpp) (TinyOL adaptation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensing and transport"]
  node_sensor_nodes["Sensor nodes<br/>[Node_Main.cpp]"]
  node_master["Master node"]
end

subgraph group_edge["Edge inference"]
  node_aifes_infer["AIfES inference"]
  node_tflm_infer["TFLM inference<br/>[tflm_inference.cpp]"]
  node_tinyol["TinyOL adaptation"]
  node_aifes_train["AIfES on-device training"]
end

subgraph group_data["Collection and ML pipeline"]
  node_pi_collector["UART collector"]
  node_pi_camera["Camera labelling"]
  node_pi_storage[("Batch data")]
  node_dashboard["Live dashboard<br/>[web_dashboard.py]"]
  node_prepare["Dataset preparation<br/>[prepare_dataset.py]"]
  node_train["Model training<br/>[train_model.py]"]
  node_tinyol_train["TinyOL backbone training"]
  node_mould_data["Prediction dataset"]
  node_combined_data["Training corpus"]
  node_heldout_data["Held-out dataset<br/>[held_out_dataset.h]"]
  node_aifes_weights["AIfES weights<br/>[aifes_weights.h]"]
  node_tinyol_weights["TinyOL weights<br/>[tinyol_weights.h]"]
  node_tflm_model["TFLM model<br/>[tflm_model.h]"]
end

subgraph group_research["Analysis and reporting"]
  node_ppk2["Energy profiling"]
  node_batch_analysis["Batch analysis"]
  node_report["Thesis report<br/>[main.tex]"]
end

node_environment(("Cold-chain environment"))

node_environment -->|"provides readings"| node_sensor_nodes
node_sensor_nodes -->|"sends ESP-NOW"| node_master
node_master -->|"forwards UART"| node_pi_collector
node_pi_collector -->|"logs readings"| node_pi_storage
node_pi_camera -->|"pairs images"| node_pi_storage
node_pi_storage -->|"supplies batches"| node_prepare
node_pi_storage -.->|"serves live data"| node_dashboard
node_prepare -->|"exports dataset"| node_mould_data
node_prepare -->|"prepares splits"| node_train
node_train -->|"exports weights"| node_aifes_weights
node_train -->|"exports model"| node_tflm_model
node_train -->|"provides backbone data"| node_tinyol_train
node_tinyol_train -.->|"exports weights"| node_tinyol_weights
node_aifes_infer -->|"loads weights"| node_aifes_weights
node_aifes_infer -->|"evaluates samples"| node_mould_data
node_tflm_infer -->|"loads model"| node_tflm_model
node_tflm_infer -->|"evaluates samples"| node_mould_data
node_tinyol -->|"loads backbone"| node_tinyol_weights
node_tinyol -->|"adapts on samples"| node_heldout_data
node_tinyol -->|"evaluates samples"| node_mould_data
node_aifes_train -->|"trains on corpus"| node_combined_data
node_aifes_train -->|"evaluates samples"| node_mould_data
node_aifes_train -->|"uses dimensions"| node_aifes_weights
node_aifes_infer -->|"measured by"| node_ppk2
node_tflm_infer -->|"measured by"| node_ppk2
node_tinyol -->|"measured by"| node_ppk2
node_aifes_train -->|"measured by"| node_ppk2
node_pi_storage -->|"analyses batches"| node_batch_analysis
node_ppk2 -.->|"informs research"| node_report

click node_sensor_nodes "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/Node_Main.cpp"
click node_master "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/Master_Node_Main.cpp"
click node_pi_collector "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/RaspberryPi/scripts/uart_data_collector.py"
click node_pi_camera "https://github.com/ciaranm1999/thesis-edge-ai/tree/main/RaspberryPi"
click node_pi_storage "https://github.com/ciaranm1999/thesis-edge-ai/tree/main/RaspberryPi"
click node_dashboard "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/RaspberryPi/scripts/web_dashboard.py"
click node_prepare "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/data_preparation/prepare_dataset.py"
click node_train "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/model_training/train_model.py"
click node_tinyol_train "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/model_training/train_tinyol_backbone.py"
click node_mould_data "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/mould_prediction_dataset.h"
click node_combined_data "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/combined_training_dataset.h"
click node_heldout_data "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/held_out_dataset.h"
click node_aifes_weights "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/aifes_weights.h"
click node_tinyol_weights "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/tinyol_weights.h"
click node_tflm_model "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/tflm_model.h"
click node_aifes_infer "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/aifes_inference.cpp"
click node_tflm_infer "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/tflm_inference.cpp"
click node_tinyol "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/tinyol_benchmark.cpp"
click node_aifes_train "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/aifes_training_benchmark.cpp"
click node_ppk2 "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/energy_analysis.ipynb"
click node_batch_analysis "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/RaspberryPi/analysis/batch_analysis.ipynb"
click node_report "https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ThesisReport/Report/main.tex"

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_sensor_nodes,node_master toneBlue
class node_aifes_infer,node_tflm_infer,node_tinyol,node_aifes_train toneAmber
class node_pi_collector,node_pi_camera,node_pi_storage,node_dashboard,node_prepare,node_train,node_tinyol_train,node_mould_data,node_combined_data,node_heldout_data,node_aifes_weights,node_tinyol_weights,node_tflm_model toneMint
class node_ppk2,node_batch_analysis,node_report toneRose
class node_environment toneIndigo
```

## Components

### Sensing and transport

- [Sensor nodes](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/Node_Main.cpp): `ESP32/src/Node_Main.cpp`
- [Master node](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/Master_Node_Main.cpp): `ESP32/src/Master_Node_Main.cpp`

### Edge inference

- [AIfES inference](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/aifes_inference.cpp): `ESP32/src/aifes_inference.cpp`
- [TFLM inference](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/tflm_inference.cpp): `ESP32/src/tflm_inference.cpp`
- [TinyOL adaptation](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/tinyol_benchmark.cpp): `ESP32/src/tinyol_benchmark.cpp`
- [AIfES on-device training](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ESP32/src/aifes_training_benchmark.cpp): `ESP32/src/aifes_training_benchmark.cpp`

### Collection and ML pipeline

- [UART collector](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/RaspberryPi/scripts/uart_data_collector.py): `RaspberryPi/scripts/uart_data_collector.py`
- [Camera labelling](https://github.com/ciaranm1999/thesis-edge-ai/tree/main/RaspberryPi): `RaspberryPi`
- [Batch data](https://github.com/ciaranm1999/thesis-edge-ai/tree/main/RaspberryPi): `RaspberryPi`
- [Live dashboard](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/RaspberryPi/scripts/web_dashboard.py): `RaspberryPi/scripts/web_dashboard.py`
- [Dataset preparation](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/data_preparation/prepare_dataset.py): `ML_Training/data_preparation/prepare_dataset.py`
- [Model training](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/model_training/train_model.py): `ML_Training/model_training/train_model.py`
- [TinyOL backbone training](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/model_training/train_tinyol_backbone.py): `ML_Training/model_training/train_tinyol_backbone.py`
- [Prediction dataset](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/mould_prediction_dataset.h): `ML_Training/esp32_datasets/mould_prediction_dataset.h`
- [Training corpus](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/combined_training_dataset.h): `ML_Training/esp32_datasets/combined_training_dataset.h`
- [Held-out dataset](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/held_out_dataset.h): `ML_Training/esp32_datasets/held_out_dataset.h`
- [AIfES weights](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/aifes_weights.h): `ML_Training/esp32_datasets/aifes_weights.h`
- [TinyOL weights](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/tinyol_weights.h): `ML_Training/esp32_datasets/tinyol_weights.h`
- [TFLM model](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/esp32_datasets/tflm_model.h): `ML_Training/esp32_datasets/tflm_model.h`

### Analysis and reporting

- [Energy profiling](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ML_Training/energy_analysis.ipynb): `ML_Training/energy_analysis.ipynb`
- [Batch analysis](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/RaspberryPi/analysis/batch_analysis.ipynb): `RaspberryPi/analysis/batch_analysis.ipynb`
- [Thesis report](https://github.com/ciaranm1999/thesis-edge-ai/blob/main/ThesisReport/Report/main.tex): `ThesisReport/Report/main.tex`

### Other components

- **Cold-chain environment**

## Connections

- Cold-chain environment → Sensor nodes: provides readings (evidence: `README.md`)
- Sensor nodes → Master node: sends ESP-NOW (evidence: `README.md`)
- Master node → UART collector: forwards UART (evidence: `README.md`)
- UART collector → Batch data: logs readings (evidence: `README.md`)
- Camera labelling → Batch data: pairs images (evidence: `README.md`)
- Batch data → Dataset preparation: supplies batches (evidence: `README.md`)
- Batch data → Live dashboard: serves live data
- Dataset preparation → Prediction dataset: exports dataset (evidence: `README.md`)
- Dataset preparation → Model training: prepares splits (evidence: `README.md`)
- Model training → AIfES weights: exports weights (evidence: `ML_Training/model_training/train_model.py`)
- Model training → TFLM model: exports model (evidence: `ML_Training/model_training/train_model.py`)
- Model training → TinyOL backbone training: provides backbone data (evidence: `README.md`)
- TinyOL backbone training → TinyOL weights: exports weights
- AIfES inference → AIfES weights: loads weights (evidence: `ESP32/src/aifes_inference.cpp`)
- AIfES inference → Prediction dataset: evaluates samples (evidence: `ESP32/src/aifes_inference.cpp`)
- TFLM inference → TFLM model: loads model (evidence: `ESP32/src/tflm_inference.cpp`)
- TFLM inference → Prediction dataset: evaluates samples (evidence: `ESP32/src/tflm_inference.cpp`)
- TinyOL adaptation → TinyOL weights: loads backbone (evidence: `ESP32/src/tinyol_benchmark.cpp`)
- TinyOL adaptation → Held-out dataset: adapts on samples (evidence: `ESP32/src/tinyol_benchmark.cpp`)
- TinyOL adaptation → Prediction dataset: evaluates samples (evidence: `ESP32/src/tinyol_benchmark.cpp`)
- AIfES on-device training → Training corpus: trains on corpus (evidence: `ESP32/src/aifes_training_benchmark.cpp`)
- AIfES on-device training → Prediction dataset: evaluates samples (evidence: `ESP32/src/aifes_training_benchmark.cpp`)
- AIfES on-device training → AIfES weights: uses dimensions (evidence: `ESP32/src/aifes_training_benchmark.cpp`)
- AIfES inference → Energy profiling: measured by (evidence: `README.md`)
- TFLM inference → Energy profiling: measured by (evidence: `README.md`)
- TinyOL adaptation → Energy profiling: measured by (evidence: `README.md`)
- AIfES on-device training → Energy profiling: measured by (evidence: `README.md`)
- Batch data → Batch analysis: analyses batches (evidence: `README.md`)
- Energy profiling → Thesis report: informs research
