# rs9313399-dot/my-face-recognizer architecture

> Architecture diagram of the GitHub repository rs9313399-dot/my-face-recognizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rs9313399-dot/my-face-recognizer
- Repository: https://github.com/rs9313399-dot/my-face-recognizer

## Overview

This is a small webcam-based personal face recognizer. The user collects face samples, then runs a live workflow that loads or trains an LBPH model, detects and classifies faces, displays results, and saves captures. The source is two scripts rather than separate layers, so nodes represent their actual runtime responsibilities. Relationships are based on the shown code and README; no separate dataset or model implementation is present.

Main entry points: [`train_and_detect.py`](https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py) (Recognition workflow), [`collect_faces.py`](https://github.com/rs9313399-dot/my-face-recognizer/blob/main/collect_faces.py) (Face sample capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Sample collection"]
  node_collector["Face sample capture<br/>[collect_faces.py]"]
end

subgraph group_recognition["Live recognition"]
  node_runner["Recognition workflow"]
  node_training["LBPH training"]
  node_detection["Face detection and matching"]
  node_display["Live display and controls"]
  node_beep["Audio alert"]
end

subgraph group_artifacts["Local artifacts"]
  node_dataset[("Face image dataset")]
  node_model["LBPH model"]
  node_captures[("Saved captures")]
end

node_user(("User"))

node_user -->|"starts collection"| node_collector
node_collector -->|"writes samples"| node_dataset
node_user -->|"starts recognition"| node_runner
node_runner -->|"trains if needed"| node_training
node_training -->|"reads samples"| node_dataset
node_training -->|"saves model"| node_model
node_runner -->|"loads existing model"| node_model
node_runner -->|"runs webcam recognition"| node_detection
node_detection -->|"draws results"| node_display
node_detection -->|"auto-saves matches"| node_captures
node_display -->|"saves on keypress"| node_captures
node_detection -->|"alerts on match"| node_beep
node_user -->|"uses controls"| node_display

click node_collector "https://github.com/rs9313399-dot/my-face-recognizer/blob/main/collect_faces.py"
click node_runner "https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py"
click node_training "https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py"
click node_detection "https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py"
click node_display "https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py"
click node_beep "https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.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_user toneBlue
class node_runner,node_training,node_detection,node_display,node_beep toneAmber
class node_dataset,node_model,node_captures toneMint
```

## Components

### Sample collection

- [Face sample capture](https://github.com/rs9313399-dot/my-face-recognizer/blob/main/collect_faces.py): `collect_faces.py`

### Live recognition

- [Recognition workflow](https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py): `train_and_detect.py`
- [LBPH training](https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py): `train_and_detect.py`
- [Face detection and matching](https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py): `train_and_detect.py`
- [Live display and controls](https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py): `train_and_detect.py`
- [Audio alert](https://github.com/rs9313399-dot/my-face-recognizer/blob/main/train_and_detect.py): `train_and_detect.py`

### Local artifacts

- **Face image dataset**
- **LBPH model**
- **Saved captures**

### Other components

- **User**

## Connections

- User → Face sample capture: starts collection (evidence: `README.md`)
- Face sample capture → Face image dataset: writes samples (evidence: `collect_faces.py`)
- User → Recognition workflow: starts recognition (evidence: `README.md`)
- Recognition workflow → LBPH training: trains if needed (evidence: `train_and_detect.py`)
- LBPH training → Face image dataset: reads samples (evidence: `train_and_detect.py`)
- LBPH training → LBPH model: saves model (evidence: `train_and_detect.py`)
- Recognition workflow → LBPH model: loads existing model (evidence: `train_and_detect.py`)
- Recognition workflow → Face detection and matching: runs webcam recognition (evidence: `train_and_detect.py`)
- Face detection and matching → Live display and controls: draws results (evidence: `train_and_detect.py`)
- Face detection and matching → Saved captures: auto-saves matches (evidence: `train_and_detect.py`)
- Live display and controls → Saved captures: saves on keypress (evidence: `train_and_detect.py`)
- Face detection and matching → Audio alert: alerts on match (evidence: `train_and_detect.py`)
- User → Live display and controls: uses controls (evidence: `README.md`)
