# Face-Mask-Detector
[![](https://img.shields.io/badge/License-GPLv3-green.svg)](https://github.com/rohandubey/Face-Mask-Detector/blob/master/LICENSE)
![pypi](https://img.shields.io/pypi/v/torch)
![versions](https://img.shields.io/badge/python-3.8%2B-blue)
[![PyPI status](https://img.shields.io/pypi/status/trains-jupyter-plugin.svg)](https://pypi.python.org/pypi/trains-jupyter-plugin/)
<br></br>
In the amidst of COVID-19, as there is no proper channel to effectively monitor people wearing mask and not. So to tackle this problem, I made an AI solution based on YOLOv5 model to detect those who are **not wearing mask**. This software is tested by Rajasthan Police (Govt. of India), and is designed to be installed alongside their CCTVs for efficient working. This software can **multi-stream** many sources together and collects data contionuously from those streams.
Based on **YOLOv5** model and **RetinaNet Architecture**, having <br>
| | |
|---------- |------ |
| Accuracy | 98% |
| Mean Average Precision (val) | 54.98 |
| FPS (max) | 300+ |
_Model runs on on a variety of sources like images, videos, directory, glob, http/rtsp/rtmp streams._
## Requirements
Python 3.8 or later with all [requirements.txt](https://github.com/rohandubey/Face-Mask-Detector/blob/master/requirements.txt) dependencies installed, including `torch>=1.7`. To install run:
```bash
$ pip install -r requirements.txt
```
## Inference
**_Linux :_**
execute : ```./run.sh```<br>
**_Windows :_**
execute : c```run.bat```<br>
For more smoother inference visit [CUDA](https://developer.nvidia.com/cuda)/[CUDNN](https://developer.nvidia.com/cudnn), [Python](https://www.python.org/) and [PyTorch](https://pytorch.org/) to verify for correct versions
## Working
- When the program is initialized by running `./run.sh` or `run.bat`, we see the following GUI having 3 inputs namely, **Camera, Web Links, Videos/Images/Folders.**
* * <img src="source/gui.png" width="700">
* **1. Camera**: Submit the Camera ID for any local cameras connected to your device. ( 0 for default camera)<br>
* * <img src="source/camera.png" width="700">
* **2. Web Links**: Choose the link type : http/rtmp/rtsp and enter the IP address, if IP is password protected, then enter Username and password(if required)<br>
* * <img src="source/links.png" width="700">
* **3. Images/Videos/Folders**: for any Videos/Images/Folder that contains Videos/Images, choose the path in Browse button and after choosing we can see progress of detection and time left.<br>
* * <img src="source/video.png" width="700">
* * Progress :
* * <img src="source/progress.png" width="700">
## Detection Results
For Videos/Images the output videos/images is stored in `imference/output` Post-Detection.<br>
For Live streams from Webcam or WebStream (ex. `http://ip`), all images without mask are stored in `inference/data/<DATE>/<TIME>.png` format, so all the images detectedin a day are stored in one folder time-wise like :
```
$ tree --dirsfirst
├── inference\data\
│ ├── 21_Dec_20 (folder name = date)
├── 21_Dec_20 15_28_54.png (time is 15:28:54)
└── 21_Dec_20 12_20_05.png
... │ ...
│ ├── 22_Dec_20
├── 22_Dec_20 05_08_04.png
└── 22_Dec_20 02_00_55.png
```
***Demo Pic form Live Stream*** <br>
<img src="source/result_pic.png" width="700"> <br>
[***Demo Video from YouTube*** <br>](https://drive.google.com/file/d/1DfX1nSEcgMyTUz4v5BD5aRJU7cykBWzn/view?usp=sharing) Click to open!
## Built With
* YOLOv5 - Object Detection Algorithm
* OpenCV - Video/Image Streaming
* Tkinter - GUI toolkit for Python.
* PyTorch - Model training/detection Framework.
* Batch/Bash - Easy execution Programming languages for Windows/Linux respectively.
* onnx - An ecosystem for interchanging different ML Model Frameworks.
## Training Results
- Model is trained os NVIDA 940MX 2GB(used TensorFlow-GPU with CUDA).
- I created and labelled my own dataset using [Label data Helper](https://github.com/rohandubey/Label-Data-Helper).
- Added multi-threading to make detection smoother and faster.
- Added GUI for easy support and analysis.
- Converted raw pyton files to **batch** and **bash** script for direct usage.
![](utils/results.png)
## Authors
Made with ❤️ by Rohan Dubey
## References
- [OpenCV](https://github.com/opencv/opencv)
- [YOLOv5](https://github.com/ultralytics/yolov5)
- [PyTorch](https://github.com/pytorch/pytorch)
没有合适的资源?快使用搜索试试~ 我知道了~
基于 YOLOv5 模型的 AI 解决方案,用于检测戴口罩或不戴口罩的人
共28个文件
py:11个
png:7个
yaml:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 40 浏览量
2024-05-15
17:07:07
上传
评论
收藏 1.51MB ZIP 举报
温馨提示
内置 YOLOv5 - 目标检测算法 OpenCV - 视频/图像流 Tkinter - Python 的 GUI 工具包. PyTorch -模型训练/检测框架. Batch/Bash - 分别适用于 Windows/Linux 的易于执行的编程语言。 onnx - 用于交换不同 ML 模型框架的生态系统. 训练结果 模型经过训练 os NVIDA 940MX 2GB(使用 TensorFlow-GPU 和 CUDA)。 我使用 Label data Helper 创建并标记了自己的数据集。 添加了多线程,使检测更顺畅、更快捷。 添加了 GUI,便于支持和分析。 将原始 pyton 文件转换为批处理和 bash 脚本以供直接使用
资源推荐
资源详情
资源评论
收起资源包目录
Face-Mask-Detector-master.zip (28个子文件)
Face-Mask-Detector-master
LICENSE 34KB
utils
evolve.sh 747B
google_utils.py 5KB
metrics.py 8KB
results_yolov5s.txt 44KB
general.py 53KB
activations.py 2KB
results.png 204KB
plots.py 15KB
datasets.py 38KB
torch_utils.py 9KB
source
links.png 51KB
gui.png 34KB
result_pic.png 1.04MB
progress.png 12KB
video.png 124KB
camera.png 38KB
run.py 7KB
run.bat 23B
requirements.txt 263B
models
export.py 4KB
yolov5m.yaml 1KB
yolov5s.yaml 1KB
yolov5l.yaml 1KB
yolo.py 12KB
detect.py 8KB
run.sh 27B
README.md 4KB
共 28 条
- 1
资源评论
hakesashou
- 粉丝: 4312
- 资源: 1135
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功