Facemask is a system to detect whether the person on the webcam is wearing a mask or not. this system need to train the face mask detector model using Keras and OpenCV.
How to run ...!
# FaceMaskDetector
# Setup
## Install Anaconda
https://docs.anaconda.com/anaconda/
install/windows/
## Import anaconda virtual environment
Open Anaconda Powershell terminal in project directory & create virtual environment using following
command:
`conda env create -f environment.yml`
Activate virtual environment
`conda activate python-ml`
## Setup dependencies files
1. Download dataset and extract zip. This dataset must contain `train` and `test` sub directories with images.
2. Download `haarcascade_frontalface_default.xml` to currect project directory form
https://github.com/opencv/opencv/edit/master/data/
haarcascades/haarcascade_frontalface_default.xml
## Train model
If dataset is copied in current project directory:
`python train.py`
If dataset is outside project directory
`python train.py --dataset `
This step will generate a trained model with name `facemask-trained-.model`
There may be multiple model files, use last one.
## Run FaceMaskDetector
Replace `` with actual generated number in previous step
`python main.py --model ./facemask-trained-.model`
Press Q or ESC to stop.
If program does not stop, use Ctrl + C.