# madhurijambagi/facial-recognition-based-attendance-system architecture

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

- Interactive diagram: https://gitdiagram.com/madhurijambagi/facial-recognition-based-attendance-system
- Repository: https://github.com/madhurijambagi/facial-recognition-based-attendance-system

## Overview

This Flask application manages student enrollment, face-model training, live recognition, attendance records, and role-based dashboards. The main workflow is teacher login → capture student images → train the SVM model → scan a live face → record attendance in MySQL. The README also documents statistics, subject filtering, and CSV export. Source excerpts are partial, so uncertain dataset-storage and some route wiring are omitted; the tree does not include the documented dataset directory.

Main entry points: [`app.py`](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/app.py) (Flask routes), [`model.py`](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/model.py) (Face model), [`static/js/camera_add_student.js`](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/static/js/camera_add_student.js) (Image capture), [`templates/login.html`](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/login.html) (Login and signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_dashboard["Dashboard<br/>[index.html]"]
  node_dashboard_js["Dashboard actions<br/>[dashboard.js]"]
  node_app["Flask routes<br/>[app.py]"]
end

subgraph group_identity["Identity and enrollment"]
  node_login["Login and signup<br/>[login.html]"]
  node_signup["Account signup<br/>[signup.html]"]
  node_enroll["Add student<br/>[add_student.html]"]
  node_enroll_js["Image capture"]
  node_manage_students["Manage students"]
end

subgraph group_recognition["Recognition and training"]
  node_model_logic["Face model<br/>[model.py]"]
  node_model_file["Trained model<br/>[model.pkl]"]
  node_train_status["Training status<br/>[train_status.json]"]
end

subgraph group_attendance["Attendance records"]
  node_mysql[("MySQL database")]
  node_mark_page["Mark attendance"]
  node_mark_js["Live scanning<br/>[camera_mark.js]"]
  node_records["Attendance records"]
end

node_teacher(("Teacher or admin"))
node_browser_camera(("Browser camera"))

node_teacher -->|"signs in"| node_login
node_login -->|"submits credentials"| node_app
node_signup -->|"submits account"| node_app
node_app -->|"checks and stores accounts"| node_mysql
node_app -->|"renders dashboard"| node_dashboard
node_dashboard_js -->|"requests stats and training"| node_app
node_app -->|"reads dashboard data"| node_mysql
node_app -->|"updates progress"| node_train_status
node_app -->|"starts training"| node_model_logic
node_model_logic -->|"saves trained model"| node_model_file
node_enroll -->|"captures enrollment"| node_enroll_js
node_browser_camera -->|"provides frames"| node_enroll_js
node_enroll_js -->|"submits student and images"| node_app
node_app -->|"creates student"| node_mysql
node_teacher -->|"starts attendance"| node_mark_page
node_browser_camera -->|"provides frames"| node_mark_js
node_mark_js -->|"submits face image"| node_app
node_app -->|"checks liveness and predicts"| node_model_logic
node_model_logic -->|"loads classifier"| node_model_file
node_app -->|"authorizes and records attendance"| node_mysql
node_app -->|"renders attendance records"| node_records
node_manage_students -->|"requests student management"| node_app
node_app -->|"reads student and attendance data"| node_mysql

click node_dashboard "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/index.html"
click node_dashboard_js "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/static/js/dashboard.js"
click node_login "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/login.html"
click node_signup "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/signup.html"
click node_enroll "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/add_student.html"
click node_enroll_js "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/static/js/camera_add_student.js"
click node_app "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/app.py"
click node_model_logic "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/model.py"
click node_model_file "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/model.pkl"
click node_train_status "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/train_status.json"
click node_mark_page "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/mark_attendance.html"
click node_mark_js "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/static/js/camera_mark.js"
click node_records "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/attendance_record.html"
click node_manage_students "https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/Manage_students.html"

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_dashboard_js,node_app,node_browser_camera toneBlue
class node_login,node_signup,node_enroll,node_enroll_js,node_manage_students toneAmber
class node_model_logic,node_model_file,node_train_status toneMint
class node_mysql,node_mark_page,node_mark_js,node_records toneRose
class node_teacher toneIndigo
```

## Components

### Web experience

- [Dashboard](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/index.html): `templates/index.html`
- [Dashboard actions](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/static/js/dashboard.js): `static/js/dashboard.js`
- [Flask routes](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/app.py): `app.py`

### Identity and enrollment

- [Login and signup](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/login.html): `templates/login.html`
- [Account signup](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/signup.html): `templates/signup.html`
- [Add student](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/add_student.html): `templates/add_student.html`
- [Image capture](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/static/js/camera_add_student.js): `static/js/camera_add_student.js`
- [Manage students](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/Manage_students.html): `templates/Manage_students.html`

### Recognition and training

- [Face model](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/model.py): `model.py`
- [Trained model](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/model.pkl): `model.pkl`
- [Training status](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/train_status.json): `train_status.json`

### Attendance records

- **MySQL database**
- [Mark attendance](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/mark_attendance.html): `templates/mark_attendance.html`
- [Live scanning](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/static/js/camera_mark.js): `static/js/camera_mark.js`
- [Attendance records](https://github.com/madhurijambagi/facial-recognition-based-attendance-system/blob/main/templates/attendance_record.html): `templates/attendance_record.html`

### Other components

- **Teacher or admin**
- **Browser camera**

## Connections

- Teacher or admin → Login and signup: signs in
- Login and signup → Flask routes: submits credentials
- Account signup → Flask routes: submits account
- Flask routes → MySQL database: checks and stores accounts
- Flask routes → Dashboard: renders dashboard
- Dashboard actions → Flask routes: requests stats and training
- Flask routes → MySQL database: reads dashboard data
- Flask routes → Training status: updates progress
- Flask routes → Face model: starts training
- Face model → Trained model: saves trained model
- Add student → Image capture: captures enrollment
- Browser camera → Image capture: provides frames
- Image capture → Flask routes: submits student and images
- Flask routes → MySQL database: creates student
- Teacher or admin → Mark attendance: starts attendance
- Browser camera → Live scanning: provides frames
- Live scanning → Flask routes: submits face image
- Flask routes → Face model: checks liveness and predicts
- Face model → Trained model: loads classifier
- Flask routes → MySQL database: authorizes and records attendance
- Flask routes → Attendance records: renders attendance records
- Manage students → Flask routes: requests student management
- Flask routes → MySQL database: reads student and attendance data
