diff --git a/azure-cognitiveservices-vision-face/HISTORY.rst b/azure-cognitiveservices-vision-face/HISTORY.rst index 6ed746f80937..697dc9b2b478 100644 --- a/azure-cognitiveservices-vision-face/HISTORY.rst +++ b/azure-cognitiveservices-vision-face/HISTORY.rst @@ -3,6 +3,36 @@ Release History =============== +0.3.0 (2019-03-28) +++++++++++++++++++ + +**Features** + +- Model PersonGroup has a new parameter recognition_model +- Model FaceList has a new parameter recognition_model +- Model LargePersonGroup has a new parameter recognition_model +- Model LargeFaceList has a new parameter recognition_model +- Model DetectedFace has a new parameter recognition_model + +**Breaking changes** + +- Operation FaceListOperations.create has a new signature +- Operation FaceListOperations.get has a new signature +- Operation FaceOperations.detect_with_stream has a new signature +- Operation FaceOperations.detect_with_stream has a new signature +- Operation FaceOperations.detect_with_url has a new signature +- Operation FaceOperations.detect_with_url has a new signature +- Operation LargeFaceListOperations.create has a new signature +- Operation LargeFaceListOperations.get has a new signature +- Operation LargePersonGroupOperations.create has a new signature +- Operation LargePersonGroupOperations.get has a new signature +- Operation LargePersonGroupOperations.list has a new signature +- Operation PersonGroupOperations.create has a new signature +- Operation PersonGroupOperations.get has a new signature +- Operation PersonGroupOperations.list has a new signature +- Operation FaceListOperations.list has a new signature +- Operation LargeFaceListOperations.list has a new signature + 0.2.0 (2019-03-07) ++++++++++++++++++ diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/__init__.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/__init__.py index b9ef2356545d..39c2758f7e00 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/__init__.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/__init__.py @@ -47,6 +47,7 @@ from .update_face_request_py3 import UpdateFaceRequest from .training_status_py3 import TrainingStatus from .name_and_user_data_contract_py3 import NameAndUserDataContract + from .meta_data_contract_py3 import MetaDataContract from .apply_snapshot_request_py3 import ApplySnapshotRequest from .snapshot_py3 import Snapshot from .take_snapshot_request_py3 import TakeSnapshotRequest @@ -91,6 +92,7 @@ from .update_face_request import UpdateFaceRequest from .training_status import TrainingStatus from .name_and_user_data_contract import NameAndUserDataContract + from .meta_data_contract import MetaDataContract from .apply_snapshot_request import ApplySnapshotRequest from .snapshot import Snapshot from .take_snapshot_request import TakeSnapshotRequest @@ -98,6 +100,7 @@ from .operation_status import OperationStatus from .image_url import ImageUrl from .face_client_enums import ( + RecognitionModel, Gender, GlassesType, HairColorType, @@ -151,12 +154,14 @@ 'UpdateFaceRequest', 'TrainingStatus', 'NameAndUserDataContract', + 'MetaDataContract', 'ApplySnapshotRequest', 'Snapshot', 'TakeSnapshotRequest', 'UpdateSnapshotRequest', 'OperationStatus', 'ImageUrl', + 'RecognitionModel', 'Gender', 'GlassesType', 'HairColorType', diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/detected_face.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/detected_face.py index 1902cba2492a..04778024ae05 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/detected_face.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/detected_face.py @@ -19,6 +19,10 @@ class DetectedFace(Model): :param face_id: :type face_id: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param face_rectangle: Required. :type face_rectangle: ~azure.cognitiveservices.vision.face.models.FaceRectangle @@ -36,6 +40,7 @@ class DetectedFace(Model): _attribute_map = { 'face_id': {'key': 'faceId', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'face_rectangle': {'key': 'faceRectangle', 'type': 'FaceRectangle'}, 'face_landmarks': {'key': 'faceLandmarks', 'type': 'FaceLandmarks'}, 'face_attributes': {'key': 'faceAttributes', 'type': 'FaceAttributes'}, @@ -44,6 +49,7 @@ class DetectedFace(Model): def __init__(self, **kwargs): super(DetectedFace, self).__init__(**kwargs) self.face_id = kwargs.get('face_id', None) + self.recognition_model = kwargs.get('recognition_model', "recognition_01") self.face_rectangle = kwargs.get('face_rectangle', None) self.face_landmarks = kwargs.get('face_landmarks', None) self.face_attributes = kwargs.get('face_attributes', None) diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/detected_face_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/detected_face_py3.py index ebb54646574c..964c0602f91c 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/detected_face_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/detected_face_py3.py @@ -19,6 +19,10 @@ class DetectedFace(Model): :param face_id: :type face_id: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param face_rectangle: Required. :type face_rectangle: ~azure.cognitiveservices.vision.face.models.FaceRectangle @@ -36,14 +40,16 @@ class DetectedFace(Model): _attribute_map = { 'face_id': {'key': 'faceId', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'face_rectangle': {'key': 'faceRectangle', 'type': 'FaceRectangle'}, 'face_landmarks': {'key': 'faceLandmarks', 'type': 'FaceLandmarks'}, 'face_attributes': {'key': 'faceAttributes', 'type': 'FaceAttributes'}, } - def __init__(self, *, face_rectangle, face_id: str=None, face_landmarks=None, face_attributes=None, **kwargs) -> None: + def __init__(self, *, face_rectangle, face_id: str=None, recognition_model="recognition_01", face_landmarks=None, face_attributes=None, **kwargs) -> None: super(DetectedFace, self).__init__(**kwargs) self.face_id = face_id + self.recognition_model = recognition_model self.face_rectangle = face_rectangle self.face_landmarks = face_landmarks self.face_attributes = face_attributes diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_client_enums.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_client_enums.py index 06f07dab573e..6eb661a0b2c3 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_client_enums.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_client_enums.py @@ -12,6 +12,12 @@ from enum import Enum +class RecognitionModel(str, Enum): + + recognition_01 = "recognition_01" + recognition_02 = "recognition_02" + + class Gender(str, Enum): male = "male" diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_list.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_list.py index 2ca0b350d9b5..55e87974b4fb 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_list.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_list.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .name_and_user_data_contract import NameAndUserDataContract +from .meta_data_contract import MetaDataContract -class FaceList(NameAndUserDataContract): +class FaceList(MetaDataContract): """Face list object. All required parameters must be populated in order to send to Azure. @@ -21,6 +21,10 @@ class FaceList(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param face_list_id: Required. FaceListId of the target face list. :type face_list_id: str :param persisted_faces: Persisted faces within the face list. @@ -37,6 +41,7 @@ class FaceList(NameAndUserDataContract): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'face_list_id': {'key': 'faceListId', 'type': 'str'}, 'persisted_faces': {'key': 'persistedFaces', 'type': '[PersistedFace]'}, } diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_list_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_list_py3.py index b0c2a5587a31..5a36c8042dfb 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_list_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/face_list_py3.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .name_and_user_data_contract_py3 import NameAndUserDataContract +from .meta_data_contract_py3 import MetaDataContract -class FaceList(NameAndUserDataContract): +class FaceList(MetaDataContract): """Face list object. All required parameters must be populated in order to send to Azure. @@ -21,6 +21,10 @@ class FaceList(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param face_list_id: Required. FaceListId of the target face list. :type face_list_id: str :param persisted_faces: Persisted faces within the face list. @@ -37,11 +41,12 @@ class FaceList(NameAndUserDataContract): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'face_list_id': {'key': 'faceListId', 'type': 'str'}, 'persisted_faces': {'key': 'persistedFaces', 'type': '[PersistedFace]'}, } - def __init__(self, *, face_list_id: str, name: str=None, user_data: str=None, persisted_faces=None, **kwargs) -> None: - super(FaceList, self).__init__(name=name, user_data=user_data, **kwargs) + def __init__(self, *, face_list_id: str, name: str=None, user_data: str=None, recognition_model="recognition_01", persisted_faces=None, **kwargs) -> None: + super(FaceList, self).__init__(name=name, user_data=user_data, recognition_model=recognition_model, **kwargs) self.face_list_id = face_list_id self.persisted_faces = persisted_faces diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list.py index f6a6d5525543..787f6ab05318 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .name_and_user_data_contract import NameAndUserDataContract +from .meta_data_contract import MetaDataContract -class LargeFaceList(NameAndUserDataContract): +class LargeFaceList(MetaDataContract): """Large face list object. All required parameters must be populated in order to send to Azure. @@ -21,6 +21,10 @@ class LargeFaceList(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param large_face_list_id: Required. LargeFaceListId of the target large face list. :type large_face_list_id: str @@ -35,6 +39,7 @@ class LargeFaceList(NameAndUserDataContract): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'large_face_list_id': {'key': 'largeFaceListId', 'type': 'str'}, } diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list_py3.py index 4a05214af516..fd8dc16ece21 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list_py3.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .name_and_user_data_contract_py3 import NameAndUserDataContract +from .meta_data_contract_py3 import MetaDataContract -class LargeFaceList(NameAndUserDataContract): +class LargeFaceList(MetaDataContract): """Large face list object. All required parameters must be populated in order to send to Azure. @@ -21,6 +21,10 @@ class LargeFaceList(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param large_face_list_id: Required. LargeFaceListId of the target large face list. :type large_face_list_id: str @@ -35,9 +39,10 @@ class LargeFaceList(NameAndUserDataContract): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'large_face_list_id': {'key': 'largeFaceListId', 'type': 'str'}, } - def __init__(self, *, large_face_list_id: str, name: str=None, user_data: str=None, **kwargs) -> None: - super(LargeFaceList, self).__init__(name=name, user_data=user_data, **kwargs) + def __init__(self, *, large_face_list_id: str, name: str=None, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: + super(LargeFaceList, self).__init__(name=name, user_data=user_data, recognition_model=recognition_model, **kwargs) self.large_face_list_id = large_face_list_id diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group.py index f65f661b5057..91320af31be6 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .name_and_user_data_contract import NameAndUserDataContract +from .meta_data_contract import MetaDataContract -class LargePersonGroup(NameAndUserDataContract): +class LargePersonGroup(MetaDataContract): """Large person group object. All required parameters must be populated in order to send to Azure. @@ -21,6 +21,10 @@ class LargePersonGroup(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param large_person_group_id: Required. LargePersonGroupId of the target large person groups :type large_person_group_id: str @@ -35,6 +39,7 @@ class LargePersonGroup(NameAndUserDataContract): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'large_person_group_id': {'key': 'largePersonGroupId', 'type': 'str'}, } diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group_py3.py index f28979ee5cfe..d6de0c20da85 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group_py3.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .name_and_user_data_contract_py3 import NameAndUserDataContract +from .meta_data_contract_py3 import MetaDataContract -class LargePersonGroup(NameAndUserDataContract): +class LargePersonGroup(MetaDataContract): """Large person group object. All required parameters must be populated in order to send to Azure. @@ -21,6 +21,10 @@ class LargePersonGroup(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param large_person_group_id: Required. LargePersonGroupId of the target large person groups :type large_person_group_id: str @@ -35,9 +39,10 @@ class LargePersonGroup(NameAndUserDataContract): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'large_person_group_id': {'key': 'largePersonGroupId', 'type': 'str'}, } - def __init__(self, *, large_person_group_id: str, name: str=None, user_data: str=None, **kwargs) -> None: - super(LargePersonGroup, self).__init__(name=name, user_data=user_data, **kwargs) + def __init__(self, *, large_person_group_id: str, name: str=None, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: + super(LargePersonGroup, self).__init__(name=name, user_data=user_data, recognition_model=recognition_model, **kwargs) self.large_person_group_id = large_person_group_id diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/meta_data_contract.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/meta_data_contract.py new file mode 100644 index 000000000000..e227cd4a15b5 --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/meta_data_contract.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .name_and_user_data_contract import NameAndUserDataContract + + +class MetaDataContract(NameAndUserDataContract): + """A combination of user defined name and user specified data and recognition + model name for largePersonGroup/personGroup, and largeFaceList/faceList. + + :param name: User defined name, maximum length is 128. + :type name: str + :param user_data: User specified data. Length should not exceed 16KB. + :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel + """ + + _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetaDataContract, self).__init__(**kwargs) + self.recognition_model = kwargs.get('recognition_model', "recognition_01") diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/meta_data_contract_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/meta_data_contract_py3.py new file mode 100644 index 000000000000..5a6f3de5332f --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/meta_data_contract_py3.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from .name_and_user_data_contract_py3 import NameAndUserDataContract + + +class MetaDataContract(NameAndUserDataContract): + """A combination of user defined name and user specified data and recognition + model name for largePersonGroup/personGroup, and largeFaceList/faceList. + + :param name: User defined name, maximum length is 128. + :type name: str + :param user_data: User specified data. Length should not exceed 16KB. + :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel + """ + + _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: + super(MetaDataContract, self).__init__(name=name, user_data=user_data, **kwargs) + self.recognition_model = recognition_model diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/person_group.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/person_group.py index 9e4eab234771..385c943bddbf 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/person_group.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/person_group.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .name_and_user_data_contract import NameAndUserDataContract +from .meta_data_contract import MetaDataContract -class PersonGroup(NameAndUserDataContract): +class PersonGroup(MetaDataContract): """Person group object. All required parameters must be populated in order to send to Azure. @@ -21,6 +21,10 @@ class PersonGroup(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param person_group_id: Required. PersonGroupId of the target person group. :type person_group_id: str @@ -35,6 +39,7 @@ class PersonGroup(NameAndUserDataContract): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'person_group_id': {'key': 'personGroupId', 'type': 'str'}, } diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/person_group_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/person_group_py3.py index c1fc341ed83b..8ae811b81594 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/person_group_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/person_group_py3.py @@ -9,10 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .name_and_user_data_contract_py3 import NameAndUserDataContract +from .meta_data_contract_py3 import MetaDataContract -class PersonGroup(NameAndUserDataContract): +class PersonGroup(MetaDataContract): """Person group object. All required parameters must be populated in order to send to Azure. @@ -21,6 +21,10 @@ class PersonGroup(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02'. Default value: "recognition_01" . + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param person_group_id: Required. PersonGroupId of the target person group. :type person_group_id: str @@ -35,9 +39,10 @@ class PersonGroup(NameAndUserDataContract): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, + 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, 'person_group_id': {'key': 'personGroupId', 'type': 'str'}, } - def __init__(self, *, person_group_id: str, name: str=None, user_data: str=None, **kwargs) -> None: - super(PersonGroup, self).__init__(name=name, user_data=user_data, **kwargs) + def __init__(self, *, person_group_id: str, name: str=None, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: + super(PersonGroup, self).__init__(name=name, user_data=user_data, recognition_model=recognition_model, **kwargs) self.person_group_id = person_group_id diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_list_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_list_operations.py index 1eb71f8d47aa..0b6ea19ef268 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_list_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_list_operations.py @@ -34,9 +34,37 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def create( - self, face_list_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config): - """Create an empty face list. Up to 64 face lists are allowed to exist in - one subscription. + self, face_list_id, name=None, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): + """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](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). +
After creation, user should use [FaceList - Add + Face](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395250) + to import the faces. Faces are stored on server until [FaceList - + Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524f) + 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](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244) + / + [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d) + and [Face - + Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). +
Please consider + [LargeFaceList](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc) + 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. + . :param face_list_id: Id referencing a particular face list. :type face_list_id: str @@ -44,6 +72,10 @@ def create( :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02' + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -54,7 +86,7 @@ def create( :raises: :class:`APIErrorException` """ - body = models.NameAndUserDataContract(name=name, user_data=user_data) + body = models.MetaDataContract(name=name, user_data=user_data, recognition_model=recognition_model) # Construct URL url = self.create.metadata['url'] @@ -74,7 +106,7 @@ def create( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body, 'NameAndUserDataContract') + body_content = self._serialize.body(body, 'MetaDataContract') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -89,11 +121,16 @@ def create( create.metadata = {'url': '/facelists/{faceListId}'} def get( - self, face_list_id, custom_headers=None, raw=False, **operation_config): - """Retrieve a face list's information. + self, face_list_id, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + """Retrieve a face list’s faceListId, name, userData, recognitionModel and + faces in the face list. + . :param face_list_id: Id referencing a particular face list. :type face_list_id: str + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -115,6 +152,8 @@ def get( # Construct parameters query_parameters = {} + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} @@ -241,10 +280,16 @@ def delete( delete.metadata = {'url': '/facelists/{faceListId}'} def list( - self, custom_headers=None, raw=False, **operation_config): - """Retrieve information about all existing face lists. Only faceListId, - name and userData will be returned. - + self, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + """List face lists’ faceListId, name, userData and recognitionModel.
+ To get face information inside faceList use [FaceList - + Get](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524c) + . + + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -265,6 +310,8 @@ def list( # Construct parameters query_parameters = {} + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_operations.py index dbfcb58a59de..256859ed8b56 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_operations.py @@ -35,8 +35,31 @@ def __init__(self, client, config, serializer, deserializer): def find_similar( self, face_id, face_list_id=None, large_face_list_id=None, face_ids=None, max_num_of_candidates_returned=20, mode="matchPerson", custom_headers=None, raw=False, **operation_config): - """Given query face's faceId, find the similar-looking faces from a faceId - array, a face list or a large face list. + """Given query face's faceId, to search the similar-looking faces from a + faceId array, a face list or a large face list. faceId array contains + the faces created by [Face - + Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), + which will expire 24 hours after creation. A "faceListId" is created by + [FaceList - + Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b) + containing persistedFaceIds that will not expire. And a + "largeFaceListId" is created by [LargeFaceList - + Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc) + containing persistedFaceIds that will also not expire. Depending on the + input the returned similar faces list contains faceIds or + persistedFaceIds ranked by similarity. +
Find similar has two working modes, "matchPerson" and "matchFace". + "matchPerson" is the default mode that it tries to find faces of the + same person as possible by using internal same-person thresholds. It is + useful to find a known person's other photos. Note that an empty list + will be returned if no faces pass the internal thresholds. "matchFace" + mode ignores same-person thresholds and returns ranked similar faces + anyway, even the similarity is low. It can be used in the cases like + searching celebrity-looking faces. +
The 'recognitionModel' associated with the query face's faceId + should be the same as the 'recognitionModel' used by the target faceId + array, face list or large face list. + . :param face_id: FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not @@ -121,7 +144,22 @@ def find_similar( def group( self, face_ids, custom_headers=None, raw=False, **operation_config): - """Divide candidate faces into groups based on face similarity. + """Divide candidate faces into groups based on face similarity.
+ * The output is one or more disjointed face groups and a messyGroup. A + face group contains faces that have similar looking, often of the same + person. Face groups are ranked by group size, i.e. number of faces. + Notice that faces belonging to a same person might be split into + several groups in the result. + * MessyGroup is a special face group containing faces that cannot find + any similar counterpart face from original faces. The messyGroup will + not appear in the result if all faces found their counterparts. + * Group API needs at least 2 candidate faces and 1000 at most. We + suggest to try [Face - + Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a) + when you only have 2 candidate faces. + * The 'recognitionModel' associated with the query faces' faceIds + should be the same. + . :param face_ids: Array of candidate faceId created by Face - Detect. The maximum is 1000 faces @@ -182,6 +220,36 @@ def identify( self, face_ids, person_group_id=None, large_person_group_id=None, max_num_of_candidates_returned=1, confidence_threshold=None, custom_headers=None, raw=False, **operation_config): """1-to-many identification to find the closest matches of the specific query person face from a person group or large person group. +
For each face in the faceIds array, Face Identify will compute + similarities between the query face and all the faces in the person + group (given by personGroupId) or large person group (given by + largePersonGroupId), and return candidate person(s) for that face + ranked by similarity confidence. The person group/large person group + should be trained to make it ready for identification. See more in + [PersonGroup - + Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249) + and [LargePersonGroup - + Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4). +
+ Remarks:
+ * The algorithm allows more than one face to be identified + independently at the same request, but no more than 10 faces. + * Each person in the person group/large person group could have more + than one face, but no more than 248 faces. + * Higher face image quality means better identification precision. + Please consider high-quality faces: frontal, clear, and face size is + 200x200 pixels (100 pixels between eyes) or bigger. + * Number of candidates returned is restricted by + maxNumOfCandidatesReturned and confidenceThreshold. If no person is + identified, the returned candidates will be an empty array. + * Try [Face - Find + Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237) + when you need to find similar faces from a face list/large face list + instead of a person group/large person group. + * The 'recognitionModel' associated with the query faces' faceIds + should be the same as the 'recognitionModel' used by the target person + group or large person group. + . :param face_ids: Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid @@ -260,6 +328,17 @@ def verify_face_to_face( self, face_id1, face_id2, custom_headers=None, raw=False, **operation_config): """Verify whether two faces belong to a same person or whether one face belongs to a person. +
+ Remarks:
+ * Higher face image quality means better identification precision. + Please consider high-quality faces: frontal, clear, and face size is + 200x200 pixels (100 pixels between eyes) or bigger. + * For the scenarios that are sensitive to accuracy please make your own + judgment. + * The 'recognitionModel' associated with the query faces' faceIds + should be the same as the 'recognitionModel' used by the target face, + person group or large person group. + . :param face_id1: FaceId of the first face, comes from Face - Detect :type face_id1: str @@ -318,9 +397,49 @@ def verify_face_to_face( verify_face_to_face.metadata = {'url': '/verify'} def detect_with_url( - self, url, return_face_id=True, return_face_landmarks=False, return_face_attributes=None, custom_headers=None, raw=False, **operation_config): - """Detect human faces in an image and returns face locations, and - optionally with faceIds, landmarks, and attributes. + self, url, return_face_id=True, return_face_landmarks=False, return_face_attributes=None, recognition_model="recognition_01", return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + """Detect human faces in an image, return face rectangles, and optionally + with faceIds, landmarks, and attributes.
+ * Optional parameters including faceId, landmarks, and attributes. + Attributes include age, gender, headPose, smile, facialHair, glasses, + emotion, hair, makeup, occlusion, accessories, blur, exposure and + noise. + * The extracted face feature, instead of the actual image, will be + stored on server. The faceId is an identifier of the face feature and + will be used in [Face - + Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239), + [Face - + Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a), + and [Face - Find + Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). + It will expire 24 hours after the detection call. + * 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. + * Faces are detectable when its size is 36x36 to 4096x4096 pixels. If + need to detect very small but clear faces, please try to enlarge the + input image. + * Up to 64 faces can be returned for an image. Faces are ranked by face + rectangle size from large to small. + * Face detector prefer frontal and near-frontal faces. There are cases + that faces may not be detected, e.g. exceptionally large face angles + (head-pose) or being occluded, or wrong image orientation. + * Attributes (age, gender, headPose, smile, facialHair, glasses, + emotion, hair, makeup, occlusion, accessories, blur, exposure and + noise) may not be perfectly accurate. HeadPose's pitch value is a + reserved field and will always return 0. + * Different 'recognitionModel' values are provided. If follow-up + operations like Verify, Identify, Find Similar are needed, please + specify the recognition model with 'recognitionModel' parameter. The + default value for 'recognitionModel' is 'recognition_01', if latest + model needed, please explicitly specify the model you need in this + parameter. Once specified, the detected faceIds will be associated with + the specified recognition model. More details, please refer to [How to + specify a recognition + model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-recognition-model) + . :param url: Publicly reachable URL of an image :type url: str @@ -338,6 +457,19 @@ def detect_with_url( time cost. :type return_face_attributes: list[str or ~azure.cognitiveservices.vision.face.models.FaceAttributeType] + :param recognition_model: Name of recognition model. Recognition model + is used when the face features are extracted and associated with + detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition + model name can be provided when performing Face - Detect or + (Large)FaceList - Create or (Large)PersonGroup - Create. The default + value is 'recognition_01', if latest model needed, please explicitly + specify the model you need. Possible values include: 'recognition_01', + 'recognition_02' + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -366,6 +498,10 @@ def detect_with_url( query_parameters['returnFaceLandmarks'] = self._serialize.query("return_face_landmarks", return_face_landmarks, 'bool') if return_face_attributes is not None: query_parameters['returnFaceAttributes'] = self._serialize.query("return_face_attributes", return_face_attributes, '[FaceAttributeType]', div=',') + if recognition_model is not None: + query_parameters['recognitionModel'] = self._serialize.query("recognition_model", recognition_model, 'str') + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} @@ -470,7 +606,7 @@ def verify_face_to_person( verify_face_to_person.metadata = {'url': '/verify'} def detect_with_stream( - self, image, return_face_id=True, return_face_landmarks=False, return_face_attributes=None, custom_headers=None, raw=False, callback=None, **operation_config): + self, image, return_face_id=True, return_face_landmarks=False, return_face_attributes=None, recognition_model="recognition_01", return_recognition_model=False, custom_headers=None, raw=False, callback=None, **operation_config): """Detect human faces in an image and returns face locations, and optionally with faceIds, landmarks, and attributes. @@ -490,6 +626,19 @@ def detect_with_stream( time cost. :type return_face_attributes: list[str or ~azure.cognitiveservices.vision.face.models.FaceAttributeType] + :param recognition_model: Name of recognition model. Recognition model + is used when the face features are extracted and associated with + detected faceIds, (Large)FaceList or (Large)PersonGroup. A recognition + model name can be provided when performing Face - Detect or + (Large)FaceList - Create or (Large)PersonGroup - Create. The default + value is 'recognition_01', if latest model needed, please explicitly + specify the model you need. Possible values include: 'recognition_01', + 'recognition_02' + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -521,6 +670,10 @@ def detect_with_stream( query_parameters['returnFaceLandmarks'] = self._serialize.query("return_face_landmarks", return_face_landmarks, 'bool') if return_face_attributes is not None: query_parameters['returnFaceAttributes'] = self._serialize.query("return_face_attributes", return_face_attributes, '[FaceAttributeType]', div=',') + if recognition_model is not None: + query_parameters['recognitionModel'] = self._serialize.query("recognition_model", recognition_model, 'str') + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_operations.py index b7bc26f9ad2f..9099cb2149a5 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_operations.py @@ -34,9 +34,42 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def create( - self, large_face_list_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config): - """Create an empty large face list. Up to 64 large face lists are allowed - to exist in one subscription. + self, large_face_list_id, name=None, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): + """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](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). +
After creation, user should use [LargeFaceList Face - + Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3) + to import the faces and [LargeFaceList - + Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1) + to make it ready for [Face - + FindSimilar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). + Faces are stored on server until [LargeFaceList - + Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) + 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](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244) + / + [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d) + and [Face - + Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). +
+ * Free-tier subscription quota: 64 large face lists. + * S0-tier subscription quota: 1,000,000 large face lists. +
+ '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. + . :param large_face_list_id: Id referencing a particular large face list. @@ -45,6 +78,10 @@ def create( :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02' + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -55,7 +92,7 @@ def create( :raises: :class:`APIErrorException` """ - body = models.NameAndUserDataContract(name=name, user_data=user_data) + body = models.MetaDataContract(name=name, user_data=user_data, recognition_model=recognition_model) # Construct URL url = self.create.metadata['url'] @@ -75,7 +112,7 @@ def create( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body, 'NameAndUserDataContract') + body_content = self._serialize.body(body, 'MetaDataContract') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -90,12 +127,16 @@ def create( create.metadata = {'url': '/largefacelists/{largeFaceListId}'} def get( - self, large_face_list_id, custom_headers=None, raw=False, **operation_config): - """Retrieve a large face list's information. + self, large_face_list_id, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + """Retrieve a large face list’s largeFaceListId, name, userData and + recognitionModel. :param large_face_list_id: Id referencing a particular large face list. :type large_face_list_id: str + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -117,6 +158,8 @@ def get( # Construct parameters query_parameters = {} + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} @@ -300,10 +343,31 @@ def get_training_status( get_training_status.metadata = {'url': '/largefacelists/{largeFaceListId}/training'} def list( - self, custom_headers=None, raw=False, **operation_config): - """Retrieve information about all existing large face lists. Only - largeFaceListId, name and userData will be returned. - + self, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + """List large face lists’ information of largeFaceListId, name, userData + and recognitionModel.
+ To get face information inside largeFaceList use [LargeFaceList Face - + Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)
+ * 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". + . + + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -325,6 +389,8 @@ def list( # Construct parameters query_parameters = {} + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_operations.py index 3e4bbf03c220..f8b56685f2ae 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_operations.py @@ -34,9 +34,37 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def create( - self, large_person_group_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config): - """Create a new large person group with specified largePersonGroupId, name - and user-provided userData. + self, large_person_group_id, name=None, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): + """Create a new large person group with user-specified largePersonGroupId, + name, an optional userData and recognitionModel. +
A large person group is the container of the uploaded person + data, including face images and face recognition feature, and up to + 1,000,000 people. +
After creation, use [LargePersonGroup Person - + Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40) + to add person into the group, and call [LargePersonGroup - + Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4) + to get this group ready for [Face - + Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). +
The person face, image, and userData will be stored on server + until [LargePersonGroup Person - + Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2) + or [LargePersonGroup - + Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f) + is called. +
+ * Free-tier subscription quota: 1,000 large person groups. + * S0-tier subscription quota: 1,000,000 large person groups. +
+ 'recognitionModel' should be specified to associate with this large + person group. 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 person group will use the recognition model that's + already associated with the collection. Existing face features in a + large person group can't be updated to features extracted by another + version of recognition model. + . :param large_person_group_id: Id referencing a particular large person group. @@ -45,6 +73,10 @@ def create( :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02' + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -55,7 +87,7 @@ def create( :raises: :class:`APIErrorException` """ - body = models.NameAndUserDataContract(name=name, user_data=user_data) + body = models.MetaDataContract(name=name, user_data=user_data, recognition_model=recognition_model) # Construct URL url = self.create.metadata['url'] @@ -75,7 +107,7 @@ def create( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body, 'NameAndUserDataContract') + body_content = self._serialize.body(body, 'MetaDataContract') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -136,13 +168,20 @@ def delete( delete.metadata = {'url': '/largepersongroups/{largePersonGroupId}'} def get( - self, large_person_group_id, custom_headers=None, raw=False, **operation_config): - """Retrieve the information of a large person group, including its name - and userData. + self, large_person_group_id, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + """Retrieve the information of a large person group, including its name, + userData and recognitionModel. This API returns large person group + information only, use [LargePersonGroup Person - + List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1) + instead to retrieve person information under the large person group. + . :param large_person_group_id: Id referencing a particular large person group. :type large_person_group_id: str + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -164,6 +203,8 @@ def get( # Construct parameters query_parameters = {} + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} @@ -302,14 +343,34 @@ def get_training_status( get_training_status.metadata = {'url': '/largepersongroups/{largePersonGroupId}/training'} def list( - self, start=None, top=1000, custom_headers=None, raw=False, **operation_config): - """List large person groups and their information. + self, start=None, top=1000, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + """List all existing large person groups’ largePersonGroupId, name, + userData and recognitionModel.
+ * Large person groups are stored in alphabetical order of + largePersonGroupId. + * "start" parameter (string, optional) is a user-provided + largePersonGroupId 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 groups: "group1", ..., "group5". +
"start=&top=" will return all 5 groups. +
"start=&top=2" will return "group1", "group2". +
"start=group2&top=3" will return "group3", "group4", "group5". + . :param start: List large person groups from the least largePersonGroupId greater than the "start". :type start: str :param top: The number of large person groups to list. :type top: int + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -335,6 +396,8 @@ def list( query_parameters['start'] = self._serialize.query("start", start, 'str', max_length=64) if top is not None: query_parameters['top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_operations.py index aa609082f5de..bb150011911e 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_operations.py @@ -34,9 +34,40 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def create( - self, person_group_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config): - """Create a new person group with specified personGroupId, name and - user-provided userData. + self, person_group_id, name=None, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): + """Create a new person group with specified personGroupId, name, + user-provided userData and recognitionModel. +
A person group is the container of the uploaded person data, + including face images and face recognition features. +
After creation, use [PersonGroup Person - + Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523c) + to add persons into the group, and then call [PersonGroup - + Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249) + to get this group ready for [Face - + Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). +
The person's face, image, and userData will be stored on server + until [PersonGroup Person - + Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523d) + or [PersonGroup - + Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395245) + is called. +
+ * Free-tier subscription quota: 1,000 person groups. Each holds up to + 1,000 persons. + * S0-tier subscription quota: 1,000,000 person groups. Each holds up to + 10,000 persons. + * to handle larger scale face identification problem, please consider + using + [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d). +
+ 'recognitionModel' should be specified to associate with this person + group. 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 person group + will use the recognition model that's already associated with the + collection. Existing face features in a person group can't be updated + to features extracted by another version of recognition model. + . :param person_group_id: Id referencing a particular person group. :type person_group_id: str @@ -44,6 +75,10 @@ def create( :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str + :param recognition_model: Possible values include: 'recognition_01', + 'recognition_02' + :type recognition_model: str or + ~azure.cognitiveservices.vision.face.models.RecognitionModel :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -54,7 +89,7 @@ def create( :raises: :class:`APIErrorException` """ - body = models.NameAndUserDataContract(name=name, user_data=user_data) + body = models.MetaDataContract(name=name, user_data=user_data, recognition_model=recognition_model) # Construct URL url = self.create.metadata['url'] @@ -74,7 +109,7 @@ def create( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body, 'NameAndUserDataContract') + body_content = self._serialize.body(body, 'MetaDataContract') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -134,12 +169,16 @@ def delete( delete.metadata = {'url': '/persongroups/{personGroupId}'} def get( - self, person_group_id, custom_headers=None, raw=False, **operation_config): - """Retrieve the information of a person group, including its name and - userData. + self, person_group_id, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + """Retrieve person group name, userData and recognitionModel. To get + person information under this personGroup, use [PersonGroup Person - + List](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395241). :param person_group_id: Id referencing a particular person group. :type person_group_id: str + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -161,6 +200,8 @@ def get( # Construct parameters query_parameters = {} + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} @@ -296,14 +337,32 @@ def get_training_status( get_training_status.metadata = {'url': '/persongroups/{personGroupId}/training'} def list( - self, start=None, top=1000, custom_headers=None, raw=False, **operation_config): - """List person groups and their information. + self, start=None, top=1000, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + """List person groups’ personGroupId, name, userData and + recognitionModel.
+ * Person groups are stored in alphabetical order of personGroupId. + * "start" parameter (string, optional) is a user-provided personGroupId + 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 person groups: "group1", ..., "group5". +
"start=&top=" will return all 5 groups. +
"start=&top=2" will return "group1", "group2". +
"start=group2&top=3" will return "group3", "group4", "group5". + . :param start: List person groups from the least personGroupId greater than the "start". :type start: str :param top: The number of person groups to list. :type top: int + :param return_recognition_model: A value indicating whether the + operation should return 'recognitionModel' in response. + :type return_recognition_model: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -328,6 +387,8 @@ def list( query_parameters['start'] = self._serialize.query("start", start, 'str', max_length=64) if top is not None: query_parameters['top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + if return_recognition_model is not None: + query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') # Construct headers header_parameters = {} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/version.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/version.py index 9bd1dfac7ecb..fcb88654af0a 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/version.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/version.py @@ -9,5 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.2.0" - +VERSION = "0.3.0" diff --git a/azure-cognitiveservices-vision-face/tests/recordings/test_face_detect.yaml b/azure-cognitiveservices-vision-face/tests/recordings/test_face_detect.yaml index 3cd925f7b8c6..042103845148 100644 --- a/azure-cognitiveservices-vision-face/tests/recordings/test_face_detect.yaml +++ b/azure-cognitiveservices-vision-face/tests/recordings/test_face_detect.yaml @@ -266,18 +266,19 @@ interactions: Connection: [keep-alive] Content-Type: [application/octet-stream] Transfer-Encoding: [chunked] - User-Agent: [python/3.6.3 (Windows-10-10.0.15063-SP0) requests/2.18.4 msrest/0.4.17 - faceapi/1.0] + User-Agent: [python/3.7.0 (Windows-10-10.0.17134-SP0) requests/2.19.1 msrest/0.5.4 + azure-cognitiveservices-vision-face/0.3.0] + X-BingApis-SDK-Client: [Python-SDK] method: POST - uri: https://westus2.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age%2Cgender%2CheadPose%2Csmile%2CfacialHair%2Cglasses%2Cemotion%2Chair%2Cmakeup%2Cocclusion%2Caccessories%2Cblur%2Cexposure%2Cnoise + uri: https://westus2.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age%2Cgender%2CheadPose%2Csmile%2CfacialHair%2Cglasses%2Cemotion%2Chair%2Cmakeup%2Cocclusion%2Caccessories%2Cblur%2Cexposure%2Cnoise&recognitionModel=recognition_01&returnRecognitionModel=false response: - body: {string: '[{"faceId":"7636c821-f976-4aac-8374-0bcfeaafe139","faceRectangle":{"top":84,"left":31,"width":97,"height":97},"faceAttributes":{"smile":1.0,"headPose":{"pitch":0.0,"roll":-0.7,"yaw":-2.4},"gender":"female","age":52.4,"facialHair":{"moustache":0.0,"beard":0.0,"sideburns":0.0},"glasses":"NoGlasses","emotion":{"anger":0.0,"contempt":0.0,"disgust":0.0,"fear":0.0,"happiness":1.0,"neutral":0.0,"sadness":0.0,"surprise":0.0},"blur":{"blurLevel":"low","value":0.0},"exposure":{"exposureLevel":"goodExposure","value":0.72},"noise":{"noiseLevel":"low","value":0.03},"makeup":{"eyeMakeup":true,"lipMakeup":true},"accessories":[],"occlusion":{"foreheadOccluded":false,"eyeOccluded":false,"mouthOccluded":false},"hair":{"bald":0.04,"invisible":false,"hairColor":[{"color":"blond","confidence":1.0},{"color":"gray","confidence":0.47},{"color":"other","confidence":0.41},{"color":"black","confidence":0.19},{"color":"brown","confidence":0.16},{"color":"red","confidence":0.14}]}}}]'} + body: {string: '[{"faceId":"62b7416d-5fe0-444b-a880-7c8864802144","faceRectangle":{"top":84,"left":31,"width":97,"height":97},"faceAttributes":{"smile":1.0,"headPose":{"pitch":0.0,"roll":-0.7,"yaw":-2.4},"gender":"female","age":47.0,"facialHair":{"moustache":0.0,"beard":0.0,"sideburns":0.0},"glasses":"NoGlasses","emotion":{"anger":0.0,"contempt":0.0,"disgust":0.0,"fear":0.0,"happiness":1.0,"neutral":0.0,"sadness":0.0,"surprise":0.0},"blur":{"blurLevel":"low","value":0.0},"exposure":{"exposureLevel":"goodExposure","value":0.72},"noise":{"noiseLevel":"low","value":0.03},"makeup":{"eyeMakeup":true,"lipMakeup":true},"accessories":[],"occlusion":{"foreheadOccluded":false,"eyeOccluded":false,"mouthOccluded":false},"hair":{"bald":0.66,"invisible":false,"hairColor":[{"color":"blond","confidence":1.0},{"color":"gray","confidence":0.93},{"color":"other","confidence":0.48},{"color":"red","confidence":0.05},{"color":"black","confidence":0.04},{"color":"brown","confidence":0.02}]}}}]'} headers: - apim-request-id: [afc7e3a8-047c-49fa-a7e8-d1783f103da6] + apim-request-id: [2982fda4-a4d4-419a-af72-12f2ba2ddfd2] cache-control: [no-cache] content-length: ['969'] content-type: [application/json; charset=utf-8] - date: ['Thu, 19 Oct 2017 22:59:15 GMT'] + date: ['Fri, 29 Mar 2019 23:06:29 GMT'] expires: ['-1'] pragma: [no-cache] strict-transport-security: [max-age=31536000; includeSubDomains; preload] diff --git a/azure-cognitiveservices-vision-face/tests/test_face.py b/azure-cognitiveservices-vision-face/tests/test_face.py index dfa916bc4c4f..f330034f9269 100644 --- a/azure-cognitiveservices-vision-face/tests/test_face.py +++ b/azure-cognitiveservices-vision-face/tests/test_face.py @@ -57,7 +57,7 @@ def test_face_detect(self): ) detected = result[0] - self.assertEqual(detected.face_attributes.age, 52.4) + self.assertEqual(detected.face_attributes.age, 47.0) self.assertEqual(detected.face_attributes.gender, Gender.female) self.assertEqual(detected.face_attributes.emotion.happiness, 1.0)