# nalambeemasatyasai-dev/final-year-project architecture

> Architecture diagram of the GitHub repository nalambeemasatyasai-dev/final-year-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nalambeemasatyasai-dev/final-year-project
- Repository: https://github.com/nalambeemasatyasai-dev/final-year-project

## Overview

This repository is a research system for classifying student engagement as disengaged, nominally engaged, or highly engaged. Its primary user workflow is a Streamlit dashboard that accepts an image, runs face and FACS processing plus model inference, and archives results. The research workflow extracts FACS features, evaluates classical classifiers, trains multimodal and image-only deep models, and fits an ensemble; AU mapping provides a separate analysis branch. Edges reflect README statements and shown source/index references; some runtime details are unsampled, so unsupported links are omitted.

Main entry points: [`inference_engine.py`](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/inference_engine.py) (Inference and archive), [`DL_models/dual_branch_network.py`](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/dual_branch_network.py) (Dual-branch network), [`run_master_pipeline.py`](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/run_master_pipeline.py) (Master experiment pipeline), [`fit_ui_ensemble.py`](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/fit_ui_ensemble.py) (Ensemble fitting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_live["Live inference"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_inference["Inference and archive"]
  node_prediction["Prediction entry point"]
  node_ensemble["UI ensemble<br/>[ui_ensemble.py]"]
end

subgraph group_features["FACS analysis"]
  node_extractor["Blendshape extractor"]
  node_batch["Batch extraction"]
  node_au["AU mapping analysis"]
end

subgraph group_classical["Classical learning"]
  node_mltrain["Classical training"]
  node_mleval["Classifier evaluation"]
end

subgraph group_deep["Deep learning"]
  node_data["Multimodal data pipeline"]
  node_network["Dual-branch network"]
  node_dltrain["Deep model training"]
  node_hpo["Hyperparameter search"]
  node_gradcam["Grad-CAM analysis"]
  node_fit["Ensemble fitting<br/>[fit_ui_ensemble.py]"]
end

subgraph group_research["Experiment orchestration"]
  node_master["Master experiment pipeline"]
end

node_user(("Dashboard user"))

node_user -->|"submits image"| node_dashboard
node_dashboard -->|"requests inference"| node_inference
node_prediction -->|"uses engine"| node_inference
node_inference -->|"extracts FACS"| node_extractor
node_inference -->|"loads models"| node_network
node_inference -->|"uses data utilities"| node_data
node_inference -->|"uses ensemble"| node_ensemble
node_batch -->|"uses extractor"| node_extractor
node_mltrain -->|"evaluates classifiers"| node_mleval
node_dltrain -->|"loads batches"| node_data
node_dltrain -->|"trains model"| node_network
node_hpo -->|"loads batches"| node_data
node_hpo -->|"optimizes model"| node_network
node_gradcam -->|"visualizes model"| node_network
node_gradcam -->|"uses FACS extraction"| node_extractor
node_fit -->|"loads validation data"| node_data
node_fit -->|"loads models"| node_network
node_fit -->|"fits ensemble config"| node_ensemble
node_master -->|"runs AU analysis"| node_au
node_master -->|"runs classical training"| node_mltrain
node_master -->|"runs deep training"| node_dltrain
node_master -->|"runs ensemble fitting"| node_fit

click node_dashboard "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/app.py"
click node_inference "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/inference_engine.py"
click node_prediction "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/predict_engagement.py"
click node_ensemble "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/ui_ensemble.py"
click node_extractor "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/Feature_extract/mediapipe_facs_extractor.py"
click node_batch "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/Feature_extract/batch_extract_blendshapes.py"
click node_au "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/AU_mappings/generate_facs_heatmaps.py"
click node_mltrain "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/ML_models/train_gbdt_classifiers.py"
click node_mleval "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/ML_models/gbdt_classifier_evaluator.py"
click node_data "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/multimodal_dataloader.py"
click node_network "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/dual_branch_network.py"
click node_dltrain "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/train_deep_learning.py"
click node_hpo "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/optuna_hyperparameter_search.py"
click node_gradcam "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/visualize_gradcam.py"
click node_fit "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/fit_ui_ensemble.py"
click node_master "https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/run_master_pipeline.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_dashboard,node_inference,node_prediction,node_ensemble,node_user toneBlue
class node_extractor,node_batch,node_au toneAmber
class node_mltrain,node_mleval toneMint
class node_data,node_network,node_dltrain,node_hpo,node_gradcam,node_fit toneRose
class node_master toneIndigo
```

## Components

### Live inference

- [Streamlit dashboard](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/app.py): `app.py`
- [Inference and archive](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/inference_engine.py): `inference_engine.py`
- [Prediction entry point](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/predict_engagement.py): `predict_engagement.py`
- [UI ensemble](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/ui_ensemble.py): `ui_ensemble.py`

### FACS analysis

- [Blendshape extractor](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/Feature_extract/mediapipe_facs_extractor.py): `Feature_extract/mediapipe_facs_extractor.py`
- [Batch extraction](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/Feature_extract/batch_extract_blendshapes.py): `Feature_extract/batch_extract_blendshapes.py`
- [AU mapping analysis](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/AU_mappings/generate_facs_heatmaps.py): `AU_mappings/generate_facs_heatmaps.py`

### Classical learning

- [Classical training](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/ML_models/train_gbdt_classifiers.py): `ML_models/train_gbdt_classifiers.py`
- [Classifier evaluation](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/ML_models/gbdt_classifier_evaluator.py): `ML_models/gbdt_classifier_evaluator.py`

### Deep learning

- [Multimodal data pipeline](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/multimodal_dataloader.py): `DL_models/multimodal_dataloader.py`
- [Dual-branch network](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/dual_branch_network.py): `DL_models/dual_branch_network.py`
- [Deep model training](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/train_deep_learning.py): `DL_models/train_deep_learning.py`
- [Hyperparameter search](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/optuna_hyperparameter_search.py): `DL_models/optuna_hyperparameter_search.py`
- [Grad-CAM analysis](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/DL_models/visualize_gradcam.py): `DL_models/visualize_gradcam.py`
- [Ensemble fitting](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/fit_ui_ensemble.py): `fit_ui_ensemble.py`

### Experiment orchestration

- [Master experiment pipeline](https://github.com/nalambeemasatyasai-dev/final-year-project/blob/main/run_master_pipeline.py): `run_master_pipeline.py`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Streamlit dashboard: submits image (evidence: `README.md`)
- Streamlit dashboard → Inference and archive: requests inference (evidence: `app.py`)
- Prediction entry point → Inference and archive: uses engine (evidence: `predict_engagement.py`)
- Inference and archive → Blendshape extractor: extracts FACS (evidence: `inference_engine.py`)
- Inference and archive → Dual-branch network: loads models (evidence: `inference_engine.py`)
- Inference and archive → Multimodal data pipeline: uses data utilities (evidence: `inference_engine.py`)
- Inference and archive → UI ensemble: uses ensemble (evidence: `inference_engine.py`)
- Batch extraction → Blendshape extractor: uses extractor (evidence: `Feature_extract/batch_extract_blendshapes.py`)
- Classical training → Classifier evaluation: evaluates classifiers (evidence: `ML_models/train_gbdt_classifiers.py`)
- Deep model training → Multimodal data pipeline: loads batches (evidence: `DL_models/train_deep_learning.py`)
- Deep model training → Dual-branch network: trains model (evidence: `DL_models/train_deep_learning.py`)
- Hyperparameter search → Multimodal data pipeline: loads batches (evidence: `DL_models/optuna_hyperparameter_search.py`)
- Hyperparameter search → Dual-branch network: optimizes model (evidence: `DL_models/optuna_hyperparameter_search.py`)
- Grad-CAM analysis → Dual-branch network: visualizes model (evidence: `DL_models/visualize_gradcam.py`)
- Grad-CAM analysis → Blendshape extractor: uses FACS extraction (evidence: `DL_models/visualize_gradcam.py`)
- Ensemble fitting → Multimodal data pipeline: loads validation data (evidence: `fit_ui_ensemble.py`)
- Ensemble fitting → Dual-branch network: loads models (evidence: `fit_ui_ensemble.py`)
- Ensemble fitting → UI ensemble: fits ensemble config (evidence: `fit_ui_ensemble.py`)
- Master experiment pipeline → AU mapping analysis: runs AU analysis (evidence: `run_master_pipeline.py`)
- Master experiment pipeline → Classical training: runs classical training (evidence: `run_master_pipeline.py`)
- Master experiment pipeline → Deep model training: runs deep training (evidence: `run_master_pipeline.py`)
- Master experiment pipeline → Ensemble fitting: runs ensemble fitting (evidence: `run_master_pipeline.py`)
