How to Detect Age from an Image in Python

Age detection is one of the many useful tools that have been developed as a result of Deep Learning technology; these algorithms are an excellent method to gather demographic information to use in marketing campaigns. However, training an AI with Deep Learning can be a complex and cumbersome task — to evade this process, we will be demonstrating how you can use an API in Python to identify the age, position, and size of human faces in an image.

First, run this command to install the API client:

pip install cloudmersive-image-api-client

Next, you can call the function with the following code:

from __future__ import print_function
import time
import cloudmersive_image_api_client
from cloudmersive_image_api_client.rest import ApiException
from pprint import pprint

This simple operation will return the information previously mentioned, as well as an age confidence score to let you know how accurate the age identification is.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.