FaceListOperations Class
FaceListOperations 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.objectFaceListOperations
Constructor
FaceListOperations(client, config, serializer, deserializer)
Parameters
- client
Client for service requests.
- config
Configuration of service client.
- serializer
An object model serializer.
- deserializer
An object model deserializer.
Methods
add_face_from_stream |
Add a face to a specified face list, up to 1,000 faces.
|
add_face_from_url |
Add a face to a specified face list, up to 1,000 faces.
|
create |
Create an empty face list with user-specified faceListId, name, an
optional userData and recognitionModel. Up to 64 face lists are allowed
in one subscription.
|
delete |
Delete a specified face list. |
delete_face |
Delete a face from a face list by specified faceListId and
persistedFaceId.
|
get |
Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. . |
list |
List face lists’ faceListId, name, userData and recognitionModel. |
update |
Update information of a face list. |
add_face_from_stream
Add a face to a specified face list, up to 1,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
FaceList - Delete
Face
or FaceList -
Delete
is called.
Note persistedFaceId is different from faceId generated by [Face
Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl).
- Higher face image quality means better detection and 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 | Model | Recommended use-case(s) | | ---------- | -------- | | 'detection_01': | The default detection model for FaceList - Add Face. Recommend for near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong image orientation, the faces in such cases may not be detected. | | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry faces. >>|<<.
add_face_from_stream(face_list_id, image, user_data=None, target_face=None, detection_model='detection_01', custom_headers=None, raw=False, callback=None, **operation_config)
Parameters
- image
- <xref:Generator>
An image stream.
- user_data
- str
User-specified data about the face for any purpose. The maximum length is 1KB.
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.
- detection_model
- str or DetectionModel
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'
- callback
- <xref: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.
- operation_config
Operation configuration overrides.
Returns
PersistedFace or ClientRawResponse if raw=true
Return type
Exceptions
add_face_from_url
Add a face to a specified face list, up to 1,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
FaceList - Delete
Face
or FaceList -
Delete
is called.
Note persistedFaceId is different from faceId generated by [Face
Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl).
- Higher face image quality means better detection and 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 | Model | Recommended use-case(s) | | ---------- | -------- | | 'detection_01': | The default detection model for FaceList - Add Face. Recommend for near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong image orientation, the faces in such cases may not be detected. | | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry faces. >>|<<.
add_face_from_url(face_list_id, url, user_data=None, target_face=None, detection_model='detection_01', custom_headers=None, raw=False, **operation_config)
Parameters
- user_data
- str
User-specified data about the face for any purpose. The maximum length is 1KB.
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.
- detection_model
- str or DetectionModel
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'
- operation_config
Operation configuration overrides.
Returns
PersistedFace or ClientRawResponse if raw=true
Return type
Exceptions
create
Create an empty face list with user-specified faceListId, name, an
optional userData and recognitionModel. Up to 64 face lists are allowed
in one subscription.
Face list is a list of faces, up to 1,000 faces, and used by
Face - Find
Similar.
After creation, user should use FaceList - Add
Face
to import the faces. No image will be stored. Only the extracted face
features are stored on server until FaceList -
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.
Please consider
LargeFaceList
when the face number is large. It can support up to 1,000,000 faces.
'recognitionModel' should be specified to associate with this
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 face list will use the recognition model that's already
associated with the collection. Existing face features in a face list
can't be updated to features extracted by another version of
recognition model.
- 'recognition_01': The default recognition model for FaceList- Create. All those face lists created before 2019 March are bonded with this recognition model.
- 'recognition_02': Recognition model released in 2019 March.
- 'recognition_03': Recognition model released in 2020 May. 'recognition_03' is recommended since its overall accuracy is improved compared with 'recognition_01' and 'recognition_02'.
create(face_list_id, name=None, user_data=None, recognition_model='recognition_01', custom_headers=None, raw=False, **operation_config)
Parameters
- recognition_model
- str or RecognitionModel
Possible values include: 'recognition_01', 'recognition_02', 'recognition_03'
- operation_config
Operation configuration overrides.
Returns
None or ClientRawResponse if raw=true
Return type
Exceptions
delete
Delete a specified face list.
delete(face_list_id, custom_headers=None, raw=False, **operation_config)
Parameters
- operation_config
Operation configuration overrides.
Returns
None or ClientRawResponse if raw=true
Return type
Exceptions
delete_face
Delete a face from a face list by specified faceListId and
persistedFaceId.
Adding/deleting faces to/from a same face list are processed
sequentially and to/from different face lists are in parallel.
delete_face(face_list_id, persisted_face_id, custom_headers=None, raw=False, **operation_config)
Parameters
- operation_config
Operation configuration overrides.
Returns
None or ClientRawResponse if raw=true
Return type
Exceptions
get
Retrieve a face list’s faceListId, name, userData, recognitionModel and faces in the face list. .
get(face_list_id, return_recognition_model=False, custom_headers=None, raw=False, **operation_config)
Parameters
- return_recognition_model
- bool
A value indicating whether the operation should return 'recognitionModel' in response.
- operation_config
Operation configuration overrides.
Returns
FaceList or ClientRawResponse if raw=true
Return type
Exceptions
list
List face lists’ faceListId, name, userData and recognitionModel.
To get face information inside faceList use FaceList -
Get
.
list(return_recognition_model=False, custom_headers=None, raw=False, **operation_config)
Parameters
- return_recognition_model
- bool
A value indicating whether the operation should return 'recognitionModel' in response.
- operation_config
Operation configuration overrides.
Returns
list or ClientRawResponse if raw=true
Return type
Exceptions
update
Update information of a face list.
update(face_list_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config)
Parameters
- operation_config
Operation configuration overrides.
Returns
None or ClientRawResponse if raw=true
Return type
Exceptions
Attributes
models
models = <module 'azure.cognitiveservices.vision.face.models' from 'c:\\hostedtoolcache\\windows\\python\\3.6.8\\x64\\lib\\site-packages\\azure\\cognitiveservices\\vision\\face\\models\\__init__.py'>