# sandy283/face-mask-detection architecture

> Architecture diagram of the GitHub repository sandy283/face-mask-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sandy283/face-mask-detection
- Repository: https://github.com/sandy283/face-mask-detection

## Overview

##### Project type and purpose
- This is a research/proof-of-concept computer vision application (“Face-Mask-Detection”) that uses a two-stage CNN pipeline:
a) face detection via a pre-trained Caffe SSD model (res10_300x300_ssd_iter_140000.caffemodel + deploy.prototxt)
b) mask/no-mask classification via a custom CNN (mask_detector.model)
- The Jupyter notebook (Face Mask Detection.ipynb) contains data loading, model training, evaluation, and inference code.
- The “with_mask” and “without_mask” folders hold labeled image data for training.

##### File structure
- Top level:
- Face Mask Detection.ipynb – notebook orchestrating data prep, training, and inference
- deploy.prototxt + res10_300x300_ssd_iter_140000.caffemodel – Caffe SSD for face localization
- mask_detector.model – serialized CNN for mask classification
- with_mask/without_mask – raw training images (each with HTML previews and ZIP backups)
- No separate “src” or “app” folder—code and pipeline logic live in the notebook.
- No deployment scripts beyond model artifacts; inference is likely notebook-driven.

##### README for additional insights
- README is minimal: “Face mask detection using CNN” confirms two-stage CNN pipeline.
- No extra sections on architecture or deployment. We’ll infer architecture from files.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Storage
    subgraph "Data Storage"
        DS1["with_mask"]:::data
        DS2["without_mask"]:::data
    end

    %% Orchestration & Preprocessing
    NB["Jupyter Notebook\n(Face Mask Detection.ipynb)\n- train/test split\n- data augmentation\n- model.fit\n- model.save\n- inference orchestration"]:::orchestration
    PP["Data Preprocessing\n(resize, normalize)"]:::orchestration

    %% Face Detection Engine
    subgraph "Face Detection Engine"
        FDProto["deploy.prototxt"]:::model
        FDWeights["res10_300x300_ssd_iter_140000.caffemodel"]:::model
    end

    %% Mask Classification Engine
    MC["Mask Classification Engine\n(mask_detector.model)"]:::model

    %% Output Visualization
    VIS["Output Visualization\n(confidence scores + bbox)"]:::io

    %% Documentation
    README["README.md"]:::doc

    %% Data Flow
    DS1 -->|"raw images"| NB
    DS2 -->|"raw images"| NB
    NB -->|"selected dataset"| PP
    PP -->|"preprocessed images"| FDProto
    FDProto -->|"load weights"| FDWeights
    FDWeights -->|"cropped face ROI"| MC
    MC -->|"prediction + bbox"| VIS

    %% Click Events
    click DS1 "https://github.com/sandy283/face-mask-detection/tree/main/with_mask/"
    click DS2 "https://github.com/sandy283/face-mask-detection/tree/main/without_mask/"
    click NB "https://github.com/sandy283/face-mask-detection/blob/main/Face Mask Detection.ipynb"
    click FDProto "https://github.com/sandy283/face-mask-detection/blob/main/deploy.prototxt"
    click FDWeights "https://github.com/sandy283/face-mask-detection/blob/main/res10_300x300_ssd_iter_140000.caffemodel"
    click MC "https://github.com/sandy283/face-mask-detection/blob/main/mask_detector.model"
    click README "https://github.com/sandy283/face-mask-detection/blob/main/README.md"

    %% Styles
    classDef data fill:#AED6F1,stroke:#1B4F72,color:#1B2631;
    classDef orchestration fill:#FCF3CF,stroke:#B7950B,color:#7D6608;
    classDef model fill:#ABEBC6,stroke:#196F3D,color:#145A32;
    classDef io fill:#F5CBA7,stroke:#C0392B,color:#641E16;
    classDef doc fill:#D5DBDB,stroke:#566573,color:#1B2631;
```
