LargeFaceListOperations Class

LargeFaceListOperations operations.

You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.

Inheritance
builtins.object
LargeFaceListOperations

Constructor

LargeFaceListOperations(client, config, serializer, deserializer)

Parameters

Name Description
client
Required

Client for service requests.

config
Required

Configuration of service client.

serializer
Required

An object model serializer.

deserializer
Required

An object model deserializer.

Methods

add_face_from_stream

Add a face to a specified large face list, up to 1,000,000 faces.
To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until LargeFaceList Face - Delete or LargeFaceList - Delete is called.
Note persistedFaceId is different from faceId generated by [Face

Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl).

  • Higher face image quality means better recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.
  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB.
  • "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from Face - Detect, there's no guarantee to detect and add the face successfully.
  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will cause failures.
  • Adding/deleting faces to/from a same face list are processed sequentially and to/from different face lists are in parallel.
  • The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.
  • Different 'detectionModel' values can be provided. To use and compare different detection models, please refer to How to specify a detection model. Quota:
  • Free-tier subscription quota: 1,000 faces per large face list.
  • S0-tier subscription quota: 1,000,000 faces per large face list.
add_face_from_url

Add a face to a specified large face list, up to 1,000,000 faces.
To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until LargeFaceList Face - Delete or LargeFaceList - Delete is called.
Note persistedFaceId is different from faceId generated by [Face

Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl).

  • Higher face image quality means better recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.
  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB.
  • "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from Face - Detect, there's no guarantee to detect and add the face successfully.
  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will cause failures.
  • Adding/deleting faces to/from a same face list are processed sequentially and to/from different face lists are in parallel.
  • The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.
  • Different 'detectionModel' values can be provided. To use and compare different detection models, please refer to How to specify a detection model Quota:
  • Free-tier subscription quota: 1,000 faces per large face list.
  • S0-tier subscription quota: 1,000,000 faces per large face list.
create

Create an empty large face list with user-specified largeFaceListId, name, an optional userData and recognitionModel.
Large face list is a list of faces, up to 1,000,000 faces, and used by Face - Find Similar.
After creation, user should use LargeFaceList Face - Add to import the faces and LargeFaceList - Train to make it ready for Face - Find Similar. No image will be stored. Only the extracted face features are stored on server until LargeFaceList - Delete is called.
Find Similar is used for scenario like finding celebrity-like faces, similar face filtering, or as a light way face identification. But if the actual use is to identify person, please use PersonGroup / LargePersonGroup and Face - Identify.
'recognitionModel' should be specified to associate with this large face list. The default value for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly specify the model you need in this parameter. New faces that are added to an existing large face list will use the recognition model that's already associated with the collection. Existing face features in a large face list can't be updated to features extracted by another version of recognition model. Please refer to Specify a recognition model. Large face list quota:

  • Free-tier subscription quota: 64 large face lists.
  • S0-tier subscription quota: 1,000,000 large face lists.
delete

Delete a specified large face list.

delete_face

Delete a face from a large face list by specified largeFaceListId and persistedFaceId.
Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face lists are in parallel.

get

Retrieve a large face list's largeFaceListId, name, userData and recognitionModel.

get_face

Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId).

get_training_status

Retrieve the training status of a large face list (completed or ongoing).

list

List large face lists' information of largeFaceListId, name, userData and recognitionModel.
To get face information inside largeFaceList use LargeFaceList Face - Get

  • Large face lists are stored in alphabetical order of largeFaceListId.
  • "start" parameter (string, optional) is a user-provided largeFaceListId value that returned entries have larger ids by string comparison. "start" set to empty to indicate return from the first item.
  • "top" parameter (int, optional) specifies the number of entries to return. A maximal of 1000 entries can be returned in one call. To fetch more, you can specify "start" with the last returned entry's Id of the current call.
    For example, total 5 large person lists: "list1", ..., "list5".
    "start=&top=" will return all 5 lists.
    "start=&top=2" will return "list1", "list2".
    "start=list2&top=3" will return "list3", "list4", "list5". .
list_faces

List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face).

train

Queue a large face list training task, the training task may not be started immediately.

update

Update information of a large face list.

update_face

Update a persisted face's userData field.

add_face_from_stream

Add a face to a specified large face list, up to 1,000,000 faces.
To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until LargeFaceList Face - Delete or LargeFaceList - Delete is called.
Note persistedFaceId is different from faceId generated by [Face

Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl).

  • Higher face image quality means better recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.
  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB.
  • "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from Face - Detect, there's no guarantee to detect and add the face successfully.
  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will cause failures.
  • Adding/deleting faces to/from a same face list are processed sequentially and to/from different face lists are in parallel.
  • The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.
  • Different 'detectionModel' values can be provided. To use and compare different detection models, please refer to How to specify a detection model. Quota:
  • Free-tier subscription quota: 1,000 faces per large face list.
  • S0-tier subscription quota: 1,000,000 faces per large face list.
add_face_from_stream(large_face_list_id, image, user_data=None, target_face=None, detection_model='detection_01', custom_headers=None, raw=False, callback=None, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

image
Required

An image stream.

user_data
str

User-specified data about the face for any purpose. The maximum length is 1KB.

default value: None
target_face

A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image.

default value: None
detection_model

Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. Possible values include: 'detection_01', 'detection_02', 'detection_03'

default value: detection_01
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
callback
Callable[<xref:Bytes>, <xref:response=None>]

When specified, will be called with each chunk of data that is streamed. The callback should take two arguments, the bytes of the current chunk of data and the response object. If the data is uploading, response will be None.

default value: None
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

PersistedFace or ClientRawResponse if raw=true

Exceptions

Type Description

add_face_from_url

Add a face to a specified large face list, up to 1,000,000 faces.
To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until LargeFaceList Face - Delete or LargeFaceList - Delete is called.
Note persistedFaceId is different from faceId generated by [Face

Detect](https://docs.microsoft.com/rest/api/faceapi/face/detectwithurl).

  • Higher face image quality means better recognition precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.
  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB.
  • "targetFace" rectangle should contain one face. Zero or multiple faces will be regarded as an error. If the provided "targetFace" rectangle is not returned from Face - Detect, there's no guarantee to detect and add the face successfully.
  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or large occlusions will cause failures.
  • Adding/deleting faces to/from a same face list are processed sequentially and to/from different face lists are in parallel.
  • The minimum detectable face size is 36x36 pixels in an image no larger than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.
  • Different 'detectionModel' values can be provided. To use and compare different detection models, please refer to How to specify a detection model Quota:
  • Free-tier subscription quota: 1,000 faces per large face list.
  • S0-tier subscription quota: 1,000,000 faces per large face list.
add_face_from_url(large_face_list_id, url, user_data=None, target_face=None, detection_model='detection_01', custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

url
Required
str

Publicly reachable URL of an image

user_data
str

User-specified data about the face for any purpose. The maximum length is 1KB.

default value: None
target_face

A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image.

default value: None
detection_model

Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. Possible values include: 'detection_01', 'detection_02', 'detection_03'

default value: detection_01
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

PersistedFace or ClientRawResponse if raw=true

Exceptions

Type Description

create

Create an empty large face list with user-specified largeFaceListId, name, an optional userData and recognitionModel.
Large face list is a list of faces, up to 1,000,000 faces, and used by Face - Find Similar.
After creation, user should use LargeFaceList Face - Add to import the faces and LargeFaceList - Train to make it ready for Face - Find Similar. No image will be stored. Only the extracted face features are stored on server until LargeFaceList - Delete is called.
Find Similar is used for scenario like finding celebrity-like faces, similar face filtering, or as a light way face identification. But if the actual use is to identify person, please use PersonGroup / LargePersonGroup and Face - Identify.
'recognitionModel' should be specified to associate with this large face list. The default value for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly specify the model you need in this parameter. New faces that are added to an existing large face list will use the recognition model that's already associated with the collection. Existing face features in a large face list can't be updated to features extracted by another version of recognition model. Please refer to Specify a recognition model. Large face list quota:

  • Free-tier subscription quota: 64 large face lists.
  • S0-tier subscription quota: 1,000,000 large face lists.
create(large_face_list_id, name, user_data=None, recognition_model='recognition_01', custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

name
Required
str

User defined name, maximum length is 128.

user_data
str

User specified data. Length should not exceed 16KB.

default value: None
recognition_model

Possible values include: 'recognition_01', 'recognition_02', 'recognition_03', 'recognition_04'

default value: recognition_01
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

delete

Delete a specified large face list.

delete(large_face_list_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

delete_face

Delete a face from a large face list by specified largeFaceListId and persistedFaceId.
Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face lists are in parallel.

delete_face(large_face_list_id, persisted_face_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

persisted_face_id
Required
str

Id referencing a particular persistedFaceId of an existing face.

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

get

Retrieve a large face list's largeFaceListId, name, userData and recognitionModel.

get(large_face_list_id, return_recognition_model=False, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

return_recognition_model

A value indicating whether the operation should return 'recognitionModel' in response.

default value: False
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

LargeFaceList or ClientRawResponse if raw=true

Exceptions

Type Description

get_face

Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId).

get_face(large_face_list_id, persisted_face_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

persisted_face_id
Required
str

Id referencing a particular persistedFaceId of an existing face.

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

PersistedFace or ClientRawResponse if raw=true

Exceptions

Type Description

get_training_status

Retrieve the training status of a large face list (completed or ongoing).

get_training_status(large_face_list_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

TrainingStatus or ClientRawResponse if raw=true

Exceptions

Type Description

list

List large face lists' information of largeFaceListId, name, userData and recognitionModel.
To get face information inside largeFaceList use LargeFaceList Face - Get

  • Large face lists are stored in alphabetical order of largeFaceListId.
  • "start" parameter (string, optional) is a user-provided largeFaceListId value that returned entries have larger ids by string comparison. "start" set to empty to indicate return from the first item.
  • "top" parameter (int, optional) specifies the number of entries to return. A maximal of 1000 entries can be returned in one call. To fetch more, you can specify "start" with the last returned entry's Id of the current call.
    For example, total 5 large person lists: "list1", ..., "list5".
    "start=&top=" will return all 5 lists.
    "start=&top=2" will return "list1", "list2".
    "start=list2&top=3" will return "list3", "list4", "list5". .
list(return_recognition_model=False, start=None, top=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
return_recognition_model

A value indicating whether the operation should return 'recognitionModel' in response.

default value: False
start
str

Starting large face list id to return (used to list a range of large face lists).

default value: None
top
int

Number of large face lists to return starting with the large face list id indicated by the 'start' parameter.

default value: None
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

list or ClientRawResponse if raw=true

Exceptions

Type Description

list_faces

List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face).

list_faces(large_face_list_id, start=None, top=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

start
str

Starting face id to return (used to list a range of faces).

default value: None
top
int

Number of faces to return starting with the face id indicated by the 'start' parameter.

default value: None
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
<xref:msrest.pipeline.ClientRawResponse>

list or ClientRawResponse if raw=true

Exceptions

Type Description

train

Queue a large face list training task, the training task may not be started immediately.

train(large_face_list_id, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

update

Update information of a large face list.

update(large_face_list_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

name
str

User defined name, maximum length is 128.

default value: None
user_data
str

User specified data. Length should not exceed 16KB.

default value: None
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

update_face

Update a persisted face's userData field.

update_face(large_face_list_id, persisted_face_id, user_data=None, custom_headers=None, raw=False, **operation_config)

Parameters

Name Description
large_face_list_id
Required
str

Id referencing a particular large face list.

persisted_face_id
Required
str

Id referencing a particular persistedFaceId of an existing face.

user_data
str

User-provided data attached to the face. The size limit is 1KB.

default value: None
custom_headers

headers that will be added to the request

default value: None
raw

returns the direct response alongside the deserialized response

default value: False
operation_config
Required

Operation configuration overrides.

Returns

Type Description
None,
<xref:msrest.pipeline.ClientRawResponse>

None or ClientRawResponse if raw=true

Exceptions

Type Description

Attributes

models

models = <module 'azure.cognitiveservices.vision.face.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\cognitiveservices\\vision\\face\\models\\__init__.py'>