A full guide to make a face mask detection system using OpenCV.
I have created this system that detects the face and then recognize if a person is wearing the face mask correctly or incorrectly. Why I selected to do this project? The reason is as you are already familiar that in 2020 our lives changed because of the global issue of Covid-19. The virus started spreading everywhere through the air and every country made wearing face masks mandatory. The reason for wearing a face mask was to stop the spreading of the Covid-19 virus and to protect everyone. Even now many people are vaccinated, and the spreading of the virus is also very less but still, there are places where wearing a face mask is mandatory. Mostly crowded places like public gatherings. So, creating an artificially intelligent system that can detect if a person is wearing a face mask or not is very useful. If a person is not wearing a mask then the system will tell the authorities by sending alerts.
Follow these steps if you want to use this project or make the whole project from scratch.
- Clone the project on your local machine.
- Download Anaconda.
- Using command line go to the main directory of the project and create a new environment with this command.
python -m venv facemask
- After creating the environment then activate the environment with this command.
.\facemask\Script\activate
- Download all the required packages by going in to the "1_Installation" folder and type this command. It will download all the required packages for the project.
pip install -r requirements.txt
- Open "03_prediction" file in jupyter notebook. This file is located in "2_Machine_Learning" folder.
- Run all the code cells and at the end you will be able to detect face mask in any image or in realtime.