# sahak30/knu-face-recognition-system architecture

> Architecture diagram of the GitHub repository sahak30/knu-face-recognition-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sahak30/knu-face-recognition-system
- Repository: https://github.com/sahak30/knu-face-recognition-system

## Overview

KNU Face Recognition System is a bilingual desktop administration app with Firebase-backed administrator sign-in and user records, plus local face enrollment and recognition components. The main workflow is sign-in, dashboard access, user registration, face-sample capture, and local embedding generation; recognition is also represented in the codebase. Firebase can remain disconnected at startup. Several dashboard and enrollment links are based on partial excerpts, so uncertain runtime connections are omitted or marked unverified.

Main entry points: [`ui/main_window.py`](https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/main_window.py) (Dashboard), [`ui/firebase_auth_service.py`](https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/firebase_auth_service.py) (Admin authentication), [`firebase_service.py`](https://github.com/sahak30/knu-face-recognition-system/blob/main/firebase_service.py) (User records and logs), [`app.py`](https://github.com/sahak30/knu-face-recognition-system/blob/main/app.py) (App launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop app"]
  node_app["App launcher<br/>[app.py]"]
  node_login["Login and setup<br/>[login_window.py]"]
  node_dashboard["Dashboard<br/>[main_window.py]"]
  node_theme["Interface styles<br/>[styles.py]"]
end

subgraph group_identity["Identity and users"]
  node_registration["User registration"]
  node_auth["Admin authentication"]
  node_user_records["User records and logs"]
end

subgraph group_faces["Face processing"]
  node_enrollment["Face enrollment<br/>[face_enrollment.py]"]
  node_engine["Face detection and embeddings<br/>[face_engine.py]"]
  node_trainer["Embedding trainer<br/>[face_trainer.py]"]
  node_recognizer["Face recognition<br/>[face_recognizer.py]"]
end

subgraph group_services["Configuration and services"]
  node_settings["Runtime configuration<br/>[config.py]"]
end

node_operator(("Administrator"))
node_firebase_db[("Firebase Realtime Database")]
node_firebase_auth["Firebase Authentication"]

node_operator -->|"launches"| node_app
node_app -->|"opens"| node_login
node_app -->|"opens after sign-in"| node_dashboard
node_login -->|"authenticates"| node_auth
node_login -->|"initializes"| node_user_records
node_auth -->|"reads API key"| node_settings
node_auth -->|"signs in"| node_firebase_auth
node_auth -->|"checks admin profiles"| node_firebase_db
node_user_records -->|"reads connection settings"| node_settings
node_user_records -->|"reads and writes"| node_firebase_db
node_dashboard -->|"embeds form"| node_registration
node_dashboard -.->|"uses service"| node_user_records
node_dashboard -.->|"opens enrollment"| node_enrollment
node_dashboard -.->|"applies styles"| node_theme
node_enrollment -->|"detects faces"| node_engine
node_trainer -->|"initializes engine"| node_engine
node_dashboard -.->|"uses trainer"| node_trainer

click node_app "https://github.com/sahak30/knu-face-recognition-system/blob/main/app.py"
click node_login "https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/login_window.py"
click node_dashboard "https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/main_window.py"
click node_theme "https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/styles.py"
click node_registration "https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/registration_form.py"
click node_auth "https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/firebase_auth_service.py"
click node_user_records "https://github.com/sahak30/knu-face-recognition-system/blob/main/firebase_service.py"
click node_enrollment "https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/face_enrollment.py"
click node_engine "https://github.com/sahak30/knu-face-recognition-system/blob/main/recognition/face_engine.py"
click node_trainer "https://github.com/sahak30/knu-face-recognition-system/blob/main/recognition/face_trainer.py"
click node_recognizer "https://github.com/sahak30/knu-face-recognition-system/blob/main/recognition/face_recognizer.py"
click node_settings "https://github.com/sahak30/knu-face-recognition-system/blob/main/config.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,node_login,node_dashboard,node_theme toneBlue
class node_registration,node_auth,node_user_records,node_firebase_db toneAmber
class node_enrollment,node_engine,node_trainer,node_recognizer toneMint
class node_settings toneRose
class node_operator,node_firebase_auth toneIndigo
```

## Components

### Desktop app

- [App launcher](https://github.com/sahak30/knu-face-recognition-system/blob/main/app.py): `app.py`
- [Login and setup](https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/login_window.py): `ui/login_window.py`
- [Dashboard](https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/main_window.py): `ui/main_window.py`
- [Interface styles](https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/styles.py): `ui/styles.py`

### Identity and users

- [User registration](https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/registration_form.py): `ui/registration_form.py`
- [Admin authentication](https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/firebase_auth_service.py): `ui/firebase_auth_service.py`
- [User records and logs](https://github.com/sahak30/knu-face-recognition-system/blob/main/firebase_service.py): `firebase_service.py`

### Face processing

- [Face enrollment](https://github.com/sahak30/knu-face-recognition-system/blob/main/ui/face_enrollment.py): `ui/face_enrollment.py`
- [Face detection and embeddings](https://github.com/sahak30/knu-face-recognition-system/blob/main/recognition/face_engine.py): `recognition/face_engine.py`
- [Embedding trainer](https://github.com/sahak30/knu-face-recognition-system/blob/main/recognition/face_trainer.py): `recognition/face_trainer.py`
- [Face recognition](https://github.com/sahak30/knu-face-recognition-system/blob/main/recognition/face_recognizer.py): `recognition/face_recognizer.py`

### Configuration and services

- [Runtime configuration](https://github.com/sahak30/knu-face-recognition-system/blob/main/config.py): `config.py`

### Other components

- **Administrator**
- **Firebase Realtime Database**
- **Firebase Authentication**

## Connections

- Administrator → App launcher: launches (evidence: `app.py`)
- App launcher → Login and setup: opens (evidence: `app.py`)
- App launcher → Dashboard: opens after sign-in (evidence: `app.py`)
- Login and setup → Admin authentication: authenticates (evidence: `ui/login_window.py`)
- Login and setup → User records and logs: initializes (evidence: `ui/login_window.py`)
- Admin authentication → Runtime configuration: reads API key (evidence: `ui/firebase_auth_service.py`)
- Admin authentication → Firebase Authentication: signs in (evidence: `ui/firebase_auth_service.py`)
- Admin authentication → Firebase Realtime Database: checks admin profiles (evidence: `ui/firebase_auth_service.py`)
- User records and logs → Runtime configuration: reads connection settings (evidence: `firebase_service.py`)
- User records and logs → Firebase Realtime Database: reads and writes (evidence: `firebase_service.py`)
- Dashboard → User registration: embeds form (evidence: `ui/main_window.py`)
- Dashboard → User records and logs: uses service (evidence: `ui/main_window.py`)
- Dashboard → Face enrollment: opens enrollment (evidence: `ui/main_window.py`)
- Dashboard → Interface styles: applies styles (evidence: `ui/main_window.py`)
- Face enrollment → Face detection and embeddings: detects faces (evidence: `ui/face_enrollment.py`)
- Embedding trainer → Face detection and embeddings: initializes engine (evidence: `recognition/face_trainer.py`)
- Dashboard → Embedding trainer: uses trainer (evidence: `ui/main_window.py`)
