# dhanvina/facetrackedu architecture

> Architecture diagram of the GitHub repository dhanvina/facetrackedu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dhanvina/facetrackedu
- Repository: https://github.com/dhanvina/facetrackedu

## Overview

- Face Capture & Camera Interface – This component interacts with the hardware (camera) to capture images to be processed.
- Face Detection Module – Using Haar Cascade (and possibly additional pre-processing) to locate the face within the captured images.
- Face Registration & Training Module – The registration (register.py) and training functions compile and label images; this is supported by files in the TrainingImageLabel directory and datasets.
- Face Recognition Module – Using algorithms such as LBPH (via predict.py) that compare incoming face data against the trained models.
- Attendance Management and Data Storage – Components that record and update attendance data using CSV/Excel files stored in directories like Attendance, facedetect (attendance.xlsx, dbdump01.csv, markedattendance.csv) and StudentDetails.
- User Interface / Execution Environment – Although no full GUI is seen, the command line/IDE operations (invoked via “py main.py” as mentioned in the README) serve as the application’s interface.

##### Relationships and Interactions
- A flow from the Camera Interface to the Face Detection Module.
- From detection, split into two parallel flows: one branch going to registration/training (for new face entries) and another leading to the recognition process for checking attendance.
- The Recognition Module then updates the Attendance Data Storage by marking the recognized faces.
- Additionally, visual feedback could be provided to the teacher through the IDE or a lightweight UI.

##### Architectural Patterns and Design Principles
- Modular Separation – The project clearly separates the face detection, registration, prediction, and attendance record management into distinct Python scripts and directories. Emphasize how each module has distinct responsibilities.
- Data Flow Design – The use of CSV/Excel files for both training labels and attendance records indicates a file-based data persistence mechanism.
- Integration of External Libraries – Note the dependency on external modules (OpenCV, Numpy, Pandas) that drive the recognition algorithms.

##### Relevant Technologies and Libraries
- Python 3 as the development language.
- OpenCV (with its contrib components) for image processing and face recognition.
- Numpy and Pandas for data manipulation and handling CSV/Excel records.
- Optional: Tools like PyCharm and VS Code for development, though these are less central to the architecture.

## Diagram (Mermaid)

```mermaid
graph TD
    UI["User Interface / Execution Environment"]:::ui
    Cam["Face Capture & Camera Interface"]:::module
    Det["Face Detection Module"]:::module
    Reg["Face Registration & Training Module"]:::module
    Rec["Face Recognition Module"]:::module
    Att["Attendance Management and Data Storage"]:::db

    UI -->|"triggers"| Cam
    Cam -->|"captures image"| Det
    Det -->|"new face enrollment"| Reg
    Det -->|"face recognition"| Rec
    Reg -.->|"updates model"| Rec
    Rec -->|"updates attendance"| Att

    click UI "https://github.com/dhanvina/facetrackedu/blob/main/Face-Based-attendance-system/README.md"
    click Cam "https://github.com/dhanvina/facetrackedu/blob/main/Face-Based-attendance-system/facedetect/detect.py"
    click Det "https://github.com/dhanvina/facetrackedu/blob/main/Face-Based-attendance-system/facedetect/haarcascade_frontalface_default.xml"
    click Det "https://github.com/dhanvina/facetrackedu/blob/main/Face-Based-attendance-system/facedetect/detect.py"
    click Reg "https://github.com/dhanvina/facetrackedu/blob/main/Face-Based-attendance-system/facedetect/register.py"
    click Reg "https://github.com/dhanvina/facetrackedu/blob/main/TrainingImageLabel/psd.txt"
    click Rec "https://github.com/dhanvina/facetrackedu/blob/main/Face-Based-attendance-system/facedetect/predict.py"
    click Att "https://github.com/dhanvina/facetrackedu/blob/main/Face-Based-attendance-system/facedetect/attendance.xlsx"
    click Att "https://github.com/dhanvina/facetrackedu/blob/main/Face-Based-attendance-system/facedetect/dbdump01.csv"
    click Att "https://github.com/dhanvina/facetrackedu/blob/main/Face-Based-attendance-system/facedetect/markedattendance.csv"
    click Att "https://github.com/dhanvina/facetrackedu/blob/main/Attendance/Attendance_20-08-2022.csv"
    click Att "https://github.com/dhanvina/facetrackedu/blob/main/StudentDetails/StudentDetails.csv"

    classDef ui fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef module fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef db fill:#ffcccb,stroke:#333,stroke-width:2px;
```
