ailia Tech BLOG

FaceMaskDetection : A Machine Learning Model to Determine if a Person is Wearing a Mask

This is an introduction to「FaceMaskDetection」, a machine learning model that can be used with ailia SDK. You can easily use this model to create AI applications using ailia SDK as well as many other ready-to-use ailia MODELS.


Overview

Conventional face detection algorithms are trained from unmasked images, so the accuracy of detecting the face position decreases when a mask is worn.

FaceMaskDetection is able to detect the position of a face with high accuracy even when a mask is worn, and at the same time determine whether the face is wearing a mask or not.

Input image(Source:https://pixabay.com/ja/photos/%E3%83%95%E3%82%A7%E3%83%AA%E3%83%BC-%E8%88%B9-%E4%B9%97%E5%AE%A2-%E3%82%AF%E3%83%AB%E3%83%BC%E3%82%BA-5484417/

Result

Architecture

FaceMaskDetection architecture uses YOLOv3 Tiny and MobilenetSSD, the model has been trained at ailia Inc. In addition to normal face images, we added images of masked faces to the learning process to determine whether a person is wearing a mask or not.

Usage

You can see how to use FaceMaskDetection with the sample code below.

ailia-ai/ailia-models(Images from…github.com

The following command can be used to determine whether or not a mask is worn or not to any image. By default, yolov3-tiny is used.

$ python3 face-mask-detection.py -i input.png -s output.png

The following command runs the model on the web camera video stream.

$ python3 face-mask-detection.py -v 0

Add the parameter -a mb2-ssd to run the model using mobilenet-ssd.

$ python3 face-mask-detection.py -v 0 -a mb2-ssd

ailia Inc. has developed ailia SDK, which enables cross-platform, GPU-based rapid inference.

ailia Inc. provides a wide range of services from consulting and model creation, to the development of AI-based applications and SDKs. Feel free to contact us for any inquiry.