# prem-buraga/automated-mobile-phone-usage-detection-and-mailing-system-using-deep-learning-techniques architecture

> Architecture diagram of the GitHub repository prem-buraga/automated-mobile-phone-usage-detection-and-mailing-system-using-deep-learning-techniques, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prem-buraga/automated-mobile-phone-usage-detection-and-mailing-system-using-deep-learning-techniques
- Repository: https://github.com/prem-buraga/automated-mobile-phone-usage-detection-and-mailing-system-using-deep-learning-techniques

## Overview

##### Main Components
- Camera Feed / Video Input – Represents the source of real-time images or frames.
- Detection Module – Contains two sub-modules:
- Object Detection using YOLOv8 with the pre-trained model (best.pt) to identify mobile phone usage.
- Face Detection using Haar Cascade (haarcascade_frontalface_default.xml) for extracting face images.
- Data Storage & Logging – Uses files such as Details.xlsx to store user and incident details and folders for storing captured images (e.g., “captured_faces/” and “captured_frames/” as mentioned in README, though not shown explicitly in the file tree).
- Notification System – The automated mailing module that sends out alerts with incident details (including images, timestamps, etc.).
- Control Script – The Mobile_usage_detection.py, which orchestrates the flow between modules.
- Configuration & Development Tools – The .vscode folder and potential configuration files that may help with development, debugging, or deployment.

##### Relationships and Interactions
- The Camera Feed continuously supplies video frames to the Control Script.
- The Control Script passes these frames to the Object Detection module (YOLOv8) to detect mobile phone use.
- For detected incidents, the same frame is processed by the Face Detection module to capture and log face images.
- Once an incident is confirmed, the system records details (timestamp, captured images) and cross-references details from Details.xlsx as necessary.
- The Notification System then automatically sends emails containing incident logs, images, and other relevant information.

##### Architectural Patterns & Important Design Principles
- Modularity: Separate components (detection modules, notification system, data storage) allow for independent updates or troubleshooting.
- Real-Time Processing: Emphasize components handling streaming data from the camera.
- Integration of Machine Learning: The YOLOv8 (for object detection) and Haar Cascade (for face detection) modules highlight the use of pre-trained models integrated into an application pipeline.
- External Dependency Integration: Automated email notifications and using an Excel sheet for details suggest that integration with external systems is important.

##### Technologies, Frameworks, and Libraries
- Python for scripting, with libraries such as OpenCV, numpy, pandas, face_recognition, and ultralytics.
- YOLOv8 (via ultralytics) for object detection.
- Haar Cascade (via OpenCV) for face recognition.
- Excel file processing using openpyxl or pandas.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    subgraph "Input Layer"
        CF("Camera Feed"):::input
    end

    %% Control Layer
    subgraph "Control Layer"
        CS("Control Script (Mobile_usage_detection.py)"):::control
    end

    %% Detection Layer
    subgraph "Detection Layer"
        YOLO("YOLOv8 Object Detector"):::detection
        Haar("Haar Cascade Face Detector"):::detection
    end

    %% Data Logging & Notification Layer
    subgraph "Data Logging & Notification"
        Logger("Incident Logger/Storage (Details.xlsx)"):::logger
        Notify("Notification Email Module"):::notification
    end

    %% Configuration & Development Layer
    subgraph "Configuration & Development Tools"
        Config("Configuration (.vscode)"):::config
    end

    %% Data Flow Connections
    CF -->|"suppliesFrames"| CS
    CS -->|"invokesDetection"| YOLO
    CS -->|"invokesDetection"| Haar
    YOLO -->|"onDetection"| Logger
    Haar -->|"onFaceCapture"| Logger
    Logger -->|"triggersAlert"| Notify

    %% Click Events for Components
    click YOLO "https://github.com/prem-buraga/automated-mobile-phone-usage-detection-and-mailing-system-using-deep-learning-techniques/blob/master/best.pt"
    click Haar "https://github.com/prem-buraga/automated-mobile-phone-usage-detection-and-mailing-system-using-deep-learning-techniques/blob/master/haarcascade_frontalface_default.xml"
    click Logger "https://github.com/prem-buraga/automated-mobile-phone-usage-detection-and-mailing-system-using-deep-learning-techniques/blob/master/Details.xlsx"
    click CS "https://github.com/prem-buraga/automated-mobile-phone-usage-detection-and-mailing-system-using-deep-learning-techniques/blob/master/Mobile_usage_detection.py"
    click Config "https://github.com/prem-buraga/automated-mobile-phone-usage-detection-and-mailing-system-using-deep-learning-techniques/blob/master/.vscode"

    %% Styles
    classDef input fill:#ffcc66,stroke:#333,stroke-width:2px;
    classDef control fill:#f2a0a1,stroke:#333,stroke-width:2px;
    classDef detection fill:#a1d99b,stroke:#333,stroke-width:2px;
    classDef logger fill:#9ecae1,stroke:#333,stroke-width:2px;
    classDef notification fill:#c7e9c0,stroke:#333,stroke-width:2px;
    classDef config fill:#d9d9d9,stroke:#333,stroke-width:2px;
```
