fbpx

Integrate Face Detection in Your Application

This blog post was originally published at Xailient’s website. It is reprinted here with the permission of Xailient.

Don’t be overwhelmed, because adding face detection to your applications has never been so easy!

A lot of the times, face detection is not the primary focus of the application but is an important component and many developers are just overwhelmed with the idea of adding face detection to their applications.

If the application is to count the number of people entering and leaving a shop, developers need to detect faces of in order to count people. In such a case, they definitely do not want to re-invent the wheel and build their own face detector (unless you have a huge budget and development time and a machine learning team of course). Instead, they want to get a face detector that is already available in the market and integrate it into their application and keep moving forward focusing on the goals of their application.

Imagine if every instant messaging platform like Facebook Messenger, WhatsApp and Viber were to reinvent TCP/IP, how many of the messaging platforms would even exist today.

So let’s take a look at some of the face detectors you can choose from today so that you can easily integrate it into your application, reducing your development time, enabling you to deliver to your customers faster.

Microsoft Azure Face API

Face API is one of the cognitive services provided by Microsoft Azure. It can be used to detect faces either locally on-premises using client SDK or in the cloud using REST API. Client SDKs for Face API is available for .NET, Python, Java, Node.js. Go, and iOS.

Here is a code snippet of using the Face API Python Client SDK for face detection:

Below are the output of running the above Microsoft Azure Face API using the Python SDK for face detection code on some facial images:

From the above output images, we can observe that all front facing faces are detected and some side profile faces are detected, whereas some are missed with Microsoft Azure Face API.

For more details on Azure Face API, please refer to the documentation.

Amazon Rekognition

Amazon Rekognition can detect faces in images and videos. When face image or video is provided, it gives information on where the face is located. Amazon Rekognition performs face detection in the cloud and provides SDKs in Java, Python, .NET, Ruby and Node.js to encapsulate the implementation and make it easier for developers to use it easily.

Here is a sample code for using Amazon Rekognition for face detection using the Python SDK:

Below are the output of running the above Amazon Rekognition using the Python SDK for face detection code on some facial images:

From the above results, we can see that all faces, front-facing as well as side profile faces are detected with Amazon Rekognition.

For more details on Amazon Rekognition, please refer to the documentation.

Xailient FaceSDK

Xailient’s FaceSDK is the World’s Fastest Face Detector. Face detection takes place on the device itself and is optimized for use on edge devices like the Raspberry Pi. Xailient’s Face SDK is available for ARM 32, ARM 64 and x86_64 devices.

When you download the FaceSDK, it comes with sample codes and test images for you can see it running without much effort.

Here is a sample code for face detection using Xailient Python Face SDK:

Below are the outputs of Xailient FaceSDK on same input facial images:

We can observe that all the front-facing faces and most of the side profile faces are detected using Xailient FaceSDK.

For more information on Xailient FaceSDK, please refer to the website.

Google Cloud Vision API

Google’s Cloud Vision API has a face detection feature as well. Similar to Amazon Rekognition, it provides client SDK for using face detection for different languages including C#, Go, Java, Node.js, Python PHP and Ruby.

Below is a sample code for face detection using Google Cloud Vision API Python SDK:

Below are the output of running the above Google Cloud Vision API Python SDK face detection code on some facial images:

We can observe that most of the front-facing faces and side profile faces are detected using Google’s Cloud Vision API.

For more information on Google’s Cloud Vision API for face detection, please refer to the documentation.


In this post, we looked at some of the face detectors: Microsoft Azure FaceAPI, Amazon Rekognition, Xailient FaceSDK and Google Cloud Vision API, with sample code in Python and output images of running them on some facial images. While Amazon Rekognition showed best results in the sample input images, all four of the face detectors performed equally good. The images were processed for face detection on the cloud with Microsoft Azure FaceAPI, Amazon Rekognition and Google Cloud Vision API whereas images were processed locally (on-device) with Xailient SDK. All four of them were easy to use, Xailient SDK being the easiest as it required the least amount of code to run face detection.

What application are you building using Face Detection? Which Face Detector are you using? Leave your thoughts at our website.


More stories:

Xailient is commercializing breakthrough university research in Artificial Intelligence and Machine Learning. Our technology dramatically reduces the costs of data transmission, storage, and computation associated with extracting useful information from real-time video by processing the way humans think.

www.xailient.com


Sabina Pokhrel
Customer Success AI Engineer, Xailient

Here you’ll find a wealth of practical technical insights and expert advice to help you bring AI and visual intelligence into your products without flying blind.

Contact

Address

1646 N. California Blvd.,
Suite 360
Walnut Creek, CA 94596 USA

Phone
Phone: +1 (925) 954-1411
Scroll to Top