# shreyasdebbarma-code/smart-classroom-attendance-cv architecture

> Architecture diagram of the GitHub repository shreyasdebbarma-code/smart-classroom-attendance-cv, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shreyasdebbarma-code/smart-classroom-attendance-cv
- Repository: https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv

## Overview

This is an offline classroom attendance and security application. Its main workflow registers students and captures face samples, trains an LBPH recognizer, then uses live webcam recognition to classify students, log attendance, and optionally send events or unknown-face alerts. A separate group-photo workflow detects, annotates, and exports faces. The desktop control panel dispatches these tasks alongside standalone CLI scripts. Edges reflect README-documented workflows and shown calls; unsampled GUI dispatch details are not inferred beyond the documentation.

Main entry points: [`3_attendance_system.py`](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/3_attendance_system.py) (Live Recognition), [`1_collect_data.py`](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/1_collect_data.py) (Student Capture), [`main_app.py`](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/main_app.py) (Desktop Panel), [`2_train_model.py`](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/2_train_model.py) (LBPH Training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_enrollment["Enrollment &amp; Training"]
  node_collector["Student Capture<br/>[1_collect_data.py]"]
  node_dataset[("Face Samples")]
  node_studentmap[("Student Mapping")]
  node_trainer["LBPH Training<br/>[2_train_model.py]"]
  node_weights["LBPH Weights"]
end

subgraph group_attendance["Live Attendance"]
  node_recognition["Live Recognition"]
  node_attendance_log[("Attendance Log")]
  node_webhook["Sheets Webhook"]
  node_gmail["Gmail Alerts"]
end

subgraph group_photo["Photo Analysis"]
  node_photo_input["Group Photo"]
  node_photo_detection["Photo Detection"]
  node_photo_annotation["Annotation &amp; Export"]
  node_annotated_photo["Annotated Image"]
end

subgraph group_interface["User Interface"]
  node_desktop["Desktop Panel<br/>[main_app.py]"]
end

node_operator(("Operator"))
node_webcam(("Webcam"))
node_cascade["Haar Cascade"]

node_operator -->|"launches"| node_desktop
node_operator -->|"runs"| node_collector
node_operator -->|"runs"| node_trainer
node_operator -->|"runs"| node_recognition
node_operator -->|"provides"| node_photo_input
node_desktop -->|"dispatches"| node_collector
node_desktop -->|"dispatches"| node_trainer
node_desktop -->|"dispatches"| node_recognition
node_desktop -->|"dispatches"| node_photo_detection
node_webcam -->|"supplies frames"| node_collector
node_cascade -->|"detects faces"| node_collector
node_collector -->|"writes samples"| node_dataset
node_collector -->|"writes names"| node_studentmap
node_dataset -->|"loads samples"| node_trainer
node_studentmap -->|"reads mapping"| node_trainer
node_trainer -->|"saves model"| node_weights
node_webcam -->|"supplies frames"| node_recognition
node_cascade -->|"detects faces"| node_recognition
node_weights -->|"loads model"| node_recognition
node_studentmap -->|"resolves labels"| node_recognition
node_recognition -->|"logs attendance"| node_attendance_log
node_recognition -.->|"posts events"| node_webhook
node_recognition -.->|"alerts unknowns"| node_gmail
node_photo_input -->|"loads image"| node_photo_detection
node_cascade -->|"detects faces"| node_photo_detection
node_photo_detection -->|"passes detections"| node_photo_annotation
node_photo_annotation -->|"saves image"| node_annotated_photo

click node_cascade "https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/haarcascade_frontalface_default.xml"
click node_collector "https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/1_collect_data.py"
click node_trainer "https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/2_train_model.py"
click node_recognition "https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/3_attendance_system.py"
click node_photo_detection "https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/4_group_analyzer.py"
click node_photo_annotation "https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/4_group_analyzer.py"
click node_desktop "https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/main_app.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_collector,node_dataset,node_studentmap,node_trainer,node_weights toneBlue
class node_recognition,node_attendance_log,node_webhook,node_gmail toneAmber
class node_photo_input,node_photo_detection,node_photo_annotation,node_annotated_photo toneMint
class node_desktop toneRose
class node_operator,node_webcam toneIndigo
class node_cascade toneTeal
```

## Components

### Enrollment & Training

- [Student Capture](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/1_collect_data.py): `1_collect_data.py`
- **Face Samples**
- **Student Mapping**
- [LBPH Training](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/2_train_model.py): `2_train_model.py`
- **LBPH Weights**

### Live Attendance

- [Live Recognition](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/3_attendance_system.py): `3_attendance_system.py`
- **Attendance Log**
- **Sheets Webhook**
- **Gmail Alerts**

### Photo Analysis

- **Group Photo**
- [Photo Detection](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/4_group_analyzer.py): `4_group_analyzer.py`
- [Annotation & Export](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/4_group_analyzer.py): `4_group_analyzer.py`
- **Annotated Image**

### User Interface

- [Desktop Panel](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/main_app.py): `main_app.py`

### Other components

- **Operator**
- **Webcam**
- [Haar Cascade](https://github.com/shreyasdebbarma-code/smart-classroom-attendance-cv/blob/main/haarcascade_frontalface_default.xml): `haarcascade_frontalface_default.xml`

## Connections

- Operator → Desktop Panel: launches (evidence: `README.md`)
- Operator → Student Capture: runs (evidence: `README.md`)
- Operator → LBPH Training: runs (evidence: `README.md`)
- Operator → Live Recognition: runs (evidence: `README.md`)
- Operator → Group Photo: provides (evidence: `README.md`)
- Desktop Panel → Student Capture: dispatches (evidence: `README.md`)
- Desktop Panel → LBPH Training: dispatches (evidence: `README.md`)
- Desktop Panel → Live Recognition: dispatches (evidence: `README.md`)
- Desktop Panel → Photo Detection: dispatches (evidence: `README.md`)
- Webcam → Student Capture: supplies frames (evidence: `1_collect_data.py`)
- Haar Cascade → Student Capture: detects faces (evidence: `1_collect_data.py`)
- Student Capture → Face Samples: writes samples (evidence: `README.md`)
- Student Capture → Student Mapping: writes names (evidence: `1_collect_data.py`)
- Face Samples → LBPH Training: loads samples (evidence: `2_train_model.py`)
- Student Mapping → LBPH Training: reads mapping (evidence: `2_train_model.py`)
- LBPH Training → LBPH Weights: saves model (evidence: `2_train_model.py`)
- Webcam → Live Recognition: supplies frames (evidence: `README.md`)
- Haar Cascade → Live Recognition: detects faces (evidence: `README.md`)
- LBPH Weights → Live Recognition: loads model (evidence: `README.md`)
- Student Mapping → Live Recognition: resolves labels (evidence: `README.md`)
- Live Recognition → Attendance Log: logs attendance (evidence: `README.md`)
- Live Recognition → Sheets Webhook: posts events (evidence: `3_attendance_system.py`)
- Live Recognition → Gmail Alerts: alerts unknowns (evidence: `3_attendance_system.py`)
- Group Photo → Photo Detection: loads image (evidence: `4_group_analyzer.py`)
- Haar Cascade → Photo Detection: detects faces (evidence: `4_group_analyzer.py`)
- Photo Detection → Annotation & Export: passes detections (evidence: `4_group_analyzer.py`)
- Annotation & Export → Annotated Image: saves image (evidence: `README.md`)
