Person Blocker

利用预训练神经网络自动 "屏蔽" 图像中的人(如《黑镜》)。「Automatically "block" people in images (like Black Mirror) using a pretrained neural network.」

  • 所有者: minimaxir/person-blocker
  • 平台: Linux,Mac,Windows,Docker
  • 许可证: Other
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Person Blocker

img4

A script to automatically "block" people in images (like the Black Mirror episode White Christmas) using Mask R-CNN pretrained on the MS COCO dataset. No GPU required!

But you can block more than just people: up to 80 different types of objects can be blocked, including giraffes and busses!

Setup

This project relies on a handful of dependencies, use the following command to install your dependencies:

pip3 install -r requirements.txt

Note: Depending on your environment, you may need to use sudo. You may also want to use virtualenv.

Usage

Person Blocker is used from the command line:

python3 person_blocker.py -i images/img3.jpg -c '(128, 128, 128)' -o 'bus' 'truck'
  • -i/--image: specifies the image file.
  • -m/--model: path to the pretrained COCO model weights (default: current directory): if not specified, it will download them automatically to the current directory if not already present (note: the weights are 258 MB!)
  • -c/--color: color of the mask, in either quote-wrapped hexidecimal or 3-element RGB tuple format. (default: white)
  • -o/--object: list of types of objects to block (or object IDs of specific objects). You can see the allowable choices of objects to block in classes.py or by using the -names flag. (default: person)
  • -l/--labeled: saves a labeled image annotated with detected objects and their object ID.
  • -n/--names: prints the class options for objects, then exits.

The script outputs two images: a static (pun intended) image person_blocked.png and an animated image person_blocked.gif like the one at the beginning of this README.

Examples

python3 person_blocker.py -i images/img1.jpg

img1

python3 person_blocker.py -i images/img2.jpg -c '#c0392b' -o 'giraffe'

img2

python3 person_blocker.py -i images/img3.jpg -c '(128, 128, 128)' -o 'bus' 'truck'

img3

Blocking specific object(s) requires 2 steps: running in inference mode to get the object IDs for each object, and then blocking those object IDs.

python3 person_blocker.py -i images/img4.jpg -l

img4 labels

python3 person_blocker.py -i images/img4.jpg -o 1

img4

Requirements

The same requirements as Mask R-CNN:

  • Python 3.4+
  • TensorFlow 1.3+
  • Keras 2.0.8+
  • Numpy, skimage, scipy, Pillow, cython, h5py

plus matplotlib and imageio

Maintainer

Max Woolf (@minimaxir)

Max's open-source projects are supported by his Patreon. If you found this project helpful, any monetary contributions to the Patreon are appreciated and will be put to good creative use.

License

MIT

Code used from Mask R-CNN by Matterport, Inc. (MIT-Licensed), with minor alterations and copyright notices retained.

主要指标

概览
名称与所有者minimaxir/person-blocker
主编程语言Python
编程语言Python (语言数: 2)
平台
许可证Other
所有者活动
创建于2018-03-26 14:10:47
推送于2022-09-09 09:46:54
最后一次提交2018-04-01 22:27:19
发布数0
用户参与
星数2k
关注者数65
派生数211
提交数16
已启用问题?
问题数8
打开的问题数8
拉请求数3
打开的拉请求数4
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?