Curious Banda
Curious Banda

Reputation: 11

Add Multiple Faces to one person -Microsoft Cognitive Face API

The Documentation contains the code for adding one face to a person but How to Identify Faces?? shows multiple images adding option to one person.. The below code to add one face to a person is:

import httplib, urllib, base64

headers = {
    # Request headers
    'Content-Type': 'application/json',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.urlencode({
    # Request parameters
    'userData': '{string}',
    'targetFace': '{string}',
})

try:
    conn = httplib.HTTPSConnection('westus.api.cognitive.microsoft.com')
    conn.request("POST", "/face/v1.0/persongroups/{personGroupId}/persons/{personId}/persistedFaces?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

If it is possible to add more than one faces to a single person then could you please let me know how or where the documentation talks about it??

Upvotes: 0

Views: 391

Answers (1)

Harish
Harish

Reputation: 337

Yes you can add more than one face for a person. Here is good documentation which will help you out: Adding Faces for a person

Upvotes: 0

Related Questions