The Year 2020 is dominated by the global COVID-19 Pandemic. People wearing Face Masks, to protect themselves against an Infection, is an omnipresent Picture.
This Project uses a Combination of OpenCV Face Tracking and a TensorFlow Neural Network to detect Faces and distinguish between People wearing a Face Mask and People who don't.
Those Informations are used to control an automated Camera-Mount, to track People not wearing a Face Mask.
- OpenCV is used to capture a live Video from a Webcam
- Using the Deep Neural Network capabilities of OpenCV with a pretrained Caffe Model to implement Face Tracking
-
Training a custom Convolutional Neural Network with MobileNet as a base Model
-
The tracked Faces from the Webcam Feed are used as an Input for the CNN
-
Based on the prediction the Box Color and Label changes (green for Mask and red for No Mask)
- Using the XY-Coordinates of the Face Tracking, an Arduino controlled automated Camera-Mount follows detected Faces without a Face Mask
- Clone the Git repository:
git clone https://github.com/samuelrothen/face_mask_detector.git
- Install the requirements:
pip install requirements.txt
- Run
/src/live_video_detection.py
to start the live Video Detection
The usage of an Arduino is disabled by default. If you want to use an Arduino to control the Camera Positioning, follow these Steps:
- Connect a Servo Motor to your Arduino using the following Wiring:
-
Upload the
.ino
-Sketch fromsrc/aduino_sketch/python_servo_sketch/python_servo_sketch.ino
using the Arduino IDE -
Open
/src/live_video_detection.py
and setuse_arduino
toTrue
(default isFalse
) and define your Arduino COM-Port inserial.Serial(...)
use_arduino = True
if use_arduino:
arduino = serial.Serial('COM3', 9600)
- Run the Python File
Distributed under the MIT License. See LICENSE
for more Information.