• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Rakuten RapidAPI Blog

The World's Largest API Marketplace

  • Enterprise
    • Product
    • eBooks
    • Contact Us
  • Marketplace
    • Product
    • Sign Up
    • Docs
  • Resources
    • API Blog
    • API Tutorial
    • Developer Showcase
  • EnglishEnglish
    • 日本語日本語
You are here: Home / API Tutorial / Inferdo Face Detection API Tutorial

Inferdo Face Detection API Tutorial

January 17, 2020 By Shyam Purkayastha Leave a Comment

With the advancements in the field of computer vision, face recognition, face detection and facial feature analysis are exciting upcoming areas of work. In this tutorial we will look at the features of Inferdo Face Detection API.

In recent times, this technology has received much flak for breaching the privacy of people in public places. However, with regulations in place, it has great potential and opens up a new arena of data gathering and analytics.

Here at Rakuten RapidAPI, we host a lot of APIs that perform complex image analysis jobs under the hood to extract facial features. The Inferdo Face Detection API is one such API for finding the faces in an image. It is integrated with Rakuten RapidAPI so you can log on to your Rakuten RapidAPI account to check out the API Console.

Inferdo Face Detection API

In case you don’t have an account on Rakuten Rapid API, sign up now and get your universal API key to access the Inferdo Face Detection API and thousands of other APIs hosted on Rakuten RapidAPI.

Connect to API

Table of Contents

  • 1 Three Important Use Cases of Face Detection
    • 1.1 1. Security
    • 1.2 2. Demographic Data Collection
    • 1.3 3. Analytics
  • 2 Overview
    • 2.1 API Endpoint: POST Face Detection w/ Age & Gender
    • 2.2 API Endpoint: POST Face Detection
    • 2.3 API Pricing
  • 3 Getting Started
  • 4 Build Your Own Demographic Analytics Application
    • 4.1 Share this:

Three Important Use Cases of Face Detection

Historically, computers have been good at data gathering that involve numbers and numerical data. Recording ordinal data or performing subjective analysis was beyond the scope until the field of artificial intelligence came into the fore. The ability to detect faces and facial features have opened up some exciting avenues.

1. Security

Face Detection for Security Icon

Modern security systems employ a host of sophisticated facial detection features. Use cases range from detecting intruders in no thoroughfare zones to preventing access to unknown persons. Their primary technique is to monitor the camera feed to look for any object that resembles a human face.

2. Demographic Data Collection

Face Recognition for Demographic Analysis Icon

With face detection, you can now get a fair idea about the customer demographics visiting your retail store. Thanks to advancements in facial feature detection, it is now possible to detect the gender and age of a person in an image.

3. Analytics

Facial Recognition for Gender Identification

With the capability of detecting demographic data based on faces, we can now perform analytics for retail stores. Facial feature recognition can sense the feeling of a person based on their facial expressions. Possible use cases of this feature is to measure the effectiveness of students in a classroom or the audience in a session.

Overview

Face detection involves a very complex and intricate analysis of an image that is based on neural network processing and deep learning. The accuracy and speed of detection also requires a lot of training. Thankfully, the complexities of the detection algorithms are neatly wrapped up behind the API so that you do not worry about that.

Head over to the API console of Inferdo Face Detection API and you can see what it has to offer.

Inferdo Face Detection API Console

This API offers two endpoints

API Endpoint: POST Face Detection w/ Age & Gender

The “Face Detection w/ Age & Gender” Endpoint accepts the input image as an URL and retrieves the location of faces in an image. It also predicts the gender and age of the detected faces.

The location of the face is returned as a bounding box representing by the top-left and bottom-right pixel coordinates of the rectangle enclosing the face. The age is returned based on a range.  It also returns a probability score of detection for  face location and gender.

API Endpoint: POST Face Detection

The “Face Detection” endpoint only returns the bounding boxes of the faces found in an input image.  It also accepts the image as a URL.

API Pricing

Check out the pricing tab in API console for more details.

The Inferdo Face Detection API is offered under the freemium model. Go ahead and subscribe to the BASIC subscription plan to get 5000 API calls free, per month.

Getting Started

We will now take this API for a test drive. Let’s try the “Face Detection w/ Age & Gender” endpoint with the default parameters.

 Face Detection w Request

Connect to API

This endpoint accepts a single parameter ‘Face Detection Request’. It has a JSON format.

{     
  "url":"https://inferdo.com/img/face-3.jpg",
  "accuracy_boost": 3 
}

The ‘url’ key holds the public URL of the image. The ‘accuracy_boost’ is used to request a higher accuracy of detection from the API. It accepts a numeric value ranging from 1 to 4, with 1 being the fastest and least accurate result and 4 being the most accurate result but has the slowest response.

Triggering this API endpoint will return the response as follows.

{
  "detected_faces":[2 items
    0:{3 items
      "BoundingBox":{5 items
        "startX":433
        "startY":151
        "endX":524
        "endY":260
        "Probability":98.78144264221191
      }
      "Gender":{2 items
        "Gender":"female"
        "Probability":89.94999527931213
      }
      "Age":{1 item
        "Age-Range":{2 items
          "Low":22
          "High":26
        }
      }
    }
    1:{3 items
      "BoundingBox":{5 items
        "startX":262
        "startY":103
        "endX":358
        "endY":217
        "Probability":97.15789556503296
      }
      "Gender":{2 items
        "Gender":"male"
        "Probability":71.12294435501099
      }
      "Age":{1 item
        "Age-Range":{2 items
          "Low":30
          "High":42
        }
      }
    }
  ]
}

You can see that the response contains two faces with their bounding boxes, gender and age ranges. The API also predicts that one face of a female, aged between 22 to 26 years and the other one is of a male, aged between 30 to 42.  You can verify this from the actual image by opening the image URL on another browser tab.

Face Detection Random Image for Testing the Endpoint #1

Perfect! The API did a good job. However it could not detect the third person in the image whose face is hidden, but that’s ok given the capability of the API.

Let’s try this endpoint with a random image from the internet.

Connect to API

Face Recognition Test Image

The URL of this image is https://www.fivesensesspaandsalon.com/blog/wp-content/uploads/2020/01/five-senses.png

Running this image through the API returns the response as follows.

{
  “detected_faces”:[2 items
    0:{3 items
      “BoundingBox”:{5 items
        “startX”:52
        “startY”:0
        “endX”:215
        “endY”:275
        “Probability”:99.09657835960388
      }
      “Gender”:{2 items
        “Gender”:”female”
        “Probability”:82.78703093528748
      }
      “Age”:{1 item
        “Age-Range”:{2 items
          “Low”:24
          “High”:30
        }
      }
    }
    1:{3 items
      “BoundingBox”:{5 items
        “startX”:173
        “startY”:74
        “endX”:395
        “endY”:330
        “Probability”:95.97751498222351
      }
      “Gender”:{2 items
        “Gender”:”female”
        “Probability”:72.14275598526001
      }
      “Age”:{1 item
        “Age-Range”:{2 items
          “Low”:26
          “High”:35
        }
      }
    }
  ]

 

As expected, this image returns two faces, both females. The Age range is  debatable as it is too broad, but you can try with different values of ‘accuracy_boost’ to see if you get a better result.

Similarly, you can also try the  “Face Detection” endpoint if you are only interested in the presence of faces without age and gender information.  In that case the API response will only return the bounding boxes of the faces in the image.

{
  “detected_faces”:[2 items
    0:{2 items
      “BoundingBox”:{4 items
        “startX”:52
        “startY”:0
        “endX”:215
        “endY”:275
      }
      “Probability”:99.09657835960388
    }
    1:{2 items
      “BoundingBox”:{4 items
        “startX”:173
        “startY”:74
        “endX”:395
        “endY”:330
      }
      “Probability”:95.97751498222351
    }
  ]
}

 

Build Your Own Demographic Analytics Application

Now that you know how to use this API, pick one of the use cases that we have listed above and think of a possible application. How about building a retail analytics tool that tells you the gender attraction for a new product on display? A camera feed capturing the customers visiting the display unit can capture the faces and detect the gender. The gender data collected from around the display unit over a few days helps the retail stores to plan the product’s placement in shelves that are laid out for gender specific merchandise.

Connect to API

You get the point. This is just one of the many interesting applications that you can build with this API.

 Inferdo Face Detection API is one of the many face recognition and face detection API’s out there. Take a look at our APIs in the Visual Recognition category.  You can also check out our Machine Learning API Collection to know more about the APIs that support broader ML applications.

We will be back soon with yet another interesting API tutorial to fuel your ideas.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Reddit (Opens in new window)

Filed Under: API Tutorial

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Accelerate tech modernization

To compete in the digital age, Rakuten RapidAPI helps enterprises deploy scalable and flexible IT systems to allow for ongoing experimentation and iteration at speed.

Learn More
Try Rakuten RapidAPI for free
  • Enterprise
  • Marketplace
  • Resources
  • EnglishEnglish

© 2022 Rakuten RapidAPI. All rights reserved.