BlazeFace : A Machine Learning Model for Fast Detection of Face Positions and Key Points
This is an introduction to「BlazeFace」, 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.
BlazeFace is a machine learning model developed by Google to rapidly detect the location and keypoints of faces.
BlazeFace: Sub-millisecond Neural Face Detection on Mobile GPUs
We present BlazeFace, a lightweight and well-performing face detector tailored for mobile GPU inference. It runs at a…
The position of the face and the keypoints of the face can be obtained simultaneously. There are six key points: eyes, nose, ears, and mouth. It is also possible to detect multiple people at the same time.
Originally the model was for MediaPipe provided by Google, but a version converted to Pytorch that ailia SDK can use is also provided in the repository below.
BlazeFace is a fast, light-weight face detector from Google Research. Read more, Paper on arXiv A pretrained model is…
BlazeFace is designed to perform very fast inference on mobile GPUs. Specifically, it runs nearly 2.3 times faster than MobileNetV2-SSD.
BlazeFace uses an improved network based on MobileNet. Given the fact that a 3x3 depthwise convolution of a 56x56x128 tensor takes 0.07ms on iPhoneX, while the subsequent 1x1 convolution from 128 to 128 channels is 4.3× slower at 0.3ms, it shows that increasing the kernel size of the depthwise part is relatively cheap. Therefore the authors propose to replace 3x3 depthwise convolution with 5x5 depthwise convolution, making the model shallower to speed up the process.
In addition, there is a fixed cost for dispatching a particular layer computation for shaders on GPUs. For example with MobileNetV1, out of 4.9 ms of inference time, only 3.9 ms are spent in actual GPU shader computation. In order to reduce this cost of dispatch for anchor computation, the authors adopted an alternative anchor scheme to reduce the number of layers.
To use BlazeFace with ailia SDK, use the following sample.
(Image from https://github.com/hollance/BlazeFace-PyTorch/blob/master/3faces.png) Ailia input shape: (1, 3, 128, 128)…
You can use the following command to run BlazeFace on the web camera video stream.
$ python3 blazeface.py -v 0
The command below can be used to run BlazeFace on an image.
$ python3 blazeface.py -i person.jpg