How to use Face Detection API with JavaScript in 5 minutes?

How to use Face Detection API with JavaScript in 5 minutes?

·

3 min read

In this tutorial, you will learn how to use Face Detection API in 5 minutes using JavaScript. Eden AI provides an easy and developer-friendly API that allows you to detect faces in images.

What is Face Detection API?

Face Detection API result on Eden AI

A face detection API is a software interface that allows developers to access and use a pre-built model for detecting faces in images. These APIs typically allow developers to send an image to the API, and the API will return the location and bounding box of any faces found in the image. These APIs can be used in a variety of applications such as security systems, image editing software, and social media platforms.

Getting Started with Face Detection API using JavaScript

The first step to getting started with Face Detection is to set Axios, a promise-based HTTP client for the browser and Node.js, that will allow you to call Eden AI API.

Next, you'll need to initialize the File System module in order to access local files on your computer.

Finally, you'll need to create your multipart/formdata parameters form:

How to use Face Detection API with JavaScript

1. Get a Face Detection API Key on Eden AI

To perform Face Detection, you will need to create an account on Eden AI for free. Then, you will be able to get your API key directly from the homepage with free credits offered by Eden AI.

Eden AI platform - Get your API key

Get your API key for FREE

2. Let’s Detect Faces in your images

Now that you have initialized the required JavaScript module and got your API key, you will be able to detect faces in images. With Eden AI, you can choose from a wide rang of different engines you want for Face Detection. You can access Face Detection providers available on Eden AI on our documentation here.

Here is the JavaScript code to add the form data parameters values for your request:

For example, we called two different Face Detection engines. Once the parameters values are passed, you can configure your request:

Then, you just need to launch the request and print the result:

Here is an example of a Face Detection API response:

Benefits of using Face Detection API with Eden AI

Using Face Detection with Eden AI API is quick and easy.

Multiple AI engines in one API

Save time and cost

We offer a unified API for all providers: simple and standard to use, with a quick switch between providers and an access to the specific features of each provider.

Easy to integrate

The JSON output format is the same for all suppliers thanks to Eden AI's standardisation work. The response elements are also standardised thanks to Eden AI's powerful matching algorithms.

Customization

With Eden AI you have the possibility to integrate a third party platform: we can quickly develop connectors. To go further and customize your Face Detection request with specific parameters, check out our documentation.

Create your Account on Eden AI