person-blocker  by minimaxir

CLI tool to block objects in images using a pretrained neural network

created 7 years ago
2,021 stars

Top 22.4% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a script to automatically obscure objects in images, inspired by the "Black Mirror" episode "White Christmas." It targets users who want to easily anonymize or censor specific items in their photos, offering a simple command-line interface for customization.

How It Works

The tool leverages a Mask R-CNN model pre-trained on the MS COCO dataset. This allows it to detect and segment various objects within an image. Users can specify which object classes (e.g., 'person', 'bus', 'giraffe') to block, and the script applies a configurable solid color mask to the detected instances, generating both static and animated output images.

Quick Start & Requirements

  • Install dependencies: pip3 install -r requirements.txt
  • Requires Python 3.4+, TensorFlow 1.3+, Keras 2.0.8+, and libraries like NumPy, scikit-image, Pillow.
  • No GPU is required, but model weights (258 MB) are downloaded automatically if not present.
  • Usage: python3 person_blocker.py -i <image_path> -o <object_type>
  • See available object types with python3 person_blocker.py -n.

Highlighted Details

  • Blocks up to 80 different object types beyond just people.
  • Supports custom mask colors via hex or RGB tuples.
  • Can output both static images (person_blocked.png) and animated GIFs (person_blocked.gif).
  • Option to save labeled images showing detected objects and IDs.

Maintenance & Community

  • Maintained by Max Woolf (@minimaxir).
  • Project is supported via Patreon.

Licensing & Compatibility

  • MIT License.
  • Uses code from Matterport's Mask R-CNN, also MIT-Licensed. Compatible with commercial use.

Limitations & Caveats

The project relies on TensorFlow 1.3+, which is an older version and may present compatibility challenges with modern Python environments or newer TensorFlow versions.

Health Check
Last commit

2 years ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
0 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.