A COVID-19 face mask detector built with OpenCV, Keras/TensorFlow, and Deep Learning.:relaxed:
This project was inspired by seeing others implement their own solutions. Since I had some knowledge in that field, I wanted to try my hands on it also. I'm going to build from Prajna Bhandry's work. I believe this will go along way to ensure the safety of others when implemented by the medical professionals.
- Dataset To create the dataset, Prajna had an ingenious solution of:
- Taking normal images of faces.
- Then creating a python script to add face masks by using facial landmarks. You can refer to Prajna's GitHub repository to find out how this is done. (When using an artificial dataset of people wearing masks, the images without masks in the training setcannot be re-used. Non-face mask images images that were not used in the artificial generation process need to be gathered. If not done this way, the model will become heavily biased and fail to generalize well.)
- Trained by fine-tuning the MobileNet V2 architecture, a highly efficient architecture that can be applied to embedded devices with limited computational capacity (eg. Raspberry Pi, NVIDIA Jetson Nano, Google Coral ...).
- Clone the repo
$ git clone https://github.com/aibenStunner/face-mask-detector.git
$ cd face-mask-detector
- Install dependencies
$ pip install -r requirements.txt
- To build the mask detector model, open up a shell and issue the following command:
$ python mask_detector_trainer.py --dataset dataset
- Implementing the COVID-19 face mask detector for images with OpenCV
$ python detect_mask_image.py --image test_images/test_01.jpeg
- Implementing the COVID-19 face mask detector for video stream with OpenCV
$ python detect_mask_video.py
- COVID-19 face mask detector training accuracy/loss curves demonstrate high accuracy and little signs of overfitting the data:sweat_smile:.
- Mask detection using the COVID-19 face mask detector:smile:.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
If you are interested in helping or have something to suggest or just want to chat with me, you can reach me through the following media .
- Email - ebenezergadri99@gmail.com 📧
- Let's connect on LinkedIn. 📌
- I'm on HackerRank too.:relaxed:
- Improve the accuracy of the mask detector. The dataset didn't contain example images of people wearing face masks ergo when a large portion of the face is occluded, the face detector might fail to detect the face.
- Apply the model to live camera feeds
MIT © Gadri Ebenezer