Skip to content

This repository can be used to blur people from images or video. It uses Yolov3, pytorch and opencv.

License

Notifications You must be signed in to change notification settings

maartensukel/privacy-filter-object-detection-blur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blur objects using yolov3

This repository can be used to blur people from images or video. It uses Yolov3, pytorch and opencv.

🔨 How to setup?

Some initial configuration is required to run things. First we need to install all the python dependencies, and then download the network weights.

  • (Optional) If you want GPU acceleration, you've got two options. Either install pytorch with CUDA dependencies or install CUDA seperately.

  • After having activated your favorite virtual environment, install the required packages using pip by running pip install -r requirements.txt. You might wanted to consider installing numpy, scipy and sklearn libraries using conda, as they are compiled with CPU-specific optimizations which can speed things up quite a bit.

  • Next up is downloading the YOLO network weights. You can do this by either download them here or by running wget https://pjreddie.com/media/files/yolov3.weights. Once the download is compete, place the yolov3.weights in the weights folder.

▶️ How to use?

usage: blur.py [-h] -i INPUT [-t OBJ_THRESH] [-n NMS_THRESH]
                        [--min-hits MIN_HITS] [--max-age MAX_AGE] [-o OUTDIR]
                        [-w] [--debug-trackers] [--cuda] [--no-show] [-c BLUR] [-b BLURCOLOR]

Object detection/blurring with YOLOv3

optional arguments:
  -h, --help            show this help message and exit
  -i, --input INPUT     input directory or video
  -t, --obj-thresh OBJ_THRESH
                        objectness threshold, DEFAULT: 0.5
  -n, --nms-thresh NMS_THRESH
                        non max suppression threshold, DEFAULT: 0.4
  -o, --outdir OUTDIR output directory, DEFAULT: output/
  -w, --webcam          flag for detecting from webcam. Specify webcam ID in
                        the input. usually 0 for a single webcam connected
  -c, --blurclasses     What classes to blur, DEFAULT: ['person','truck', 'car','motorbike']
  -b, --blurcolor     What type of blur to use, DEFAULT: blur. Can also be a color, for black: (0,0,0)

🎉 Who made this possible?

This project wouldn't be possible without all the hard work on these projects:

About

This repository can be used to blur people from images or video. It uses Yolov3, pytorch and opencv.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published