Skip to content

raburgos/Face_mask

Repository files navigation

Face_mask

Face Mask - Object Detection

This repository it´s about Object Detection using YOLOv3 and tiny yolov3, with custom training data to detect if people is using mask or not (also I trained class label 'semi-mask'; in this case isn´t work well due to lack of images in the initial training process).

Special thanks and references

Setting up everything!

  1. Git clone this repository

  2. Download YOLOv3 weights here and place the file in "yolo" folder. Also if you want tiny yolo model you can download weights here and place the file in "tiny_yolo" folder.

  3. If you have Anaconda distribution in your machine you can create virtual environment, in order to not have problems with any library dependencies (you can directly use this excellent tutorial https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/) or use next steps:

    1. Go to Anaconda prompt in your machine: step1
    2. Create virtual environment using "conda create -n env_name python=3.7" step2
    3. Then you have to activate your virtual environment (in this case I create face_mask env). Command: conda activate env_name. step3
    4. Now you can install opencv (version 4.1.0.25) using pip install opencv-contrib-python==4.1.0.25. This will install opencv library and all necessary dependencies (like numpy) as well. Opencv is responsable to make predictions using YOLO weights and cfg (trained using Darknet framework) step4
    5. Now you can change directory to the path where you git clone this repository. step5
  4. User your webcam to give a try (you can use yolov3 or tiny yolo as well!) step7
    Result:
    demo

  5. You can make predictions over images. Example: python prediction_image.py -y yolov3 -p 1.JPG. step10 After '-y' you have to specify model (yolov3 or tiny). After '-p' you have to specify path to the image, in this case we use image 1.JPG.
    Result: predicion_image_example

Releases

No releases published

Packages

No packages published

Languages