0

How should I check whether this detected face existed in the face API storage, else add the detected face to the particular personId of the person group?

Example of List Persons in a Person Group (JSON format):

[{
  "personId": "1234",
  "persistedFaceIds": ["0987"],
  "name": "Mary",
  "userData": null
}, {
  "personId": "5678",
  "persistedFaceIds": ["6543", "2109"],
  "name": "John",
  "userData": null
}]

I tried to detect the face first then use verify. However, it only verifies the detected face id and the personId in the person group. Is there a way to verify between detected face id with each persistent face id reside in the personId, so the confidence score is 1? Else add the detected face to the person group based on the name.

bot_insane
  • 2,545
  • 18
  • 40
Milky
  • 73
  • 1
  • 4
  • 12
  • You can refer to following answer? https://stackoverflow.com/a/31926367/4222487 – FaizanHussainRabbani Feb 13 '18 at 07:10
  • looked at the link that you gave but i dont think i can use it. it does not apply in this issue as persistedfaceid contains each unique face landmarks and encrypted to bytes(?). – Milky Feb 13 '18 at 07:18

1 Answers1

0

I think you should have a look to the Find similar method of Face API. This method does the following:

Given query face's faceId, to search the similar-looking faces from a faceId array or a faceListId. faceId array contains the faces created by Face - Detect, which will expire 24 hours after creation. While "faceListId" is created by Face List - Create a Face List containing persistedFaceIds that will not expire. Depending on the input the returned similar faces list contains faceIds or persistedFaceIds ranked by similarity.

In your case I would do the following:

  • Use Detect method to find faces in the image
  • Use Identify method to find if the detected faces match someone from your person group
  • Then use Find similar: set the parameter faceId with the value of the "persistedFaceIds" from the person

With this last method you will get a result with the following format:

[
    {
        "persistedFaceId" : "015839fb-fbd9-4f79-ace9-7675fc2f1dd9",    
        "confidence" : 0.82
    },
    ...
]

So it will be easy to check if the confidence is 1 or less to know if you want to add the face to list of faces of the person.

Official documentation of Find Similar in API Management is available here

Nicolas R
  • 13,812
  • 2
  • 28
  • 57