# ankubisht987/automated-face-detection-and-identification-in-video-streams architecture

> Architecture diagram of the GitHub repository ankubisht987/automated-face-detection-and-identification-in-video-streams, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ankubisht987/automated-face-detection-and-identification-in-video-streams
- Repository: https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams

## Overview

This repository implements a React dashboard backed by a FastAPI face-matching service; the root README’s Streamlit/DeepFace description does not match the sampled runtime. The user uploads a reference image and video, sets processing parameters, starts a session job, then reviews timestamps, segments, and preview frames and exports results. The backend keeps session state in memory and performs sampled-frame detection and embedding comparison. The dashboard excerpt confirms session, reference, processing, status, and cleanup requests; backend excerpts show results and segment endpoints, but not a frontend call to those endpoints, so those links are omitted.

Main entry points: [`model/app.py`](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py) (FastAPI endpoints), [`frontend/src/dashboard/Dashboard.jsx`](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/frontend/src/dashboard/Dashboard.jsx) (Dashboard), [`frontend/src/App.jsx`](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/frontend/src/App.jsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_app["App shell<br/>[App.jsx]"]
end

subgraph group_service["API and sessions"]
  node_api["FastAPI endpoints<br/>[app.py]"]
  node_session[("Session state<br/>[app.py]")]
  node_job["Video job<br/>[app.py]"]
end

subgraph group_vision["Face matching"]
  node_reference["Reference setup<br/>[app.py]"]
  node_frame_match["Frame matching<br/>[app.py]"]
  node_enhancement["Image enhancement<br/>[app.py]"]
  node_insightface["InsightFace engine<br/>[app.py]"]
end

subgraph group_results["Results"]
  node_results["Detection results<br/>[app.py]"]
  node_segments["Time segments<br/>[app.py]"]
  node_export["CSV export<br/>[Dashboard.jsx]"]
  node_previews["Preview frames<br/>[app.py]"]
end

node_user(("User"))

node_user -->|"uploads and configures"| node_dashboard
node_app -->|"renders"| node_dashboard
node_dashboard -->|"requests session and processing"| node_api
node_api -->|"creates and reads"| node_session
node_api -->|"sets reference"| node_reference
node_reference -->|"extracts embedding"| node_insightface
node_api -->|"schedules processing"| node_job
node_job -->|"samples and compares frames"| node_frame_match
node_frame_match -->|"detects and embeds faces"| node_insightface
node_reference -->|"tries enhanced variants"| node_enhancement
node_job -->|"tries enhanced variants"| node_enhancement
node_job -->|"stores status and detections"| node_session
node_api -->|"serves results"| node_results
node_api -->|"builds time segments"| node_segments
node_job -->|"collects preview frames"| node_previews
node_dashboard -->|"downloads CSV"| node_export

click node_dashboard "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/frontend/src/dashboard/Dashboard.jsx"
click node_app "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py"
click node_session "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py"
click node_job "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py"
click node_reference "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py"
click node_frame_match "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py"
click node_enhancement "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py"
click node_insightface "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py"
click node_results "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py"
click node_segments "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py"
click node_export "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/frontend/src/dashboard/Dashboard.jsx"
click node_previews "https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.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_dashboard,node_app,node_user toneBlue
class node_api,node_session,node_job toneAmber
class node_reference,node_frame_match,node_enhancement,node_insightface toneMint
class node_results,node_segments,node_export,node_previews toneRose
```

## Components

### Web interface

- [Dashboard](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/frontend/src/dashboard/Dashboard.jsx): `frontend/src/dashboard/Dashboard.jsx`
- [App shell](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### API and sessions

- [FastAPI endpoints](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`
- [Session state](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`
- [Video job](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`

### Face matching

- [Reference setup](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`
- [Frame matching](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`
- [Image enhancement](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`
- [InsightFace engine](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`

### Results

- [Detection results](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`
- [Time segments](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`
- [CSV export](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/frontend/src/dashboard/Dashboard.jsx): `frontend/src/dashboard/Dashboard.jsx`
- [Preview frames](https://github.com/ankubisht987/automated-face-detection-and-identification-in-video-streams/blob/main/model/app.py): `model/app.py`

### Other components

- **User**

## Connections

- User → Dashboard: uploads and configures (evidence: `frontend/src/dashboard/Dashboard.jsx`)
- App shell → Dashboard: renders (evidence: `frontend/src/App.jsx`)
- Dashboard → FastAPI endpoints: requests session and processing (evidence: `frontend/src/dashboard/Dashboard.jsx`)
- FastAPI endpoints → Session state: creates and reads (evidence: `model/app.py`)
- FastAPI endpoints → Reference setup: sets reference (evidence: `model/app.py`)
- Reference setup → InsightFace engine: extracts embedding (evidence: `model/app.py`)
- FastAPI endpoints → Video job: schedules processing (evidence: `model/app.py`)
- Video job → Frame matching: samples and compares frames (evidence: `model/app.py`)
- Frame matching → InsightFace engine: detects and embeds faces (evidence: `model/app.py`)
- Reference setup → Image enhancement: tries enhanced variants (evidence: `model/app.py`)
- Video job → Image enhancement: tries enhanced variants (evidence: `model/app.py`)
- Video job → Session state: stores status and detections (evidence: `model/app.py`)
- FastAPI endpoints → Detection results: serves results (evidence: `model/app.py`)
- FastAPI endpoints → Time segments: builds time segments (evidence: `model/app.py`)
- Video job → Preview frames: collects preview frames (evidence: `model/app.py`)
- Dashboard → CSV export: downloads CSV (evidence: `frontend/src/dashboard/Dashboard.jsx`)
