# musadiqpasha/face_recognition architecture

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

- Interactive diagram: https://gitdiagram.com/musadiqpasha/face_recognition
- Repository: https://github.com/musadiqpasha/face_recognition

## Overview

##### Project type and purpose
- This is a standalone Python desktop application (an open-source tool) that uses OpenCV for face detection/recognition and manages attendance records.
- Purpose: allow users to register faces, scan live webcam feeds for recognition, store face images, and record attendance in a CSV.

##### File structure
- Top-level files:
- Attendance.csv – the persistent attendance log (storage)
- Face Recognition.py (or attandance.py) – main application logic & GUI
- requirements.txt – Python dependencies (OpenCV, pandas, tkinter, face_recognition, etc.)
- README.md, LICENSE – project documentation
- Directories:
- ImagesAttendance – stores registered face images (input to recognition)
- only_name – example images used or reference assets
- other_files/Attendance.txt – auxiliary records (legacy or backup)

##### README for additional insights
- Describes two main user flows:
a. Registering a new face via GUI (“Add a new face”) → captures and saves one high-quality image in ImagesAttendance
b. Scanning via live webcam (“Scan Face (Webcam)”) → detects faces in real time, compares against registered images, and logs attendance to Attendance.csv
- Additional GUI features: “Delete a face” (batch delete from storage), “Open Attendance” (view CSV as table)
- Key dependencies: OpenCV for image capture & processing, face_recognition library (dlib) for encoding & matching, a GUI toolkit (tkinter or PySimpleGUI), pandas or CSV module for log management

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        GUI["GUI Module\n(Face Recognition.py)"]:::ui
    end

    %% Processing Layer
    subgraph "Processing Layer"
        Camera["Camera Module\n(OpenCV Interface)"]:::processing
        Detection["Face Detection & Recognition Module"]:::processing
    end

    %% Storage Layer
    subgraph "Storage Layer"
        ImgStore["Image Storage - Registered Faces\n(ImagesAttendance/)"]:::storage
        ExampleStore["Image Storage - Example Assets\n(only_name/)"]:::storage
        AttendancePrimary["Attendance Database\n(Attendance.csv)"]:::storage
        AttendanceLegacy["Attendance DB Legacy\n(other_files/Attendance.txt)"]:::storage
    end

    %% External Layer
    subgraph "External & Documentation"
        ExtLib["External Libraries & Dependencies\n(requirements.txt)"]:::external
        Doc["Project Documentation & Overview\n(README.md)"]:::external
    end

    %% Data Flows
    GUI -->|"Start capture"| Camera
    Camera -->|"Frame stream"| Detection
    Detection -->|"Store new face image"| ImgStore
    GUI -->|"Delete selected images"| ImgStore
    Detection -->|"Append record"| AttendancePrimary
    GUI -->|"Load/display CSV"| AttendancePrimary
    GUI -->|"Load/display CSV"| AttendanceLegacy
    GUI -->|"Reference assets"| ExampleStore
    GUI -->|"View documentation"| Doc
    Camera -->|"Uses OpenCV"| ExtLib
    Detection -->|"Uses face_recognition & pandas/csv"| ExtLib

    %% Click Events
    click GUI "https://github.com/musadiqpasha/face_recognition/blob/main/Face Recognition.py"
    click Camera "https://github.com/musadiqpasha/face_recognition/blob/main/Face Recognition.py"
    click Detection "https://github.com/musadiqpasha/face_recognition/blob/main/Face Recognition.py"
    click ImgStore "https://github.com/musadiqpasha/face_recognition/tree/main/ImagesAttendance/"
    click ExampleStore "https://github.com/musadiqpasha/face_recognition/tree/main/only_name/"
    click AttendancePrimary "https://github.com/musadiqpasha/face_recognition/blob/main/Attendance.csv"
    click AttendanceLegacy "https://github.com/musadiqpasha/face_recognition/blob/main/other_files/Attendance.txt"
    click ExtLib "https://github.com/musadiqpasha/face_recognition/blob/main/requirements.txt"
    click Doc "https://github.com/musadiqpasha/face_recognition/blob/main/README.md"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef processing fill:#DFFFE0,stroke:#228B22,color:#228B22
    classDef storage fill:#FFF5CC,stroke:#FFD700,color:#B8860B
    classDef external fill:#FFEFD5,stroke:#FFA500,color:#FF8C00
```
