Search code examples
c#azure-cognitive-servicesface-recognitionface-api

Find match face from the list of faces in local storage using Azure Face API


I am reading the documents and API from Azure page but I am still not sure if my though it correct here.

Scenario

We have around 1M ID photos in our local storage. Each ID contain only one single person.

We would like to implement the basic validation when taking the ID photo .. the small app will then using the Azure Face API to look through those 1M ID photos that we have and return the matched photo or return if we have the same person in our ID storage or not.

To do the above, I believe we need to write the software to do things below

  1. Upload all the photos into Azure
  2. Create Large FaceList?
  3. Train the model
  4. Then we can do the face identify or face similar

Are the steps above correct?

If I use the method above that mean I need to use 'face storage' for persisted face Id right?

1.Is there a way to avoid cost of face storage this? As it will cost a lot to keep 1M images

  1. When I do verify how many transactions will it be counted? Is it counted as 1?

I am thinking about using Container Cognitive as well so it can run locally and using the storage on the local instead.

Will that help me in saving the face storage cost? As when I run container the storage should not need to be paid. I will only need to pay for transaction fee such as detect, verify.

I am welcome any comments pretty new in this field please guide me.


Solution

  • Your work flow is overall correct:

    • Create a Large Person Group
    • Add each photo ID as a person to the group with a face (this is two API calls: Create Person + Add Person Face)
    • Train the Person Group (and check for training status from time to time because it will be long)
    • Use Identify for search

    The only thing you should consider is the architecture of your Large Person Group. Using a single monolithic LPG for 1M persons will be a killer when you need to add/delete/update the group. Training time for each change will be very long. One strategy (for adding new persons) would be to add a "transaction" LPG - a smaller LPG that includes all hourly/daily/weekly (whatever works for you) additions so that you can quickly train changes. You'll run your search (identify) on both the "main" and the "transaction" LPGs and then once in while "commit" the transactions into the main LPG. see here in the Face API docs

    To your other questions:

    • Can't avoid storage costs for the derived face data
    • Each API call is a transaction: Create LPG, Create Person, Add Person Face, Train, Get Train Status, etc
    • I don't have experience with the Cognitive Container feature but I believe pricing is exactly the same for API calls.