1:N face search

Updated at:

The Alibaba Cloud Visual Intelligence API provides Artificial Intelligence (AI) services for face and body recognition. Most of its APIs can be used individually. The 1:N face search API, however, requires a combination of multiple API calls. This document explains how to use these APIs together to perform a face search.

Development process

Cross-video face matching workflow

This workflow matches faces detected in different videos against existing entities in the face database and assigns them to the corresponding person.

  1. Create a face database: Call the CreateFaceDb operation to create a database for storing face data. Each Alibaba Cloud account can create up to 10 face databases, and each database supports up to 50,000 face images.

  2. Create a person entity: Call the AddFaceEntity operation to create an entity (EntityId) for each known person. The AddFace operation requires EntityId as a mandatory parameter, so this step must be completed before adding face data.

  3. Add face data: Call the AddFace operation to add faces detected in video frames to the database under the corresponding entity. The operation returns a FaceId and an image quality score (QualityScore). A low quality score may cause the face to fail matching.

  4. Search for matches: Call the SearchFace operation to search for a new face image against the database. The operation returns the best-matching EntityId and a confidence level (Confidence). Use the result to assign the face to the corresponding person.

Calling sequence: CreateFaceDbAddFaceEntityAddFaceSearchFace. Step 2 is a mandatory prerequisite. Skipping it causes the AddFace call to fail.

Code development

  1. Create a face database. For details, see Create a face database sample code.

  2. Add a face sample. For details, see Add a face sample sample code.

  3. Add face data. For details, see Add face data sample code.

  4. Search for a face. For details, see Face search sample code.

FAQ

How is this product billed?

For the 1:N face search feature, only calls to the SearchFace API are billed. The other APIs are free to call. For more information, see Billing.