https://github.com/zhiyiyo/face-mask-detector
A face mask detector based on STM32F103ZET6 and Yolov4.
https://github.com/zhiyiyo/face-mask-detector
facemask-detection pyqt5 stm32 yolov4
Last synced: 4 months ago
JSON representation
A face mask detector based on STM32F103ZET6 and Yolov4.
- Host: GitHub
- URL: https://github.com/zhiyiyo/face-mask-detector
- Owner: zhiyiYo
- License: gpl-3.0
- Created: 2022-10-04T06:59:01.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-28T03:40:25.000Z (about 3 years ago)
- Last Synced: 2025-03-17T04:05:54.185Z (over 1 year ago)
- Topics: facemask-detection, pyqt5, stm32, yolov4
- Language: C
- Homepage:
- Size: 14.7 MB
- Stars: 19
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Face-Mask-Detector
A face mask detector based on STM32F103ZET6 and Yolov4.
## Interface

## Compile and Load
You should install `arm-none-eabi-gcc` to compile this project.
```sh
cd stm32
make update
```
## Build Environment
1. Create virtual environment:
```shell
conda create -n Face_Mask_Detector python=3.8
conda activate Face_Mask_Detector
pip install -r requirements.txt
```
2. Install [PyTorch](https://pytorch.org/), refer to the [blog](https://blog.csdn.net/qq_23013309/article/details/103965619) for details.
## Train
1. Download face mask dataset from [kaggle](https://www.kaggle.com/datasets/zhiyiyo/face-mask-dataset) and unzip it.
2. Download pre-trained `CSPDarknet53.pth` model from [Google Drive](https://drive.google.com/file/d/12oV8QL937S1JWFQhzLNPoqyYc_bi0lWT/view?usp=sharing).
3. Modify the value of `root` in `train.py`, please ensure that the directory structure of the `root` folder is as follows:
```txt
root
├───Annotations
├───ImageSets
│ ├───Layout
│ ├───Main
│ └───Segmentation
├───JPEGImages
├───SegmentationClass
└───SegmentationObject
```
4. start training:
```sh
conda activate Face_Mask_Detector
python train.py
```
## Evaluation
### one model
1. Modify the value of `root` and `model_path` in `eval.py`.
2. Calculate mAP:
```sh
conda activate Face_Mask_Detector
python eval.py
```
### multi models
1. Modify the value of `root` and `model_dir` in `evals.py`.
2. Calculate and plot mAP:
```shell
conda activate Face_Mask_Detector
python evals.py
```
### mAP curve

## Detection
1. Modify the `model_path` and `image_path` in `demo.py`.
2. Display detection results:
```shell
conda activate Face_Mask_Detector
python demo.py
```
## License
Face-Mask-Detector is licensed under [GPLv3](./LICENSE).
Copyright © 2021 by zhiyiYo.