← Back to portfolio
PrivacyScrub V5
GPU Video Anonymization Pipeline
PrivacyScrub V5 – End-to-End Video Anonymization for Faces and License Plates
Bodycam, surveillance, and evidentiary footage cannot be released, shared, or used for training
until faces and plates are scrubbed: a real, funded compliance need across government, defense,
and regulated industry. PrivacyScrub is a production-style, GPU-accelerated service that detects,
tracks, and anonymizes faces and license plates across long-form video using YOLOv8,
re-identification, and chunked processing.
Project in One Sentence
PrivacyScrub V5 is a cloud-native video anonymization service that ingests user-uploaded footage, detects and tracks sensitive entities, and emits a redacted, share-safe video asset suitable for compliance-sensitive environments.
Business problem:
- Government and compliance-bound teams sit on bodycam, dashcam, surveillance, and workplace footage they cannot release or reuse until privacy obligations are met, and manual frame-by-frame redaction does not scale.
- Commercial teams face the same problem with screen recordings and training footage.
V5 outcome:
- Turned an experimental YOLO script from earlier versions into a resilient pipeline with job state, chunking, GPU workers, and CI/CD gating to prevent unsafe deployments.
“Upload a video, get back a shareable asset where all faces and plates are consistently anonymized, even across long clips and re-appearing people.”
Streamlit demo used to drive the FastAPI backend, submit jobs, and inspect redacted results. This screenshot appears on the live portfolio and README.
1. Context and Objectives
Use case: Enable analysts, engineers, and content creators to safely share or store video that originally contained PII (faces, license plates, sensitive regions) without manually editing every frame.
Constraints I designed for:
- Handle multi-minute videos without timeouts by splitting into chunks and stitching at the end.
- Support GPU acceleration for heavy detection workloads, but keep the control plane lightweight.
- Guarantee idempotent job handling so repeated uploads or retries do not corrupt state.
- Make the anonymization defaults conservative enough for privacy, but configurable for power users.
Primary objectives for V5:
- Upgrade from “single-shot YOLO pass” to a full detection + tracking + re-identification pipeline over time.
- Introduce clear job lifecycle states (QUEUED, CHUNKING, PROCESSING, STITCHING, COMPLETED, FAILED).
- Guard changes with SRS+TDD assets and shift-left CI checks so regressions are caught before deploy.
2. Solution Overview (V5)
2.1 End-to-End Flow
The V5 system is a Cloud Run–based microservice architecture with a Streamlit front end, FastAPI gateway, background workers, and a persistence layer on GCS and Firestore.
- Frontend: Streamlit app for file upload, job submission, status polling, and result download.
- API Gateway (FastAPI): Receives uploads, writes raw video to GCS, creates a job record in Firestore, and enqueues work.
- Orchestrator Worker: Downloads the original, runs FFmpeg to split into manageable chunks, and dispatches per-chunk processing tasks.
- GPU Worker: Uses YOLOv8-X, face, and plate models plus DeepSORT/Re-ID to track identities across frames and apply consistent anonymization.
- Stitching: Once all chunks complete, the orchestrator concatenates them, strips metadata, writes the final redacted video, and marks the job as COMPLETED.
2.2 Anonymization Operations
At V5, the pipeline supports a wide set of anonymization features:
- Face and license plate detection using YOLOv8-family models.
- DeepSORT-style tracker associates detections across frames, handling occlusions and re-entries.
- Re-ID embeddings ensure a single person or vehicle receives consistent anonymization across the clip, even if they temporarily leave the frame.
- Configurable anonymization policies by class (for example, blur faces, solid-mask plates, optional full-body masking).
- Bounding box smoothing and temporal interpolation to avoid flicker at detection boundaries.
2.3 Architecture Diagram
The following architecture diagram is referenced in both the portfolio and GitHub README:
High-level architecture: Streamlit client, FastAPI gateway, task queue, orchestrator worker, GPU processing worker, GCS for raw/chunk/final assets, and Firestore for job state.
2.4 Key Technologies
YOLOv8-X
DeepSORT / Re-ID
OpenCV / FFmpeg
FastAPI
Streamlit
Cloud Run
Cloud Tasks / Pub/Sub
Firestore
GCS
Terraform
3. Evolution from V1 to V5
PrivacyScrub went through multiple iterations before landing on the current V5 architecture. I captured the evolution in DM, SRS, TDD, and implementation documents for each version.
- V1: Single-script YOLO detector running locally, anonymizing faces and plates frame-by-frame with minimal error handling.
- V2: First API wrapper and simple UI; still largely synchronous, not robust to long videos or failures.
- V3: Split into a more explicit service plus job abstraction; early experiments with queues and state tracking.
- V4: Introduced stronger separation of roles (gateway vs worker), chunked processing for longer clips, and improved error handling.
- V5: Added GPU-first worker design, re-identification tracking, chunk-aware stitch pipeline, better idempotency, and Terraform-backed infrastructure definition.
This case study focuses on the final V5 design, but the documentation set in the repository (docs/DM - Personal - PrivacyScrub V5.pdf, SRS+TDD - Personal - PrivacyScrub V5.pdf) captures the full progression.
4. Technical Highlights
4.1 Detection, Tracking, and Re-Identification
- YOLOv8-X as the primary detector for faces, plates, and optionally full-body regions.
- DeepSORT-style tracker associates detections across frames, handling occlusions and re-entries.
- Re-ID embeddings ensure a single person or vehicle receives consistent anonymization across the clip, even if they temporarily leave the frame.
- Configurable anonymization policies by class (for example, blur faces, solid-mask plates, optional full-body masking).
4.2 Chunked Processing and Stitching
- FFmpeg used to split large uploads into uniform segments to avoid timeouts and memory issues.
- Each chunk is processed independently by the GPU worker; re-ID metadata can be carried forward when needed.
- Final stitching step concatenates processed chunks, normalizes codecs, and strips Exif/metadata to avoid accidental leakage.
4.3 Resilience, Idempotency, and State
- Firestore keeps a per-job document with state, progress counters, timestamps, and error details.
- Workers are written to be idempotent: reprocessing a chunk or job does not corrupt downstream state.
- Jobs move through a defined lifecycle: QUEUED → CHUNKING → PROCESSING → STITCHING → COMPLETED or FAILED.
4.4 Infrastructure as Code and CI Guards
- Terraform configuration for Cloud Run services, IAM, and core storage resources.
- SRS+TDD assets formalize requirements and test coverage for each version, especially V5.
- Automated tests validate detection, anonymization integrity, and basic video sanity before deploy.
5. Results and What I Shipped
5.1 Outcomes
- Delivered a working demo where non-technical users can upload video and download a redacted version without touching code.
- Improved stability over earlier versions by isolating long-running work into background GPU workers with clear job state.
- Produced reusable documentation (DM, SRS, TDD, and case study) that shows how I think about secure, privacy-first ML systems.
5.2 Lessons Learned
- Chunked processing and tracking must be designed together; naïve chunk boundaries can break anonymization consistency.
- Detectors that perform well on single images can still produce jitter across video; temporal smoothing is critical for a professional feel.
- Having a clear job lifecycle model (and a real data store behind it) pays off quickly in debugging and user experience.
5.3 My Responsibilities
- Defined problem scope, threat model, and anonymization requirements.
- Designed the V5 architecture and job lifecycle, including chunking and stitching strategy.
- Implemented the FastAPI backend, worker logic, and integration with YOLOv8, tracking, and FFmpeg.
- Built the Streamlit front end for demo, job submission, and download.
- Created Terraform infrastructure definitions and SRS/TDD documentation.
- Authored the portfolio case study and one-page recruiter summary.
6. Links and Assets
This project appears in the portfolio under /PrivacyScrub_V5 with the following assets:
Full design and engineering documentation (DM, SRS, TDD for V1–V5) is stored under docs/ in the GitHub repository.