Skip to content

piewsh/Privacy-Blur-Model

Repository files navigation

👤 PrivacyBlur — Construction Site Face & Text Anonymization

Privacy-preserving image anonymization pipeline for construction site photography Built as a preprocessing module for the HECA Safety Assessment System

Python Flask OpenCV YOLOv8


📋 Overview

PrivacyBlur is a multi-model face, text, and logo anonymization pipeline designed specifically for construction site images. It ensures worker privacy compliance before images are analyzed by downstream AI systems like the HECA hazard detection pipeline.

Why This Matters

Construction safety research often requires analyzing thousands of site photographs. Regulations (GDPR, India's DPDP Act) mandate that worker identities be protected. This tool automates that process with high precision.


🏗️ Architecture

Input Image (Construction Site)
        │
        ├──► Face Detection (3 models in ensemble)
        │      ├── OpenCV DNN (Caffe model)
        │      ├── MediaPipe BlazeFace (TFLite)
        │      └── YOLOv8n (person + skin-tone filtering)
        │
        ├──► Text Detection (EAST / morphological)
        │
        ├──► Logo Detection (Hough circles + contours)
        │
        └──► NMS Deduplication → Gaussian Blur → Output

✨ Features

  • Ensemble face detection — 3 independent models with NMS deduplication for high recall
  • Skin-tone filtering — Reduces false positives on equipment/signage using HSV analysis
  • Text & logo blur — Optionally anonymizes signage, company logos, and safety boards
  • Flask web UI — Drag-and-drop interface for batch processing
  • Configurable blur intensity — Adjustable Gaussian kernel for different anonymization levels

🚀 Quick Start

# Clone
git clone https://github.com/piewsh/Face-Privacy-Blur-Model.git
cd Face-Privacy-Blur-Model

# Install dependencies
pip install -r requirements.txt

# Download model weights (not included in repo due to size)
# YOLOv8n: https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt
# Caffe face model: https://github.com/opencv/opencv_3rdparty

# Run web UI
python app.py
# Open http://localhost:5000

📁 Project Structure

Face-Privacy-Blur-Model/
├── app.py                          # Flask web server
├── precision_blur.py               # Core blur pipeline (main engine)
├── face_text_blur.py               # Basic face + text blur
├── face_text_blur_enhanced.py      # Enhanced multi-model version
├── deploy.prototxt                 # OpenCV DNN face model config
├── blaze_face_short_range.tflite   # MediaPipe BlazeFace model
├── static/
│   └── index.html                  # Web UI frontend
├── requirements.txt
└── README.md

🔒 Privacy Notice

Test images containing actual construction workers have been removed from this public repository. The model weights for face_model.caffemodel (~10MB) and yolov8n.pt (~6.5MB) are also excluded due to size — see Quick Start for download links.


🔗 Related

👤 Author

Piyush Ranjan SinghGitHubEmail

About

A privacy-preserving face blur pipeline used in construction safety to anonymize worker faces before VLM analysis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors