Skip to content

Detecting person with or without face mask. Trained using YOLOv5.

Notifications You must be signed in to change notification settings

pritul2/yolov5_FaceMask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

colab
Click on Train in Colab if .ipynb not opening

Description of Project

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.

yolov5_FaceMask

  • The dataset used for training the yolov5 is from roboflow.ai

Output result from testing dataset

output_img

Installation

  1. 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
  1. 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

Increasing accuracy and Future Scope

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.

Output Results from open source images

test5_out test4_out test3_out test2_out test1_out


FaceMasque - Face Mask Classifier Package

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.

  1. Use following command in your working directory through type it in command Prompt. pip install FaceMasque

  2. Now, import it in your python file. import FaceMasque

  3. Simply call folloeing function and you are ready with mask detection project. detected_image = FaceMasque.mask_detection(original_image)

The output is in below youtube link.

https://youtu.be/CAJC8iWRqrk.
Person_with_mask

About

Detecting person with or without face mask. Trained using YOLOv5.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published