# elaattia/facedetectionsystem architecture

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

- Interactive diagram: https://gitdiagram.com/elaattia/facedetectionsystem
- Repository: https://github.com/elaattia/facedetectionsystem

## Overview

This repository is a Streamlit facial-analysis application for detecting face masks and classifying seven emotions from an uploaded image. The principal workflow loads the two model systems, analyzes an image with each available detector, and presents per-model predictions and confidence. The backend modules also contain separate dataset, training, evaluation, and confusion-matrix visualization capabilities. The README is empty; connections below are grounded in the shown excerpts and SOURCE INDEX, so unsampled UI details are not expanded.

Main entry points: [`app/streamlit_app.py`](https://github.com/elaattia/facedetectionsystem/blob/main/app/streamlit_app.py) (Analysis interface), [`backend/face_mask_detector.py`](https://github.com/elaattia/facedetectionsystem/blob/main/backend/face_mask_detector.py) (Mask models), [`backend/emotion_detector.py`](https://github.com/elaattia/facedetectionsystem/blob/main/backend/emotion_detector.py) (Emotion models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["Analysis interface<br/>[streamlit_app.py]"]
end

subgraph group_mask["Mask detection"]
  node_mask_pre["Preprocessing"]
  node_mask_features["Feature extraction"]
  node_mask_system["Mask models"]
  node_mask_data["Dataset loading"]
end

subgraph group_emotion["Emotion detection"]
  node_emotion_pre["Preprocessing"]
  node_emotion_features["Feature extraction"]
  node_emotion_system["Emotion models"]
  node_emotion_data["Dataset loading"]
end

node_user(("Image uploader"))

node_user -->|"uploads image"| node_app
node_app -->|"loads and predicts"| node_mask_system
node_app -->|"loads and predicts"| node_emotion_system
node_mask_system -->|"preprocesses image"| node_mask_pre
node_mask_system -->|"extracts features"| node_mask_features
node_mask_pre -->|"provides image"| node_mask_features
node_mask_data -->|"preprocesses samples"| node_mask_pre
node_mask_data -->|"extracts sample features"| node_mask_features
node_emotion_system -->|"preprocesses image"| node_emotion_pre
node_emotion_system -->|"extracts features"| node_emotion_features
node_emotion_pre -->|"provides image"| node_emotion_features
node_emotion_data -->|"preprocesses samples"| node_emotion_pre
node_emotion_data -->|"extracts sample features"| node_emotion_features

click node_app "https://github.com/elaattia/facedetectionsystem/blob/main/app/streamlit_app.py"
click node_mask_pre "https://github.com/elaattia/facedetectionsystem/blob/main/backend/face_mask_detector.py"
click node_mask_features "https://github.com/elaattia/facedetectionsystem/blob/main/backend/face_mask_detector.py"
click node_mask_system "https://github.com/elaattia/facedetectionsystem/blob/main/backend/face_mask_detector.py"
click node_mask_data "https://github.com/elaattia/facedetectionsystem/blob/main/backend/face_mask_detector.py"
click node_emotion_pre "https://github.com/elaattia/facedetectionsystem/blob/main/backend/emotion_detector.py"
click node_emotion_features "https://github.com/elaattia/facedetectionsystem/blob/main/backend/emotion_detector.py"
click node_emotion_system "https://github.com/elaattia/facedetectionsystem/blob/main/backend/emotion_detector.py"
click node_emotion_data "https://github.com/elaattia/facedetectionsystem/blob/main/backend/emotion_detector.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_app toneBlue
class node_mask_pre,node_mask_features,node_mask_system,node_mask_data toneAmber
class node_emotion_pre,node_emotion_features,node_emotion_system,node_emotion_data toneMint
class node_user toneIndigo
```

## Components

### User interface

- [Analysis interface](https://github.com/elaattia/facedetectionsystem/blob/main/app/streamlit_app.py): `app/streamlit_app.py`

### Mask detection

- [Preprocessing](https://github.com/elaattia/facedetectionsystem/blob/main/backend/face_mask_detector.py): `backend/face_mask_detector.py`
- [Feature extraction](https://github.com/elaattia/facedetectionsystem/blob/main/backend/face_mask_detector.py): `backend/face_mask_detector.py`
- [Mask models](https://github.com/elaattia/facedetectionsystem/blob/main/backend/face_mask_detector.py): `backend/face_mask_detector.py`
- [Dataset loading](https://github.com/elaattia/facedetectionsystem/blob/main/backend/face_mask_detector.py): `backend/face_mask_detector.py`

### Emotion detection

- [Preprocessing](https://github.com/elaattia/facedetectionsystem/blob/main/backend/emotion_detector.py): `backend/emotion_detector.py`
- [Feature extraction](https://github.com/elaattia/facedetectionsystem/blob/main/backend/emotion_detector.py): `backend/emotion_detector.py`
- [Emotion models](https://github.com/elaattia/facedetectionsystem/blob/main/backend/emotion_detector.py): `backend/emotion_detector.py`
- [Dataset loading](https://github.com/elaattia/facedetectionsystem/blob/main/backend/emotion_detector.py): `backend/emotion_detector.py`

### Other components

- **Image uploader**

## Connections

- Image uploader → Analysis interface: uploads image (evidence: `app/streamlit_app.py`)
- Analysis interface → Mask models: loads and predicts (evidence: `app/streamlit_app.py`)
- Analysis interface → Emotion models: loads and predicts (evidence: `app/streamlit_app.py`)
- Mask models → Preprocessing: preprocesses image (evidence: `backend/face_mask_detector.py`)
- Mask models → Feature extraction: extracts features (evidence: `backend/face_mask_detector.py`)
- Preprocessing → Feature extraction: provides image (evidence: `backend/face_mask_detector.py`)
- Dataset loading → Preprocessing: preprocesses samples (evidence: `backend/face_mask_detector.py`)
- Dataset loading → Feature extraction: extracts sample features (evidence: `backend/face_mask_detector.py`)
- Emotion models → Preprocessing: preprocesses image (evidence: `backend/emotion_detector.py`)
- Emotion models → Feature extraction: extracts features (evidence: `backend/emotion_detector.py`)
- Preprocessing → Feature extraction: provides image (evidence: `backend/emotion_detector.py`)
- Dataset loading → Preprocessing: preprocesses samples (evidence: `backend/emotion_detector.py`)
- Dataset loading → Feature extraction: extracts sample features (evidence: `backend/emotion_detector.py`)
