Deterministic Operational Intelligence Platform for Real-Time Facial Recognition, Temporal Filtering and Incident Escalation
Executive Summary • User Interface • Architecture Maps • Mathematical Foundations • Performance • Deployment • Security • Quick Start
TRACE-AML (Tracking, Recognition, Analysis and Classification Engine — Autonomous Monitoring Layer) is an enterprise-grade operational intelligence platform designed for high-consequence biometric surveillance and automated threat detection. It converts uncalibrated RTSP/webcam video feeds into a forensic-grade identification terminal by combining deep metric learning with a multi-stage temporal decision engine, BLAS-accelerated vector retrieval, graph-based entity deduplication, and authenticated cryptographic storage.
The platform is designed to operate both as an isolated desktop application (compiled to a standalone binary inside an Electron shell) and as a distributed microservice exposing FastAPI REST endpoints and Server-Sent Event (SSE) streams for multi-operator control rooms.
| Strategic Focus | Architectural Implementation | Performance Impact |
|---|---|---|
| Biometric Jitter Suppression | 6-frame sliding window with Exponential Moving Average (EMA |
40–80% reduction in frame-to-frame identity flip-flopping |
| Sublinear Vector Search | Pre-normalized float32 gallery matrix multiplication dispatches directly to BLAS/SIMD kernels |
~100× throughput increase vs. interpreted |
| Retroactive Entity Merging | Path-compressed Union-Find algorithm over pairwise embedding similarity matrices | Merges 50 duplicate unknown entities in < 2 ms |
| Forensic Evidence Vault | XChaCha20 / ChaCha20-Poly1305 AEAD encryption with SHA-256 content addressing | Zero PII leakage in directory structures or filenames |
| Dual Deployment Surface | PyInstaller-packaged Python backend wrapped in an Electron shell + FastAPI SSE web layer | Standalone single-file .exe installer or containerized cloud node |
The following high-resolution production interface captures demonstrate the frontend architecture, desktop bootstrap sequence, real-time surveillance dashboard, incident management triage, and DuckDB analytical query engine.
High-density operator terminal featuring active entity watchlists, live video stream controls, real-time alert logs, and 5ms telemetry latency monitoring.
Structured incident management interface with severity badges (High, Medium, Low), chronological event timelines, correlation metrics, trigger alerts, and automated forensic PDF report synthesis.
DuckDB-backed historical event analytics surface displaying global event density, temporal window aggregations (1H to 1M), peak activity tracking, and ad-hoc history queries.
LanceDB-backed entity registry browser demonstrating entity lookup, category tagging (Criminal, VIP, Unknown), status lifecycle filters, alert aggregations, and real-time database synchronization.
Desktop authorization surface demonstrating Google OAuth 2.0 single-sign-on identity verification and remote policy-based access control.
The following interactive diagrams map the data plane, component dependency layout, and execution sequence of TRACE-AML.
flowchart LR
subgraph Input["Video Capture & Ingestion"]
Cam["Threaded Webcam / RTSP Stream"] --> Buffer["Class-Level Shared Frame Buffer"]
end
subgraph Perception["Biometric Inference & Gating"]
Buffer --> Quality{"Quality Filter\n(Blur, Pose, Min Size)"}
Quality -- "Passed" --> SCRFD["SCRFD Face Detector"]
SCRFD --> ArcFace["ArcFace-R100\n(512-d Embedding Extraction)"]
end
subgraph MetricEngine["Accelerated Search & Temporal Decision"]
ArcFace --> BLAS["EmbeddingGalleryCache\n(BLAS Matrix Matmul: G @ q)"]
BLAS --> Temporal["Temporal Decision Engine\n(EMA Smoothing + Majority Vote)"]
end
subgraph StateManagement["Entity Resolution & Rule Evaluation"]
Temporal --> Resolver["Entity Resolver\n(Track State Management)"]
Resolver --> Rules["Deterministic Rules Engine\n(Reappearance / Instability / Recurrence)"]
end
subgraph Escalation["Incident Management & Multi-Channel Action"]
Rules --> Incidents["Incident Lifecycle Manager"]
Incidents --> ActionEngine["Action Engine\n(Priority-Ordered Policy Engine)"]
ActionEngine --> PDF["Forensic PDF Generation"]
ActionEngine --> Email["SMTP Email Dispatch"]
ActionEngine --> WA["WhatsApp Bridge Dispatch"]
end
subgraph Storage["Persistence & Encryption"]
ArcFace --> Vault["DataVault AEAD\n(ChaCha20-Poly1305 + SHA-256)"]
Incidents --> LanceDB["LanceDB Vector Store"]
Incidents --> DuckDB["DuckDB Analytical SQL Store"]
end
subgraph Presentation["User Interface & Clients"]
LanceDB --> FastAPI["FastAPI REST & SSE Server"]
FastAPI --> WebUI["Live Ops Web Dashboard"]
FastAPI --> ElectronApp["Electron Desktop Shell"]
end
flowchart TB
subgraph PresentationLayer["Presentation & Distribution Layer"]
Electron["electron/ (Desktop Main, Runtime, Preload)"]
WebFrontend["src/frontend/ (Live Ops, Entities, Incidents, Settings UI)"]
ServiceApp["src/trace_aml/service/app.py (FastAPI Routes & SSE)"]
end
subgraph CoreEngine["Pipeline & Processing Core"]
Session["pipeline/session.py (Session Orchestrator)"]
TemporalEngine["pipeline/temporal.py (Temporal Decision Engine)"]
ResolverEngine["pipeline/entity_resolver.py (Entity Resolver)"]
ClustererEngine["pipeline/clusterer.py (Union-Find Graph Clusterer)"]
RuleEvaluator["pipeline/rules_engine.py (Deterministic Rules Engine)"]
IncidentOrchestrator["pipeline/incident_manager.py (Incident Lifecycle Manager)"]
ActionDispatcher["pipeline/action_engine.py (Action Policy Dispatcher)"]
end
subgraph VisionSubsystem["Biometric Vision Subsystem"]
ArcFaceRecognizer["recognizers/arcface.py (SCRFD + ArcFace Model Pack)"]
QualityGating["quality/gating.py & scoring.py (Face Quality Assessment)"]
LivenessChecker["liveness/ (Minifas / Passthrough Liveness)"]
end
subgraph SecurityAuth["Security & Authentication"]
AuthRuntime["auth/ (Google OAuth 2.0, Open Policy, Desktop Sessions)"]
DataVaultModule["store/data_vault.py (ChaCha20-Poly1305 Encrypted Vault)"]
end
subgraph PersistenceLayer["Storage & Data Engine"]
VectorStoreModule["store/vector_store.py (LanceDB & DuckDB Management)"]
GalleryCacheModule["store/embedding_cache.py (BLAS In-Memory Cache)"]
end
Electron --> ServiceApp
WebFrontend --> ServiceApp
ServiceApp --> SecurityAuth
ServiceApp --> Session
Session --> VisionSubsystem
Session --> CoreEngine
CoreEngine --> PersistenceLayer
SecurityAuth --> DataVaultModule
sequenceDiagram
autonumber
participant Camera as Camera Stream
participant Pipeline as Session Pipeline
participant Biometrics as Vision Model (ArcFace)
participant Cache as BLAS Gallery Cache
participant Temporal as Temporal Engine
participant Incidents as Incident Manager
participant Actions as Action Dispatcher
Camera->>Pipeline: Capture Frame (1080p, 30 FPS)
Pipeline->>Biometrics: Extract Bounding Box & 512-d Vector
Biometrics-->>Pipeline: Return Face Embedding (q)
Pipeline->>Cache: Matrix Multiply Match (S = G @ q)
Cache-->>Pipeline: Top Cosine Similarity Match Score
Pipeline->>Temporal: Evaluate Track Window (EMA α=0.6, Majority Vote)
Temporal-->>Pipeline: Resolved Identity & Decision State (Accept / Review / Reject)
alt State == Accept or Review
Pipeline->>Incidents: Evaluate Rules (Reappearance / Recurrence)
Incidents->>Incidents: Group or Update Incident (Status: Open)
Incidents->>Actions: Dispatch Escalation Trigger
Actions->>Actions: Generate Forensic PDF Report
Actions->>Actions: Transmit Email (SMTP) & WhatsApp Notification
end
Let
Traditional Python loops iterate through gallery vectors sequentially, suffering from
Following matrix multiplication, top-$k$ candidates are extracted in np.argpartition):
To stabilize frame-to-frame photometric variance, confidence scores for a tracked identity
Final identity resolution requires both the smoothed confidence
Spatial continuity across consecutive video frames is calculated using a weighted multi-signal cost function:
Faces undergo pre-embedding validation to reject motion-blurred or extreme off-axis frames. The composite quality index
To deduplicate un-enrolled "unknown" entity profiles observed under variable illumination, TRACE-AML constructs an undirected similarity graph
Connected components are resolved in near-constant amortized time using Union-Find with path compression:
The following empirical benchmarks demonstrate the performance gains achieved by TRACE-AML's architecture compared to traditional single-frame biometric processing pipelines:
| Metric | Naïve Python Pipeline | TRACE-AML v4 Architecture | Improvement Factor |
|---|---|---|---|
| 10,000 Gallery Search Latency | 84.2 ms / frame | 0.82 ms / frame | ~102× faster |
| Temporal Identity Oscillation | 18.4 flips / min | 1.8 flips / min | 90.2% stability gain |
| Unknown Entity Graph Clustering |
|
Union-Find matmul (1.8 ms) | > 600× throughput |
| Memory Access Pattern | Non-contiguous Python lists | Contiguous float32 C-arrays |
L1/L2 Cache Optimal |
| Frame Throughput (1080p Stream) | 8.5 FPS (CPU) | 30.0 FPS (CPU / DirectML) | 3.5× frame rate |
TRACE-AML implements a privacy-first data protection architecture to ensure compliance with privacy regulations (e.g., GDPR, CCPA) and maintain evidence chain-of-custody:
- Content Addressing: Face images are stored as opaque binary blobs named via
SHA-256(plaintext_bytes). Filesystem paths contain zero entity names or timestamps. - Authenticated AEAD Encryption: Stored media is encrypted at rest using ChaCha20-Poly1305 (256-bit key, 12-byte nonce, 16-byte authentication tag).
- Blob Wire Structure:
[1 Byte: Version=0x01] [1 Byte: Algorithm=0x01] [12 Bytes: Nonce] [Ciphertext + 16 Bytes: Poly1305 Tag] - OS Keychain Security: Encryption keys are secured via the native OS keychain (
keyring) in packaged desktop mode, or configured viaTRACE_VAULT_KEY. - Open Google OAuth Policy: Supports Google OAuth 2.0 authentication gates configured to allow all valid Google-authenticated user accounts without restrictive whitelists.
TRACE-AML provides dual-mode deployment targets: a self-contained, offline-capable desktop installation packaged as an Electron desktop application, and a distributed cloud microservice layer served via FastAPI and Uvicorn.
The desktop distribution isolates system dependencies by compiling the Python runtime and native C++ extensions into a standalone executable bundle, removing external Python environment requirements for end users.
- Main Process (
electron/main.js): Manages desktop lifecycle, window initialization, system tray integration, and child process management. - Child Process Management: Spawns the compiled PyInstaller Python backend (
trace-aml-backend.exe/trace-aml-backend) as an unprivileged subprocess. - Health Polling and Handshake: Electron polls
/healthevery 1,000 ms (up to a 120-second startup window) until the FastAPI service signals ready before transitioning from the splash screen to the main UI. - Secure IPC Bridge (
electron/preload.js): Exposes sanitized renderer methods viacontextBridgewithcontextIsolation: trueandnodeIntegration: false.
In desktop mode, environment variable TRACE_DATA_ROOT automatically redirects application state, LanceDB vector storage, DuckDB SQL tables, and DataVault binary blobs to platform-standard user-data directories:
- Windows:
%APPDATA%\TRACE-AML - macOS:
~/Library/Application Support/TRACE-AML - Linux:
~/.config/TRACE-AML
# Step 1: Compile Python backend to standalone executable bundle
.\scripts\build_backend.ps1
# Step 2: Package desktop installer via Electron Builder
cd electron
npm install
npm run distOutputs generated in electron/dist/:
- Windows NSIS Installer (
.exe): Guided setup wizard with Start Menu integration, desktop shortcuts, and uninstaller logic. - Portable Executable: Standalone executable for zero-installation deployment from removable media.
For enterprise control rooms and multi-operator surveillance deployments, TRACE-AML runs as a high-throughput ASGI microservice layer.
- ASGI Engine: Uvicorn running ASGI application instance created by
create_service_app(). - Asynchronous State Synchronisation: Real-time events, biometric detection telemetry, and incident updates are broadcast via Server-Sent Events (SSE) at
/api/v1/events/stream. - Shared In-Memory Event Stream: High-frequency streaming publisher maintains ring buffers for zero-latency client reconnects.
[Unit]
Description=TRACE-AML Operational Intelligence Service
After=network.target
[Service]
Type=simple
User=traceaml
WorkingDirectory=/opt/trace-aml
Environment="PYTHONPATH=src"
Environment="TRACE_DATA_ROOT=/var/lib/trace-aml"
Environment="TRACE_VAULT_KEY=64_character_hex_key_here"
ExecStart=/opt/trace-aml/venv/bin/python start_service.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetFor production deployments behind TLS, proxy requests to the Uvicorn ASGI backend on port 8080:
server {
listen 443 ssl http2;
server_name surveillance.example.com;
ssl_certificate /etc/letsencrypt/live/surveillance.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/surveillance.example.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Enable Server-Sent Events (SSE) streaming without buffering
location /api/v1/events/stream {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_buffering off;
proxy_cache off;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
}
}| Capability | Electron Desktop Application | FastAPI Cloud Microservice |
|---|---|---|
| Primary Target | Single-operator workstation | Multi-operator security operations center |
| Python Dependency | Embedded (PyInstaller standalone binary) | System / Virtualenv Python 3.11+ |
| Storage Isolation | OS User-Data Directory (%APPDATA%) |
Custom Configurable Path (/var/lib/trace-aml) |
| Key Storage | OS Keychain (keyring) |
Environment Variable (TRACE_VAULT_KEY) |
| Client Streaming | Local Loopback REST + IPC | SSE Streaming + Reverse Proxy (Nginx) |
| Authentication | Automatic Local Handoff | Google OAuth 2.0 / Policy Gate |
TRACE-AML includes a comprehensive automated unit and integration test suite covering vector caching, temporal resolution, quality gating, service endpoints, and incident policies.
# Run full test suite
pytest -v============================= 68 passed in 32.66s =============================
Automated testing is enforced on every commit via GitHub Actions (.github/workflows/ci.yml):
- Multi-version Python matrix (Python 3.11 & Python 3.12)
- Static analysis via Ruff
- Full pytest suite verification
- Python 3.11+
- Node.js 18+ & npm (for Electron desktop shell)
- Git
# Clone repository
git clone https://github.com/Utkarsh-X/TRACE-AML.git
cd TRACE-AML
# Install Python package in editable mode
pip install -e .# Launch FastAPI web service
python start_service.pyOnce running, access the dashboard and documentation endpoints:
- Live Ops Dashboard: http://localhost:8080/ui/live_ops/index.html
- Entities Management: http://localhost:8080/ui/entities/index.html
- Interactive API Docs (Swagger UI): http://localhost:8080/docs
This project is licensed under the MIT License — see the LICENSE file for details.
MIT License — Copyright (c) 2025 Utkarsh Chandra
TRACE-AML v4.0.0 — Autonomous Operational Intelligence Engine




