Face Detection - PavementPrometheus/Street-Watch GitHub Wiki
The detection and obfuscation of pedestrian faces allow our project to retain important data while protecting the identities of pedestrians. This program uses a feature-based method to detect key facial features as it allows faces to be detected easily in different angles and environments.
detect_faces.py: Detects the faces of pedestrians and outputs the confidence
blur_faces.py: Detects the faces of pedestrians and outputs the confidence and obfuscated faces
- Project Integration
- Requirements Installation
- Execution Options
- Input Variation
- Feature-based Method
The object detection algorithm outputs images (frame-by-frame) of detected pedestrians with a text file containing the frame number and pedestrian coordinates. The face detection algorithm then uses those coordinates to pinpoint areas of the image to detect and obscure the pedestrian's face. By default, in case image quality or environmental conditions do not allow for clear detection, the full body of the pedestrian will be obscured. This allows for pedestrian's identities to stay private, no matter the situation. The facial detection program outputs the image with the fully detected and obscured faces of pedestrians to then be stored in the database.
First, make sure your machine is running python version 2.7. If not, download it here: Python 2.7
Please ensure all needed requirements are installed by running the following command with the given requirements.txt:
pip install -r requirements.txt
1) Run test.sh - This is a demo script that will take in pre-selected images and output them, running both detect_faces.py and blur_faces.py
2) Run the following command:
python <py_file_name> --image <image_name> --prototxt deploy.prototxt --model res10_300x300_ssd_iter_140000.caffemodel
<py_file_name> : either detect_faces.py or blur_faces.py
--image: Path to input image / image file name
--prototxt: Path to Caffe 'deploy' prototxt file
--model: Path to Caffe pre-trained model
--confidence: Minimum probability to filter weak detections
python detect_faces.py --image michael_scott.jpg --prototxt deploy.prototxt --model res10_300x300_ssd_iter_140000.caffemodel
After running the previous command, example output would be:
original image detect_faces.py: blur_faces.py
Due to the feature-based method, the face detection program is able to detect pedestrians at varying angles and depths. A variety of images were tested to accunt for real-world situations.

Feature-based method takes a bottom-up approach where the program detects facial features first and works to detect invariant features. For this method, the features are detected through examining the edge, intensity, color, shape, etc. of a facial feature. The image is examined to find common variances in the face, grouping the components together to ensure they match. Strengths of using the Feature-based method for detection are that facial features are more likely to be located despite the orientation of the face. If a person is faced to the side or ad a different direction, the program is not fazed as it is not looking at the overall face but the distinctive features.