# kkanistan06/face-recognition architecture

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

- Interactive diagram: https://gitdiagram.com/kkanistan06/face-recognition
- Repository: https://github.com/kkanistan06/face-recognition

## Overview

This is a small OpenCV face-recognition application with two scripts: one captures and stores face crops, and the other builds a recognizer from stored images and runs recognition on a webcam stream. The recognition script uses FisherFaces, despite the README describing LBPH. The README also describes training and recognition scripts that are absent from the tree; the graph follows the sampled scripts and omits those undocumented implementation details.

Main entry points: [`Face Recognition/face_recognize.py`](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py) (Recognition loop), [`Face Recognition/create_data.py`](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/create_data.py) (Capture loop), [`Face Recognition/datasets`](https://github.com/kkanistan06/face-recognition/tree/main/Face%20Recognition/datasets) (Face images), [`Face Recognition/haarcascade_frontalface_default.xml`](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/haarcascade_frontalface_default.xml) (Face detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Face capture"]
  node_capture_script["Capture loop<br/>[create_data.py]"]
  node_capture_camera["Capture webcam<br/>[create_data.py]"]
  node_capture_detector["Face detector"]
end

subgraph group_runtime["Recognition runtime"]
  node_recognizer_script["Recognition loop<br/>[face_recognize.py]"]
  node_model["FisherFace model<br/>[face_recognize.py]"]
  node_runtime_camera["Recognition webcam<br/>[face_recognize.py]"]
  node_runtime_detector["Face detector"]
  node_stream_display["Annotated video<br/>[face_recognize.py]"]
  node_unknown_snapshot["Unknown snapshot<br/>[face_recognize.py]"]
end

subgraph group_storage["Image storage"]
  node_dataset[("Face images")]
end

node_operator(("Operator"))

node_capture_script -->|"reads frames"| node_capture_camera
node_capture_script -->|"loads detector"| node_capture_detector
node_capture_script -->|"writes face crops"| node_dataset
node_recognizer_script -->|"reads images"| node_dataset
node_recognizer_script -->|"trains model"| node_model
node_recognizer_script -->|"reads frames"| node_runtime_camera
node_recognizer_script -->|"loads detector"| node_runtime_detector
node_recognizer_script -->|"predicts faces"| node_model
node_recognizer_script -->|"displays results"| node_stream_display
node_recognizer_script -->|"saves unknown frame"| node_unknown_snapshot

click node_capture_script "https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/create_data.py"
click node_capture_camera "https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/create_data.py"
click node_capture_detector "https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/haarcascade_frontalface_default.xml"
click node_dataset "https://github.com/kkanistan06/face-recognition/tree/main/Face%20Recognition/datasets"
click node_recognizer_script "https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py"
click node_model "https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py"
click node_runtime_camera "https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py"
click node_runtime_detector "https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/haarcascade_frontalface_default.xml"
click node_stream_display "https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py"
click node_unknown_snapshot "https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.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_capture_script,node_capture_camera,node_capture_detector toneBlue
class node_recognizer_script,node_model,node_runtime_camera,node_runtime_detector,node_stream_display,node_unknown_snapshot toneAmber
class node_dataset toneMint
class node_operator toneIndigo
```

## Components

### Face capture

- [Capture loop](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/create_data.py): `Face Recognition/create_data.py`
- [Capture webcam](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/create_data.py): `Face Recognition/create_data.py`
- [Face detector](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/haarcascade_frontalface_default.xml): `Face Recognition/haarcascade_frontalface_default.xml`

### Recognition runtime

- [Recognition loop](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py): `Face Recognition/face_recognize.py`
- [FisherFace model](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py): `Face Recognition/face_recognize.py`
- [Recognition webcam](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py): `Face Recognition/face_recognize.py`
- [Face detector](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/haarcascade_frontalface_default.xml): `Face Recognition/haarcascade_frontalface_default.xml`
- [Annotated video](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py): `Face Recognition/face_recognize.py`
- [Unknown snapshot](https://github.com/kkanistan06/face-recognition/blob/main/Face%20Recognition/face_recognize.py): `Face Recognition/face_recognize.py`

### Image storage

- [Face images](https://github.com/kkanistan06/face-recognition/tree/main/Face%20Recognition/datasets): `Face Recognition/datasets`

### Other components

- **Operator**

## Connections

- Capture loop → Capture webcam: reads frames (evidence: `Face Recognition/create_data.py`)
- Capture loop → Face detector: loads detector (evidence: `Face Recognition/create_data.py`)
- Capture loop → Face images: writes face crops (evidence: `Face Recognition/create_data.py`)
- Recognition loop → Face images: reads images (evidence: `Face Recognition/face_recognize.py`)
- Recognition loop → FisherFace model: trains model (evidence: `Face Recognition/face_recognize.py`)
- Recognition loop → Recognition webcam: reads frames (evidence: `Face Recognition/face_recognize.py`)
- Recognition loop → Face detector: loads detector (evidence: `Face Recognition/face_recognize.py`)
- Recognition loop → FisherFace model: predicts faces (evidence: `Face Recognition/face_recognize.py`)
- Recognition loop → Annotated video: displays results (evidence: `Face Recognition/face_recognize.py`)
- Recognition loop → Unknown snapshot: saves unknown frame (evidence: `Face Recognition/face_recognize.py`)
