# thetonus/face_identification_demos architecture

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

- Interactive diagram: https://gitdiagram.com/thetonus/face_identification_demos
- Repository: https://github.com/thetonus/face_identification_demos

## Overview

This repository is a learning and benchmarking collection of face-detection demos, not a single identification service. Each runnable script captures webcam frames, optionally resizes them, detects faces with a different backend, annotates the original frame and displays it; the MTCNN demos also report FPS. `naive.py` additionally defines an embedding helper, but its main loop does not call it. The README describes the project as experimental; the source excerpts show webcam input rather than general file input. Each edge below is evidenced by the cited script.

Main entry points: [`naive.py`](https://github.com/thetonus/face_identification_demos/blob/master/naive.py) (Naive demo loop), [`pytorch_mtcnn.py`](https://github.com/thetonus/face_identification_demos/blob/master/pytorch_mtcnn.py) (PyTorch demo loop), [`tf_mtcnn.py`](https://github.com/thetonus/face_identification_demos/blob/master/tf_mtcnn.py) (TensorFlow demo loop), [`mxnet_mtcnn.py`](https://github.com/thetonus/face_identification_demos/blob/master/mxnet_mtcnn.py) (MXNet demo loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demos["Detection demos"]
  node_naive_loop["Naive demo loop<br/>[naive.py]"]
  node_naive_detect["CVLib detection<br/>[naive.py]"]
  node_torch_loop["PyTorch demo loop<br/>[pytorch_mtcnn.py]"]
  node_torch_detect["PyTorch MTCNN<br/>[pytorch_mtcnn.py]"]
  node_tf_loop["TensorFlow demo loop<br/>[tf_mtcnn.py]"]
  node_tf_detect["TensorFlow MTCNN<br/>[tf_mtcnn.py]"]
  node_mx_loop["MXNet demo loop<br/>[mxnet_mtcnn.py]"]
  node_mx_detect["InsightFace detector<br/>[mxnet_mtcnn.py]"]
end

subgraph group_analysis["Face analysis"]
  node_naive_embed["Face embeddings<br/>[naive.py]"]
end

node_user(("Demo user"))
node_webcam["Webcam"]
node_preview["Video preview"]

node_user -->|"runs"| node_naive_loop
node_user -->|"runs"| node_torch_loop
node_user -->|"runs"| node_tf_loop
node_user -->|"runs"| node_mx_loop
node_naive_loop -->|"reads frames"| node_webcam
node_torch_loop -->|"reads frames"| node_webcam
node_tf_loop -->|"reads frames"| node_webcam
node_mx_loop -->|"reads frames"| node_webcam
node_naive_loop -->|"calls"| node_naive_detect
node_torch_loop -->|"calls"| node_torch_detect
node_tf_loop -->|"calls"| node_tf_detect
node_mx_loop -->|"calls"| node_mx_detect
node_naive_loop -->|"displays annotated frames"| node_preview
node_torch_loop -->|"displays annotated frames"| node_preview
node_tf_loop -->|"displays annotated frames"| node_preview
node_mx_loop -->|"displays annotated frames"| node_preview

click node_naive_loop "https://github.com/thetonus/face_identification_demos/blob/master/naive.py"
click node_naive_detect "https://github.com/thetonus/face_identification_demos/blob/master/naive.py"
click node_naive_embed "https://github.com/thetonus/face_identification_demos/blob/master/naive.py"
click node_torch_loop "https://github.com/thetonus/face_identification_demos/blob/master/pytorch_mtcnn.py"
click node_torch_detect "https://github.com/thetonus/face_identification_demos/blob/master/pytorch_mtcnn.py"
click node_tf_loop "https://github.com/thetonus/face_identification_demos/blob/master/tf_mtcnn.py"
click node_tf_detect "https://github.com/thetonus/face_identification_demos/blob/master/tf_mtcnn.py"
click node_mx_loop "https://github.com/thetonus/face_identification_demos/blob/master/mxnet_mtcnn.py"
click node_mx_detect "https://github.com/thetonus/face_identification_demos/blob/master/mxnet_mtcnn.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_naive_loop,node_naive_detect,node_torch_loop,node_torch_detect,node_tf_loop,node_tf_detect,node_mx_loop,node_mx_detect,node_user,node_preview toneBlue
class node_naive_embed toneAmber
class node_webcam toneIndigo
```

## Components

### Detection demos

- [Naive demo loop](https://github.com/thetonus/face_identification_demos/blob/master/naive.py): `naive.py`
- [CVLib detection](https://github.com/thetonus/face_identification_demos/blob/master/naive.py): `naive.py`
- [PyTorch demo loop](https://github.com/thetonus/face_identification_demos/blob/master/pytorch_mtcnn.py): `pytorch_mtcnn.py`
- [PyTorch MTCNN](https://github.com/thetonus/face_identification_demos/blob/master/pytorch_mtcnn.py): `pytorch_mtcnn.py`
- [TensorFlow demo loop](https://github.com/thetonus/face_identification_demos/blob/master/tf_mtcnn.py): `tf_mtcnn.py`
- [TensorFlow MTCNN](https://github.com/thetonus/face_identification_demos/blob/master/tf_mtcnn.py): `tf_mtcnn.py`
- [MXNet demo loop](https://github.com/thetonus/face_identification_demos/blob/master/mxnet_mtcnn.py): `mxnet_mtcnn.py`
- [InsightFace detector](https://github.com/thetonus/face_identification_demos/blob/master/mxnet_mtcnn.py): `mxnet_mtcnn.py`

### Face analysis

- [Face embeddings](https://github.com/thetonus/face_identification_demos/blob/master/naive.py): `naive.py`

### Other components

- **Demo user**
- **Webcam**
- **Video preview**

## Connections

- Demo user → Naive demo loop: runs (evidence: `naive.py`)
- Demo user → PyTorch demo loop: runs (evidence: `pytorch_mtcnn.py`)
- Demo user → TensorFlow demo loop: runs (evidence: `tf_mtcnn.py`)
- Demo user → MXNet demo loop: runs (evidence: `mxnet_mtcnn.py`)
- Naive demo loop → Webcam: reads frames (evidence: `naive.py`)
- PyTorch demo loop → Webcam: reads frames (evidence: `pytorch_mtcnn.py`)
- TensorFlow demo loop → Webcam: reads frames (evidence: `tf_mtcnn.py`)
- MXNet demo loop → Webcam: reads frames (evidence: `mxnet_mtcnn.py`)
- Naive demo loop → CVLib detection: calls (evidence: `naive.py`)
- PyTorch demo loop → PyTorch MTCNN: calls (evidence: `pytorch_mtcnn.py`)
- TensorFlow demo loop → TensorFlow MTCNN: calls (evidence: `tf_mtcnn.py`)
- MXNet demo loop → InsightFace detector: calls (evidence: `mxnet_mtcnn.py`)
- Naive demo loop → Video preview: displays annotated frames (evidence: `naive.py`)
- PyTorch demo loop → Video preview: displays annotated frames (evidence: `pytorch_mtcnn.py`)
- TensorFlow demo loop → Video preview: displays annotated frames (evidence: `tf_mtcnn.py`)
- MXNet demo loop → Video preview: displays annotated frames (evidence: `mxnet_mtcnn.py`)
