Let's see the process that you will need to implement.
In the documentation here it says;
Face APIs cover the following categories:
...
- FaceList: Used to manage a FaceList for Find Similar.
- (Large)PersonGroup: Used to manage a (Large)PersonGroup dataset for Identification.
- (Large)PersonGroup Person: Used to manage (Large)PersonGroup Person Faces for Identification.
In your case, it looks like you want to identify faces so you will use PersonGroup with PersonGroup Person items inside.
Step 1 - Generate your list of known faces
Details
So first you need to store your known faces in a group (called PersonGroup or LargePersonGroup given the number of items you have to store), in order to query these items with the image uploaded by your user. It will persist the items, there is no "24hour limit" with those groups.
If you want to understand the differences between "normal" and "large-scale" groups, see reference here: there are some differences that you must consider, in particular regarding the training process.
So let's use a normal PersonGroup, not large. Please note that the amount of items depend on your subscription:
- Free-tier subscription quota: 1,000 person groups. Each holds up to 1,000 persons.
- S0-tier subscription quota: 1,000,000 person groups. Each holds up to 10,000 persons.
Actions
Please also note that here I'm pointing to the API operations but all these actions can be performed in any language with those API calls, but also directly with the provided SDK for some languages (see list here)
- Create a PersonGroup with
PersonGroup - Create operation. You will specify a personGroupId in your request, that you will use below
Then for each person of your known faces:
Create a Person with PersonGroup Person - Create operation, giving the previous personGroupId in the request. You will got a personId guid value as a result, like "25985303-c537-4467-b41d-bdb45cd95ca1"
Add Faces of this user to its newly created Person by calling PersonGroup Person - Add Face operation and providing personGroupId, personId, additional optional information in the request and your image url in the body.
Note that for this operation:
Valid image size is from 1KB to 4MB. Only one face is allowed per
image.
Finally, once you have added your persons with their faces:
- Call
PersonGroup - Train operation
- Check the training status with
PersonGroup - Get Training Status operation
Then you are ready to identify people based on this group!
Step 2 - Search this FaceId inside your known faces
Easy, just 2 actions here:
Call Face - Detect operation to find faces inside your image. The result will be an array of item containing faceId and other attributes
If you have detected faces, call Face - Identify operation with the following parameters:
faceId, which is the value from the detect operation
personGroupId: the Id of the group you have created during step 1
confidenceThreshold: your confidence threshold, like 0.8
maxNumOfCandidatesReturned: Number of candidates returned (between 1 and 100, default is 10)
Request sample:
{
"personGroupId": "sample_group",
"faceIds": [
"c5c24a82-6845-4031-9d5d-978df9175426",
"65d083d4-9447-47d1-af30-b626144bf0fb"
],
"maxNumOfCandidatesReturned": 1,
"confidenceThreshold": 0.8
}
Other questions
Face Storage cost is 16.53/m for 1000 images, does it means that
Face-Detect API will store in Azure Blob storage? If yes and still
faceId will be deleted after 24 hours ?
Face-Detect API is not storing the image. The storage cost is about using PersonGroup or FaceLists
Face Storage - Stores images sized up to 4 MB each - whereas
Face-Detect says, can store up to 6 MB
As said, storage is about persisting faces like when you use PersonGroup Person - Add Face, where the limit is 4MB, not 6