MIT License

项目介绍

spacewalk01/yolov5-face-mask-detection 是一个托管在 GitHub 上的开源项目,主要使用 Jupyter Notebook 编写,采用 MIT License 许可证,目前获得 39 个 Star、13 次 Fork。

仓库全名
spacewalk01/yolov5-face-mask-detection
开源许可证
MIT License
Star 数
39
Fork 数
13

README 摘要

Face Mask Detection Face mask detection is an object detection task that detects whether people are wearing masks or not in videos. This repo includes a demo for building a face mask detector using YOLOv5 model. Dataset The model was trained on Face-Mask dataset which contains 853 images belonging to 3 classes, as well as their bounding boxes in the PASCAL VOC format. The classes are defined as follows: With mask…

完整内容见 GitHub 原始 README 或本页 。

常见问题

yolov5-face-mask-detection 用什么语言开发?

主要使用 Jupyter Notebook 编写,采用 MIT License 许可证,目前有 39 个 Star。

yolov5-face-mask-detection 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 yolov5-face-mask-detection 的源码?

可以直接克隆仓库:git clone https://github.com/spacewalk01/yolov5-face-mask-detection.git;安装与运行步骤见仓库 README。

yolov5-face-mask-detection 最近还在维护吗?

仓库最近一次更新为 2022年8月29日,当前没有未关闭的 Issue;Star 数为 39,可作为社区活跃度的参考。

关于

Face Mask Detection using YOLOv5

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
104
价值分
31
活跃状态
活跃

语言占比

Jupyter Notebook
Python

README

Face Mask Detection

Face mask detection is an object detection task that detects whether people are wearing masks or not in videos. This repo includes a demo for building a face mask detector using YOLOv5 model.

Dataset

The model was trained on Face-Mask dataset which contains 853 images belonging to 3 classes, as well as their bounding boxes in the PASCAL VOC format. The classes are defined as follows:

  • With mask
  • Without mask
  • Mask worn incorrectly

Setup

  • Clone this repo and install YOLOv5:
git clone https://github.com/spacewalk01/face-mask-detection
cd face-mask-detection

# Install yolov5
git clone https://github.com/ultralytics/yolov5
cd yolov5
pip install -r requirements.txt
Training
  • Download Face-Mask dataset from Kaggle and copy it into datasets folder.
  • Execute the following command to automatically unzip and convert the data into the YOLO format and split it into train and valid sets. The split ratio was set to 80/20%.
cd ..
python prepare.py
  • Start training:
cd yolov5
python train.py --img 640 --batch 16 --epochs 100 --data ../mask_config.yaml --weights yolov5s.pt --workers 0
Inference
  • If you train your own model, use the following command for inference:
python detect.py --source ../datasets/input.mp4 --weights runs/train/exp/weights/best.pt --conf 0.2
  • Or you can use the pretrained model models/mask_yolov5s.pt for inference as follows:
python detect.py --source ../datasets/input.mp4 --weights ../models/mask_yolov5.pt --conf 0.2

Results

The following charts were obtained after training YOLOv5s with input size 640x640 on the Face Mask dataset for 100 epochs.

Precision-Recall (PR) measures the accuracy of bounding box overlap between predicted bboxes and ground truth bboxes.

Precision Curve Recall Curve PR Curve

The following metrics were measured on the valid dataset containing 171 images. High precision and recall scores were obtained on with mask and without mask classes. However, the performance on mask weared incorrectly class was poor due to the imbalanced data.

Class #Labels Precision Recall mAPval
0.5
mAPval
0.5:0.95
with mask 630 0.94 0.9 0.95 0.64
without mask 104 0.86 0.82 0.9 0.6
mask weared incorrectly 20 0.72 0.3 0.43 0.24
total 754 0.84 0.67 0.76 0.49
Ground Truths vs Predictions
Ground Truth Prediction

Reference

评论

暂无评论