Click on Train in Colab if .ipynb not opening
In this lock down situation, we decided to represent our idea on Personal Hygiene which is a contribution from our side to this pandemic of corona virus.
So, we have proposed AI based prototype in which we are detecting whether a Person has worn a Mask or not. Generally in shopping malls or near grocery shops or areas where the large group of people coming then it is difficult to monitor whether the person is wearing a mask or not. Also nowadays our government had made compulsory wear a mask else penalty is considered, then in that situation, our application will classify and tell whether the person had worn a mask or not and will make alert for an administrator.
- The dataset used for training the yolov5 is from roboflow.ai
- Download and install yolov5
git clone https://github.com/ultralytics/yolov5
cd yolov5
pip install -r requirements.txt
git clone https://github.com/pritul2/yolov5_FaceMask
- Run inference
For running inference you required trained weights which is obtained from my repo cloned as yolov5_FaceMask
$ python detect.py --weights last_mask_yolov5s_results.pt --conf 0.4 --source 0 # webcam
file.jpg # image
file.mp4 # video
path/ # directory
path/*.jpg # glob
rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa # rtsp stream
http://112.50.243.8/PLTV/88888888/224/3221225900/1.m3u8 # http stream
The dataset contains 149 Images which is very less for yolo architecture. So during training I performed augmentation and increased to 298 Images.
To get more accuracy the training dataset needs to increase.
This project is mainly made for detecting a person and classify weather a person is weared the mask or not.
To use this project simply follow following steps.
-
Use following command in your working directory through type it in command Prompt. pip install FaceMasque
-
Now, import it in your python file. import FaceMasque
-
Simply call folloeing function and you are ready with mask detection project. detected_image = FaceMasque.mask_detection(original_image)