Skip to content

zhiyiYo/Face-Mask-Detector

Repository files navigation

Face-Mask-Detector

A face mask detector based on STM32F103ZET6 and Yolov4.

Interface

app

Compile and Load

You should install arm-none-eabi-gcc to compile this project.

cd stm32
make update

Build Environment

  1. Create virtual environment:

    conda create -n Face_Mask_Detector python=3.8
    conda activate Face_Mask_Detector
    pip install -r requirements.txt
  2. Install PyTorch, refer to the blog for details.

Train

  1. Download face mask dataset from kaggle and unzip it.

  2. Download pre-trained CSPDarknet53.pth model from Google Drive.

  3. Modify the value of root in train.py, please ensure that the directory structure of the root folder is as follows:

    root
    ├───Annotations
    ├───ImageSets
    │   ├───Layout
    │   ├───Main
    │   └───Segmentation
    ├───JPEGImages
    ├───SegmentationClass
    └───SegmentationObject
  4. start training:

    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:

    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:

    conda activate Face_Mask_Detector
    python evals.py

mAP curve

map curve

Detection

  1. Modify the model_path and image_path in demo.py.

  2. Display detection results:

    conda activate Face_Mask_Detector
    python demo.py

License

Face-Mask-Detector is licensed under GPLv3.

Copyright © 2021 by zhiyiYo.

About

A face mask detector based on STM32F103ZET6 and Yolov4.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages