From 0b034d7ab71c51271b04dee40e4d5aaf4aedb4a7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 31 Jul 2018 04:57:59 +0000 Subject: [PATCH 1/5] Generated from 9b4c21a58071bdaf26a5ced0fa4a283077617af1 Nit fix documentation. --- .../vision/face/face_client.py | 20 + .../vision/face/models/__init__.py | 12 +- .../face/models/find_similar_request.py | 15 +- .../face/models/find_similar_request_py3.py | 17 +- .../vision/face/models/identify_request.py | 21 +- .../face/models/identify_request_py3.py | 23 +- .../vision/face/models/large_face_list.py | 43 ++ .../vision/face/models/large_face_list_py3.py | 43 ++ .../vision/face/models/large_person_group.py | 43 ++ .../face/models/large_person_group_py3.py | 43 ++ .../models/name_and_user_data_contract.py | 2 +- .../models/name_and_user_data_contract_py3.py | 2 +- .../vision/face/models/person_group.py | 4 +- .../vision/face/models/person_group_py3.py | 4 +- .../vision/face/models/training_status.py | 20 +- .../vision/face/models/training_status_py3.py | 22 +- ...face_request.py => update_face_request.py} | 6 +- ...uest_py3.py => update_face_request_py3.py} | 6 +- .../models/verify_face_to_face_request.py | 2 +- .../models/verify_face_to_face_request_py3.py | 2 +- .../models/verify_face_to_person_request.py | 26 +- .../verify_face_to_person_request_py3.py | 28 +- .../vision/face/operations/__init__.py | 8 + .../vision/face/operations/face_operations.py | 62 +- .../large_face_list_face_operations.py | 101 +++ .../operations/large_face_list_operations.py | 723 ++++++++++++++++++ .../large_person_group_operations.py | 408 ++++++++++ .../large_person_group_person_operations.py | 666 ++++++++++++++++ .../operations/person_group_operations.py | 4 +- .../person_group_person_operations.py | 12 +- 30 files changed, 2297 insertions(+), 91 deletions(-) create mode 100644 azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list.py create mode 100644 azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list_py3.py create mode 100644 azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group.py create mode 100644 azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group_py3.py rename azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/{update_person_face_request.py => update_face_request.py} (85%) rename azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/{update_person_face_request_py3.py => update_face_request_py3.py} (86%) create mode 100644 azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py create mode 100644 azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_operations.py create mode 100644 azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_operations.py create mode 100644 azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/face_client.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/face_client.py index 9ad3c9bc77e2..bdeff1d449e4 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/face_client.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/face_client.py @@ -16,6 +16,10 @@ from .operations.person_group_person_operations import PersonGroupPersonOperations from .operations.person_group_operations import PersonGroupOperations from .operations.face_list_operations import FaceListOperations +from .operations.large_person_group_person_operations import LargePersonGroupPersonOperations +from .operations.large_person_group_operations import LargePersonGroupOperations +from .operations.large_face_list_operations import LargeFaceListOperations +from .operations.large_face_list_face_operations import LargeFaceListFaceOperations from . import models @@ -63,6 +67,14 @@ class FaceClient(SDKClient): :vartype person_group: azure.cognitiveservices.vision.face.operations.PersonGroupOperations :ivar face_list: FaceList operations :vartype face_list: azure.cognitiveservices.vision.face.operations.FaceListOperations + :ivar large_person_group_person: LargePersonGroupPerson operations + :vartype large_person_group_person: azure.cognitiveservices.vision.face.operations.LargePersonGroupPersonOperations + :ivar large_person_group: LargePersonGroup operations + :vartype large_person_group: azure.cognitiveservices.vision.face.operations.LargePersonGroupOperations + :ivar large_face_list: LargeFaceList operations + :vartype large_face_list: azure.cognitiveservices.vision.face.operations.LargeFaceListOperations + :ivar large_face_list_face: LargeFaceListFace operations + :vartype large_face_list_face: azure.cognitiveservices.vision.face.operations.LargeFaceListFaceOperations :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). @@ -91,3 +103,11 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.face_list = FaceListOperations( self._client, self.config, self._serialize, self._deserialize) + self.large_person_group_person = LargePersonGroupPersonOperations( + self._client, self.config, self._serialize, self._deserialize) + self.large_person_group = LargePersonGroupOperations( + self._client, self.config, self._serialize, self._deserialize) + self.large_face_list = LargeFaceListOperations( + self._client, self.config, self._serialize, self._deserialize) + self.large_face_list_face = LargeFaceListFaceOperations( + self._client, self.config, self._serialize, self._deserialize) 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 7bb03f445fe6..4b6874f172bf 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 @@ -42,7 +42,9 @@ from .face_list_py3 import FaceList from .person_group_py3 import PersonGroup from .person_py3 import Person - from .update_person_face_request_py3 import UpdatePersonFaceRequest + from .large_face_list_py3 import LargeFaceList + from .large_person_group_py3 import LargePersonGroup + from .update_face_request_py3 import UpdateFaceRequest from .training_status_py3 import TrainingStatus from .name_and_user_data_contract_py3 import NameAndUserDataContract from .image_url_py3 import ImageUrl @@ -79,7 +81,9 @@ from .face_list import FaceList from .person_group import PersonGroup from .person import Person - from .update_person_face_request import UpdatePersonFaceRequest + from .large_face_list import LargeFaceList + from .large_person_group import LargePersonGroup + from .update_face_request import UpdateFaceRequest from .training_status import TrainingStatus from .name_and_user_data_contract import NameAndUserDataContract from .image_url import ImageUrl @@ -129,7 +133,9 @@ 'FaceList', 'PersonGroup', 'Person', - 'UpdatePersonFaceRequest', + 'LargeFaceList', + 'LargePersonGroup', + 'UpdateFaceRequest', 'TrainingStatus', 'NameAndUserDataContract', 'ImageUrl', diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/find_similar_request.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/find_similar_request.py index ecd78dc832af..fb3fa5c2fdb4 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/find_similar_request.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/find_similar_request.py @@ -24,11 +24,19 @@ class FindSimilarRequest(Model): :param face_list_id: An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter - faceListId and faceIds should not be provided at the same time + faceListId, largeFaceListId and faceIds should not be provided at the same + time。 :type face_list_id: str + :param large_face_list_id: An existing user-specified unique candidate + large face list, created in LargeFaceList - Create. Large face list + contains a set of persistedFaceIds which are persisted and will never + expire. Parameter faceListId, largeFaceListId and faceIds should not be + provided at the same time. + :type large_face_list_id: str :param face_ids: An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection - call. + call. The number of faceIds is limited to 1000. Parameter faceListId, + largeFaceListId and faceIds should not be provided at the same time. :type face_ids: list[str] :param max_num_of_candidates_returned: The number of top similar faces returned. The valid range is [1, 1000]. Default value: 20 . @@ -43,6 +51,7 @@ class FindSimilarRequest(Model): _validation = { 'face_id': {'required': True}, 'face_list_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + 'large_face_list_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'face_ids': {'max_items': 1000}, 'max_num_of_candidates_returned': {'maximum': 1000, 'minimum': 1}, } @@ -50,6 +59,7 @@ class FindSimilarRequest(Model): _attribute_map = { 'face_id': {'key': 'faceId', 'type': 'str'}, 'face_list_id': {'key': 'faceListId', 'type': 'str'}, + 'large_face_list_id': {'key': 'largeFaceListId', 'type': 'str'}, 'face_ids': {'key': 'faceIds', 'type': '[str]'}, 'max_num_of_candidates_returned': {'key': 'maxNumOfCandidatesReturned', 'type': 'int'}, 'mode': {'key': 'mode', 'type': 'FindSimilarMatchMode'}, @@ -59,6 +69,7 @@ def __init__(self, **kwargs): super(FindSimilarRequest, self).__init__(**kwargs) self.face_id = kwargs.get('face_id', None) self.face_list_id = kwargs.get('face_list_id', None) + self.large_face_list_id = kwargs.get('large_face_list_id', None) self.face_ids = kwargs.get('face_ids', None) self.max_num_of_candidates_returned = kwargs.get('max_num_of_candidates_returned', 20) self.mode = kwargs.get('mode', "matchPerson") diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/find_similar_request_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/find_similar_request_py3.py index ee1fef638e4e..ea3cbc0c4295 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/find_similar_request_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/find_similar_request_py3.py @@ -24,11 +24,19 @@ class FindSimilarRequest(Model): :param face_list_id: An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. Parameter - faceListId and faceIds should not be provided at the same time + faceListId, largeFaceListId and faceIds should not be provided at the same + time。 :type face_list_id: str + :param large_face_list_id: An existing user-specified unique candidate + large face list, created in LargeFaceList - Create. Large face list + contains a set of persistedFaceIds which are persisted and will never + expire. Parameter faceListId, largeFaceListId and faceIds should not be + provided at the same time. + :type large_face_list_id: str :param face_ids: An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after the detection - call. + call. The number of faceIds is limited to 1000. Parameter faceListId, + largeFaceListId and faceIds should not be provided at the same time. :type face_ids: list[str] :param max_num_of_candidates_returned: The number of top similar faces returned. The valid range is [1, 1000]. Default value: 20 . @@ -43,6 +51,7 @@ class FindSimilarRequest(Model): _validation = { 'face_id': {'required': True}, 'face_list_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + 'large_face_list_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'face_ids': {'max_items': 1000}, 'max_num_of_candidates_returned': {'maximum': 1000, 'minimum': 1}, } @@ -50,15 +59,17 @@ class FindSimilarRequest(Model): _attribute_map = { 'face_id': {'key': 'faceId', 'type': 'str'}, 'face_list_id': {'key': 'faceListId', 'type': 'str'}, + 'large_face_list_id': {'key': 'largeFaceListId', 'type': 'str'}, 'face_ids': {'key': 'faceIds', 'type': '[str]'}, 'max_num_of_candidates_returned': {'key': 'maxNumOfCandidatesReturned', 'type': 'int'}, 'mode': {'key': 'mode', 'type': 'FindSimilarMatchMode'}, } - def __init__(self, *, face_id: str, face_list_id: str=None, face_ids=None, max_num_of_candidates_returned: int=20, mode="matchPerson", **kwargs) -> None: + def __init__(self, *, face_id: str, face_list_id: str=None, large_face_list_id: str=None, face_ids=None, max_num_of_candidates_returned: int=20, mode="matchPerson", **kwargs) -> None: super(FindSimilarRequest, self).__init__(**kwargs) self.face_id = face_id self.face_list_id = face_list_id + self.large_face_list_id = large_face_list_id self.face_ids = face_ids self.max_num_of_candidates_returned = max_num_of_candidates_returned self.mode = mode diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/identify_request.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/identify_request.py index 49fa7581139f..5b7175b406e5 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/identify_request.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/identify_request.py @@ -17,13 +17,19 @@ class IdentifyRequest(Model): All required parameters must be populated in order to send to Azure. - :param person_group_id: Required. PersonGroupId of the target person - group, created by PersonGroups.Create - :type person_group_id: str :param face_ids: Required. Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. :type face_ids: list[str] + :param person_group_id: PersonGroupId of the target person group, created + by PersonGroup - Create. Parameter personGroupId and largePersonGroupId + should not be provided at the same time. + :type person_group_id: str + :param large_person_group_id: LargePersonGroupId of the target large + person group, created by LargePersonGroup - Create. Parameter + personGroupId and largePersonGroupId should not be provided at the same + time. + :type large_person_group_id: str :param max_num_of_candidates_returned: The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). Default value: 1 . @@ -35,21 +41,24 @@ class IdentifyRequest(Model): """ _validation = { - 'person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'face_ids': {'required': True, 'max_items': 10}, + 'person_group_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + 'large_person_group_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'max_num_of_candidates_returned': {'maximum': 5, 'minimum': 1}, } _attribute_map = { - 'person_group_id': {'key': 'personGroupId', 'type': 'str'}, 'face_ids': {'key': 'faceIds', 'type': '[str]'}, + 'person_group_id': {'key': 'personGroupId', 'type': 'str'}, + 'large_person_group_id': {'key': 'largePersonGroupId', 'type': 'str'}, 'max_num_of_candidates_returned': {'key': 'maxNumOfCandidatesReturned', 'type': 'int'}, 'confidence_threshold': {'key': 'confidenceThreshold', 'type': 'float'}, } def __init__(self, **kwargs): super(IdentifyRequest, self).__init__(**kwargs) - self.person_group_id = kwargs.get('person_group_id', None) self.face_ids = kwargs.get('face_ids', None) + self.person_group_id = kwargs.get('person_group_id', None) + self.large_person_group_id = kwargs.get('large_person_group_id', None) self.max_num_of_candidates_returned = kwargs.get('max_num_of_candidates_returned', 1) self.confidence_threshold = kwargs.get('confidence_threshold', None) diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/identify_request_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/identify_request_py3.py index 64e66bb66422..b9494964f853 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/identify_request_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/identify_request_py3.py @@ -17,13 +17,19 @@ class IdentifyRequest(Model): All required parameters must be populated in order to send to Azure. - :param person_group_id: Required. PersonGroupId of the target person - group, created by PersonGroups.Create - :type person_group_id: str :param face_ids: Required. Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. :type face_ids: list[str] + :param person_group_id: PersonGroupId of the target person group, created + by PersonGroup - Create. Parameter personGroupId and largePersonGroupId + should not be provided at the same time. + :type person_group_id: str + :param large_person_group_id: LargePersonGroupId of the target large + person group, created by LargePersonGroup - Create. Parameter + personGroupId and largePersonGroupId should not be provided at the same + time. + :type large_person_group_id: str :param max_num_of_candidates_returned: The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). Default value: 1 . @@ -35,21 +41,24 @@ class IdentifyRequest(Model): """ _validation = { - 'person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'face_ids': {'required': True, 'max_items': 10}, + 'person_group_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + 'large_person_group_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'max_num_of_candidates_returned': {'maximum': 5, 'minimum': 1}, } _attribute_map = { - 'person_group_id': {'key': 'personGroupId', 'type': 'str'}, 'face_ids': {'key': 'faceIds', 'type': '[str]'}, + 'person_group_id': {'key': 'personGroupId', 'type': 'str'}, + 'large_person_group_id': {'key': 'largePersonGroupId', 'type': 'str'}, 'max_num_of_candidates_returned': {'key': 'maxNumOfCandidatesReturned', 'type': 'int'}, 'confidence_threshold': {'key': 'confidenceThreshold', 'type': 'float'}, } - def __init__(self, *, person_group_id: str, face_ids, max_num_of_candidates_returned: int=1, confidence_threshold: float=None, **kwargs) -> None: + def __init__(self, *, face_ids, person_group_id: str=None, large_person_group_id: str=None, max_num_of_candidates_returned: int=1, confidence_threshold: float=None, **kwargs) -> None: super(IdentifyRequest, self).__init__(**kwargs) - self.person_group_id = person_group_id self.face_ids = face_ids + self.person_group_id = person_group_id + self.large_person_group_id = large_person_group_id self.max_num_of_candidates_returned = max_num_of_candidates_returned self.confidence_threshold = confidence_threshold 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 new file mode 100644 index 000000000000..f6a6d5525543 --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list.py @@ -0,0 +1,43 @@ +# 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 LargeFaceList(NameAndUserDataContract): + """Large face list object. + + All required parameters must be populated in order to send to Azure. + + :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 large_face_list_id: Required. LargeFaceListId of the target large + face list. + :type large_face_list_id: str + """ + + _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, + 'large_face_list_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'user_data': {'key': 'userData', 'type': 'str'}, + 'large_face_list_id': {'key': 'largeFaceListId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LargeFaceList, self).__init__(**kwargs) + self.large_face_list_id = kwargs.get('large_face_list_id', None) 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 new file mode 100644 index 000000000000..4a05214af516 --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_face_list_py3.py @@ -0,0 +1,43 @@ +# 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 LargeFaceList(NameAndUserDataContract): + """Large face list object. + + All required parameters must be populated in order to send to Azure. + + :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 large_face_list_id: Required. LargeFaceListId of the target large + face list. + :type large_face_list_id: str + """ + + _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, + 'large_face_list_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'user_data': {'key': 'userData', '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) + 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 new file mode 100644 index 000000000000..f65f661b5057 --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group.py @@ -0,0 +1,43 @@ +# 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 LargePersonGroup(NameAndUserDataContract): + """Large person group object. + + All required parameters must be populated in order to send to Azure. + + :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 large_person_group_id: Required. LargePersonGroupId of the target + large person groups + :type large_person_group_id: str + """ + + _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, + 'large_person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'user_data': {'key': 'userData', 'type': 'str'}, + 'large_person_group_id': {'key': 'largePersonGroupId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LargePersonGroup, self).__init__(**kwargs) + self.large_person_group_id = kwargs.get('large_person_group_id', None) 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 new file mode 100644 index 000000000000..f28979ee5cfe --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/large_person_group_py3.py @@ -0,0 +1,43 @@ +# 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 LargePersonGroup(NameAndUserDataContract): + """Large person group object. + + All required parameters must be populated in order to send to Azure. + + :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 large_person_group_id: Required. LargePersonGroupId of the target + large person groups + :type large_person_group_id: str + """ + + _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, + 'large_person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'user_data': {'key': 'userData', '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) + self.large_person_group_id = large_person_group_id diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/name_and_user_data_contract.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/name_and_user_data_contract.py index 7bb1d59f78f9..ef1f79d83d24 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/name_and_user_data_contract.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/name_and_user_data_contract.py @@ -14,7 +14,7 @@ class NameAndUserDataContract(Model): """A combination of user defined name and user specified data for the person, - personGroup, and faceList. + largePersonGroup/personGroup, and largeFaceList/faceList. :param name: User defined name, maximum length is 128. :type name: str diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/name_and_user_data_contract_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/name_and_user_data_contract_py3.py index aaad6334d408..29c856742584 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/name_and_user_data_contract_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/name_and_user_data_contract_py3.py @@ -14,7 +14,7 @@ class NameAndUserDataContract(Model): """A combination of user defined name and user specified data for the person, - personGroup, and faceList. + largePersonGroup/personGroup, and largeFaceList/faceList. :param name: User defined name, maximum length is 128. :type name: str 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 b69e95e9b341..9e4eab234771 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 @@ -21,8 +21,8 @@ class PersonGroup(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str - :param person_group_id: Required. PersonGroupId of the existing person - groups. + :param person_group_id: Required. PersonGroupId of the target person + group. :type person_group_id: 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 51e9963674fd..c1fc341ed83b 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 @@ -21,8 +21,8 @@ class PersonGroup(NameAndUserDataContract): :type name: str :param user_data: User specified data. Length should not exceed 16KB. :type user_data: str - :param person_group_id: Required. PersonGroupId of the existing person - groups. + :param person_group_id: Required. PersonGroupId of the target person + group. :type person_group_id: str """ diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/training_status.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/training_status.py index 4b4c26559efb..718da91dc34b 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/training_status.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/training_status.py @@ -20,18 +20,26 @@ class TrainingStatus(Model): :param status: Required. Training status: notstarted, running, succeeded, failed. If the training process is waiting to perform, the status is notstarted. If the training is ongoing, the status is running. Status - succeed means this person group is ready for Face - Identify. Status + succeed means this person group or large person group is ready for Face - + Identify, or this large face list is ready for Face - Find Similar. Status failed is often caused by no person or no persisted face exist in the - person group. Possible values include: 'nonstarted', 'running', + person group or large person group, or no persisted face exist in the + large face list. Possible values include: 'nonstarted', 'running', 'succeeded', 'failed' :type status: str or ~azure.cognitiveservices.vision.face.models.TrainingStatusType :param created: Required. A combined UTC date and time string that - describes person group created time. + describes the created time of the person group, large person group or + large face list. :type created: datetime - :param last_action: Person group last modify time in the UTC, could be - null value when the person group is not successfully trained. + :param last_action: A combined UTC date and time string that describes the + last modify time of the person group, large person group or large face + list, could be null value when the group is not successfully trained. :type last_action: datetime + :param last_successful_training: A combined UTC date and time string that + describes the last successful training time of the person group, large + person group or large face list. + :type last_successful_training: datetime :param message: Show failure message when training failed (omitted when training succeed). :type message: str @@ -46,6 +54,7 @@ class TrainingStatus(Model): 'status': {'key': 'status', 'type': 'TrainingStatusType'}, 'created': {'key': 'createdDateTime', 'type': 'iso-8601'}, 'last_action': {'key': 'lastActionDateTime', 'type': 'iso-8601'}, + 'last_successful_training': {'key': 'lastSuccessfulTrainingDateTime', 'type': 'iso-8601'}, 'message': {'key': 'message', 'type': 'str'}, } @@ -54,4 +63,5 @@ def __init__(self, **kwargs): self.status = kwargs.get('status', None) self.created = kwargs.get('created', None) self.last_action = kwargs.get('last_action', None) + self.last_successful_training = kwargs.get('last_successful_training', None) self.message = kwargs.get('message', None) diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/training_status_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/training_status_py3.py index a2980a678d25..50857f65cddb 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/training_status_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/training_status_py3.py @@ -20,18 +20,26 @@ class TrainingStatus(Model): :param status: Required. Training status: notstarted, running, succeeded, failed. If the training process is waiting to perform, the status is notstarted. If the training is ongoing, the status is running. Status - succeed means this person group is ready for Face - Identify. Status + succeed means this person group or large person group is ready for Face - + Identify, or this large face list is ready for Face - Find Similar. Status failed is often caused by no person or no persisted face exist in the - person group. Possible values include: 'nonstarted', 'running', + person group or large person group, or no persisted face exist in the + large face list. Possible values include: 'nonstarted', 'running', 'succeeded', 'failed' :type status: str or ~azure.cognitiveservices.vision.face.models.TrainingStatusType :param created: Required. A combined UTC date and time string that - describes person group created time. + describes the created time of the person group, large person group or + large face list. :type created: datetime - :param last_action: Person group last modify time in the UTC, could be - null value when the person group is not successfully trained. + :param last_action: A combined UTC date and time string that describes the + last modify time of the person group, large person group or large face + list, could be null value when the group is not successfully trained. :type last_action: datetime + :param last_successful_training: A combined UTC date and time string that + describes the last successful training time of the person group, large + person group or large face list. + :type last_successful_training: datetime :param message: Show failure message when training failed (omitted when training succeed). :type message: str @@ -46,12 +54,14 @@ class TrainingStatus(Model): 'status': {'key': 'status', 'type': 'TrainingStatusType'}, 'created': {'key': 'createdDateTime', 'type': 'iso-8601'}, 'last_action': {'key': 'lastActionDateTime', 'type': 'iso-8601'}, + 'last_successful_training': {'key': 'lastSuccessfulTrainingDateTime', 'type': 'iso-8601'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, status, created, last_action=None, message: str=None, **kwargs) -> None: + def __init__(self, *, status, created, last_action=None, last_successful_training=None, message: str=None, **kwargs) -> None: super(TrainingStatus, self).__init__(**kwargs) self.status = status self.created = created self.last_action = last_action + self.last_successful_training = last_successful_training self.message = message diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_person_face_request.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_face_request.py similarity index 85% rename from azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_person_face_request.py rename to azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_face_request.py index 94a2ac30a27c..d2df86ba2b30 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_person_face_request.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_face_request.py @@ -12,8 +12,8 @@ from msrest.serialization import Model -class UpdatePersonFaceRequest(Model): - """Request to update person face data. +class UpdateFaceRequest(Model): + """Request to update face data. :param user_data: User-provided data attached to the face. The size limit is 1KB. @@ -29,5 +29,5 @@ class UpdatePersonFaceRequest(Model): } def __init__(self, **kwargs): - super(UpdatePersonFaceRequest, self).__init__(**kwargs) + super(UpdateFaceRequest, self).__init__(**kwargs) self.user_data = kwargs.get('user_data', None) diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_person_face_request_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_face_request_py3.py similarity index 86% rename from azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_person_face_request_py3.py rename to azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_face_request_py3.py index b610a4f30943..2610f03251cd 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_person_face_request_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/update_face_request_py3.py @@ -12,8 +12,8 @@ from msrest.serialization import Model -class UpdatePersonFaceRequest(Model): - """Request to update person face data. +class UpdateFaceRequest(Model): + """Request to update face data. :param user_data: User-provided data attached to the face. The size limit is 1KB. @@ -29,5 +29,5 @@ class UpdatePersonFaceRequest(Model): } def __init__(self, *, user_data: str=None, **kwargs) -> None: - super(UpdatePersonFaceRequest, self).__init__(**kwargs) + super(UpdateFaceRequest, self).__init__(**kwargs) self.user_data = user_data diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_face_request.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_face_request.py index 86c843b60298..9c22d1921f50 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_face_request.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_face_request.py @@ -13,7 +13,7 @@ class VerifyFaceToFaceRequest(Model): - """Request body for verify operation. + """Request body for face to face verification. All required parameters must be populated in order to send to Azure. diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_face_request_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_face_request_py3.py index 21c05a53b2dc..9c5f2f347255 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_face_request_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_face_request_py3.py @@ -13,7 +13,7 @@ class VerifyFaceToFaceRequest(Model): - """Request body for verify operation. + """Request body for face to face verification. All required parameters must be populated in order to send to Azure. diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_person_request.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_person_request.py index 29d8e3b922d7..91169e15391e 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_person_request.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_person_request.py @@ -13,30 +13,39 @@ class VerifyFaceToPersonRequest(Model): - """Request body for verify operation. + """Request body for face to person verification. All required parameters must be populated in order to send to Azure. - :param face_id: Required. FaceId the face, comes from Face - Detect + :param face_id: Required. FaceId of the face, comes from Face - Detect :type face_id: str - :param person_group_id: Required. Using existing personGroupId and - personId for fast loading a specified person. personGroupId is created in - Person Groups.Create. + :param person_group_id: Using existing personGroupId and personId for fast + loading a specified person. personGroupId is created in PersonGroup - + Create. Parameter personGroupId and largePersonGroupId should not be + provided at the same time. :type person_group_id: str - :param person_id: Required. Specify a certain person in a person group. - personId is created in Persons.Create. + :param large_person_group_id: Using existing largePersonGroupId and + personId for fast loading a specified person. largePersonGroupId is + created in LargePersonGroup - Create. Parameter personGroupId and + largePersonGroupId should not be provided at the same time. + :type large_person_group_id: str + :param person_id: Required. Specify a certain person in a person group or + a large person group. personId is created in PersonGroup Person - Create + or LargePersonGroup Person - Create. :type person_id: str """ _validation = { 'face_id': {'required': True}, - 'person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + 'person_group_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + 'large_person_group_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'person_id': {'required': True}, } _attribute_map = { 'face_id': {'key': 'faceId', 'type': 'str'}, 'person_group_id': {'key': 'personGroupId', 'type': 'str'}, + 'large_person_group_id': {'key': 'largePersonGroupId', 'type': 'str'}, 'person_id': {'key': 'personId', 'type': 'str'}, } @@ -44,4 +53,5 @@ def __init__(self, **kwargs): super(VerifyFaceToPersonRequest, self).__init__(**kwargs) self.face_id = kwargs.get('face_id', None) self.person_group_id = kwargs.get('person_group_id', None) + self.large_person_group_id = kwargs.get('large_person_group_id', None) self.person_id = kwargs.get('person_id', None) diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_person_request_py3.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_person_request_py3.py index e456de3145c4..b5c7633d2c3a 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_person_request_py3.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/verify_face_to_person_request_py3.py @@ -13,35 +13,45 @@ class VerifyFaceToPersonRequest(Model): - """Request body for verify operation. + """Request body for face to person verification. All required parameters must be populated in order to send to Azure. - :param face_id: Required. FaceId the face, comes from Face - Detect + :param face_id: Required. FaceId of the face, comes from Face - Detect :type face_id: str - :param person_group_id: Required. Using existing personGroupId and - personId for fast loading a specified person. personGroupId is created in - Person Groups.Create. + :param person_group_id: Using existing personGroupId and personId for fast + loading a specified person. personGroupId is created in PersonGroup - + Create. Parameter personGroupId and largePersonGroupId should not be + provided at the same time. :type person_group_id: str - :param person_id: Required. Specify a certain person in a person group. - personId is created in Persons.Create. + :param large_person_group_id: Using existing largePersonGroupId and + personId for fast loading a specified person. largePersonGroupId is + created in LargePersonGroup - Create. Parameter personGroupId and + largePersonGroupId should not be provided at the same time. + :type large_person_group_id: str + :param person_id: Required. Specify a certain person in a person group or + a large person group. personId is created in PersonGroup Person - Create + or LargePersonGroup Person - Create. :type person_id: str """ _validation = { 'face_id': {'required': True}, - 'person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + 'person_group_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, + 'large_person_group_id': {'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'person_id': {'required': True}, } _attribute_map = { 'face_id': {'key': 'faceId', 'type': 'str'}, 'person_group_id': {'key': 'personGroupId', 'type': 'str'}, + 'large_person_group_id': {'key': 'largePersonGroupId', 'type': 'str'}, 'person_id': {'key': 'personId', 'type': 'str'}, } - def __init__(self, *, face_id: str, person_group_id: str, person_id: str, **kwargs) -> None: + def __init__(self, *, face_id: str, person_id: str, person_group_id: str=None, large_person_group_id: str=None, **kwargs) -> None: super(VerifyFaceToPersonRequest, self).__init__(**kwargs) self.face_id = face_id self.person_group_id = person_group_id + self.large_person_group_id = large_person_group_id self.person_id = person_id diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/__init__.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/__init__.py index 76f00717fdfd..59a70636caef 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/__init__.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/__init__.py @@ -13,10 +13,18 @@ from .person_group_person_operations import PersonGroupPersonOperations from .person_group_operations import PersonGroupOperations from .face_list_operations import FaceListOperations +from .large_person_group_person_operations import LargePersonGroupPersonOperations +from .large_person_group_operations import LargePersonGroupOperations +from .large_face_list_operations import LargeFaceListOperations +from .large_face_list_face_operations import LargeFaceListFaceOperations __all__ = [ 'FaceOperations', 'PersonGroupPersonOperations', 'PersonGroupOperations', 'FaceListOperations', + 'LargePersonGroupPersonOperations', + 'LargePersonGroupOperations', + 'LargeFaceListOperations', + 'LargeFaceListFaceOperations', ] 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 2c6069686a9f..f0fc854c00fa 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 @@ -34,9 +34,9 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def find_similar( - self, face_id, face_list_id=None, face_ids=None, max_num_of_candidates_returned=20, mode="matchPerson", custom_headers=None, raw=False, **operation_config): + 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 or a faceListId. + array, a face list or a 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 @@ -45,12 +45,20 @@ def find_similar( :param face_list_id: An existing user-specified unique candidate face list, created in Face List - Create a Face List. Face list contains a set of persistedFaceIds which are persisted and will never expire. - Parameter faceListId and faceIds should not be provided at the same - time + Parameter faceListId, largeFaceListId and faceIds should not be + provided at the same time。 :type face_list_id: str + :param large_face_list_id: An existing user-specified unique candidate + large face list, created in LargeFaceList - Create. Large face list + contains a set of persistedFaceIds which are persisted and will never + expire. Parameter faceListId, largeFaceListId and faceIds should not + be provided at the same time. + :type large_face_list_id: str :param face_ids: An array of candidate faceIds. All of them are created by Face - Detect and the faceIds will expire 24 hours after - the detection call. + the detection call. The number of faceIds is limited to 1000. + Parameter faceListId, largeFaceListId and faceIds should not be + provided at the same time. :type face_ids: list[str] :param max_num_of_candidates_returned: The number of top similar faces returned. The valid range is [1, 1000]. @@ -70,7 +78,7 @@ def find_similar( :raises: :class:`APIErrorException` """ - body = models.FindSimilarRequest(face_id=face_id, face_list_id=face_list_id, face_ids=face_ids, max_num_of_candidates_returned=max_num_of_candidates_returned, mode=mode) + body = models.FindSimilarRequest(face_id=face_id, face_list_id=face_list_id, large_face_list_id=large_face_list_id, face_ids=face_ids, max_num_of_candidates_returned=max_num_of_candidates_returned, mode=mode) # Construct URL url = self.find_similar.metadata['url'] @@ -171,16 +179,23 @@ def group( group.metadata = {'url': '/group'} def identify( - self, person_group_id, face_ids, max_num_of_candidates_returned=1, confidence_threshold=None, custom_headers=None, raw=False, **operation_config): - """Identify unknown faces from a person group. + 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. - :param person_group_id: PersonGroupId of the target person group, - created by PersonGroups.Create - :type person_group_id: str :param face_ids: Array of query faces faceIds, created by the Face - Detect. Each of the faces are identified independently. The valid number of faceIds is between [1, 10]. :type face_ids: list[str] + :param person_group_id: PersonGroupId of the target person group, + created by PersonGroup - Create. Parameter personGroupId and + largePersonGroupId should not be provided at the same time. + :type person_group_id: str + :param large_person_group_id: LargePersonGroupId of the target large + person group, created by LargePersonGroup - Create. Parameter + personGroupId and largePersonGroupId should not be provided at the + same time. + :type large_person_group_id: str :param max_num_of_candidates_returned: The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). :type max_num_of_candidates_returned: int @@ -200,7 +215,7 @@ def identify( :raises: :class:`APIErrorException` """ - body = models.IdentifyRequest(person_group_id=person_group_id, face_ids=face_ids, max_num_of_candidates_returned=max_num_of_candidates_returned, confidence_threshold=confidence_threshold) + body = models.IdentifyRequest(face_ids=face_ids, person_group_id=person_group_id, large_person_group_id=large_person_group_id, max_num_of_candidates_returned=max_num_of_candidates_returned, confidence_threshold=confidence_threshold) # Construct URL url = self.identify.metadata['url'] @@ -382,19 +397,26 @@ def detect_with_url( detect_with_url.metadata = {'url': '/detect'} def verify_face_to_person( - self, face_id, person_group_id, person_id, custom_headers=None, raw=False, **operation_config): + self, face_id, person_id, person_group_id=None, large_person_group_id=None, custom_headers=None, raw=False, **operation_config): """Verify whether two faces belong to a same person. Compares a face Id with a Person Id. - :param face_id: FaceId the face, comes from Face - Detect + :param face_id: FaceId of the face, comes from Face - Detect :type face_id: str + :param person_id: Specify a certain person in a person group or a + large person group. personId is created in PersonGroup Person - Create + or LargePersonGroup Person - Create. + :type person_id: str :param person_group_id: Using existing personGroupId and personId for - fast loading a specified person. personGroupId is created in Person - Groups.Create. + fast loading a specified person. personGroupId is created in + PersonGroup - Create. Parameter personGroupId and largePersonGroupId + should not be provided at the same time. :type person_group_id: str - :param person_id: Specify a certain person in a person group. personId - is created in Persons.Create. - :type person_id: str + :param large_person_group_id: Using existing largePersonGroupId and + personId for fast loading a specified person. largePersonGroupId is + created in LargePersonGroup - Create. Parameter personGroupId and + largePersonGroupId should not be provided at the same time. + :type large_person_group_id: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -406,7 +428,7 @@ def verify_face_to_person( :raises: :class:`APIErrorException` """ - body = models.VerifyFaceToPersonRequest(face_id=face_id, person_group_id=person_group_id, person_id=person_id) + body = models.VerifyFaceToPersonRequest(face_id=face_id, person_group_id=person_group_id, large_person_group_id=large_person_group_id, person_id=person_id) # Construct URL url = self.verify_face_to_person.metadata['url'] diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py new file mode 100644 index 000000000000..7666fd768424 --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py @@ -0,0 +1,101 @@ +# 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 msrest.pipeline import ClientRawResponse + +from .. import models + + +class LargeFaceListFaceOperations(object): + """LargeFaceListFaceOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def list( + self, large_face_list_id, start=None, top=None, custom_headers=None, raw=False, **operation_config): + """List all faces in a large face list, and retrieve face information + (including userData and persistedFaceIds of registered faces of the + face). + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param start: Starting face id to return (used to list a range of + faces). + :type start: str + :param top: Number of faces to return starting with the face id + indicated by the 'start' parameter. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: list or ClientRawResponse if raw=true + :rtype: + list[~azure.cognitiveservices.vision.face.models.PersistedFace] or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if start is not None: + query_parameters['start'] = self._serialize.query("start", start, 'str') + if top is not None: + query_parameters['top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('[PersistedFace]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces'} 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 new file mode 100644 index 000000000000..be9123b5fe95 --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_operations.py @@ -0,0 +1,723 @@ +# 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 msrest.pipeline import ClientRawResponse + +from .. import models + + +class LargeFaceListOperations(object): + """LargeFaceListOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = 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. + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + body = models.NameAndUserDataContract(name=name, user_data=user_data) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(body, 'NameAndUserDataContract') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + 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. + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LargeFaceList or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.LargeFaceList or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LargeFaceList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/largefacelists/{largeFaceListId}'} + + def update( + self, large_face_list_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config): + """Update information of a large face list. + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + body = models.NameAndUserDataContract(name=name, user_data=user_data) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(body, 'NameAndUserDataContract') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + update.metadata = {'url': '/largefacelists/{largeFaceListId}'} + + def delete( + self, large_face_list_id, custom_headers=None, raw=False, **operation_config): + """Delete an existing large face list according to faceListId. Persisted + face images in the large face list will also be deleted. + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/largefacelists/{largeFaceListId}'} + + def get_training_status( + self, large_face_list_id, custom_headers=None, raw=False, **operation_config): + """Retrieve the training status of a large face list (completed or + ongoing). + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TrainingStatus or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.TrainingStatus or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.get_training_status.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TrainingStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + 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. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: list or ClientRawResponse if raw=true + :rtype: + list[~azure.cognitiveservices.vision.face.models.LargeFaceList] or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('[LargeFaceList]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/largefacelists'} + + def train( + self, large_face_list_id, custom_headers=None, raw=False, **operation_config): + """Queue a large face list training task, the training task may not be + started immediately. + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.train.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + train.metadata = {'url': '/largefacelists/{largeFaceListId}/train'} + + def delete_face( + self, large_face_list_id, persisted_face_id, custom_headers=None, raw=False, **operation_config): + """Delete an existing face from a large face list (given by a + persisitedFaceId and a largeFaceListId). Persisted image related to the + face will also be deleted. + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param persisted_face_id: Id referencing a particular persistedFaceId + of an existing face. + :type persisted_face_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.delete_face.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'persistedFaceId': self._serialize.url("persisted_face_id", persisted_face_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_face.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}'} + + def get_face( + self, large_face_list_id, persisted_face_id, custom_headers=None, raw=False, **operation_config): + """Retrieve information about a persisted face (specified by + persistedFaceId and its belonging largeFaceListId). + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param persisted_face_id: Id referencing a particular persistedFaceId + of an existing face. + :type persisted_face_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PersistedFace or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.PersistedFace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.get_face.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'persistedFaceId': self._serialize.url("persisted_face_id", persisted_face_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PersistedFace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_face.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}'} + + def update_face( + self, large_face_list_id, persisted_face_id, user_data=None, custom_headers=None, raw=False, **operation_config): + """Update a persisted face's userData field. + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param persisted_face_id: Id referencing a particular persistedFaceId + of an existing face. + :type persisted_face_id: str + :param user_data: User-provided data attached to the face. The size + limit is 1KB. + :type user_data: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + body = models.UpdateFaceRequest(user_data=user_data) + + # Construct URL + url = self.update_face.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'persistedFaceId': self._serialize.url("persisted_face_id", persisted_face_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(body, 'UpdateFaceRequest') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + update_face.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}'} + + def add_face_from_url( + self, large_face_list_id, url, user_data=None, target_face=None, custom_headers=None, raw=False, **operation_config): + """Add a face to a large face list. The input face is specified as an + image with a targetFace rectangle. It returns a persistedFaceId + representing the added face, and persistedFaceId will not expire. + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param url: Publicly reachable URL of an image + :type url: str + :param user_data: User-specified data about the face for any purpose. + The maximum length is 1KB. + :type user_data: str + :param 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. + :type target_face: list[int] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PersistedFace or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.PersistedFace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + image_url = models.ImageUrl(url=url) + + # Construct URL + url = self.add_face_from_url.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if user_data is not None: + query_parameters['userData'] = self._serialize.query("user_data", user_data, 'str', max_length=1024) + if target_face is not None: + query_parameters['targetFace'] = self._serialize.query("target_face", target_face, '[int]', div=',') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(image_url, 'ImageUrl') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PersistedFace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_face_from_url.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces'} + + def add_face_from_stream( + self, large_face_list_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): + """Add a face to a large face list. The input face is specified as an + image with a targetFace rectangle. It returns a persistedFaceId + representing the added face, and persistedFaceId will not expire. + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param image: An image stream. + :type image: Generator + :param user_data: User-specified data about the face for any purpose. + The maximum length is 1KB. + :type user_data: str + :param 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. + :type target_face: list[int] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param callback: 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. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PersistedFace or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.PersistedFace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.add_face_from_stream.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if user_data is not None: + query_parameters['userData'] = self._serialize.query("user_data", user_data, 'str', max_length=1024) + if target_face is not None: + query_parameters['targetFace'] = self._serialize.query("target_face", target_face, '[int]', div=',') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/octet-stream' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._client.stream_upload(image, callback) + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PersistedFace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_face_from_stream.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces'} 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 new file mode 100644 index 000000000000..3e4bbf03c220 --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_operations.py @@ -0,0 +1,408 @@ +# 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 msrest.pipeline import ClientRawResponse + +from .. import models + + +class LargePersonGroupOperations(object): + """LargePersonGroupOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = 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. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + body = models.NameAndUserDataContract(name=name, user_data=user_data) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(body, 'NameAndUserDataContract') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + create.metadata = {'url': '/largepersongroups/{largePersonGroupId}'} + + def delete( + self, large_person_group_id, custom_headers=None, raw=False, **operation_config): + """Delete an existing large person group. Persisted face features of all + people in the large person group will also be deleted. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + 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. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LargePersonGroup or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.LargePersonGroup + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LargePersonGroup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/largepersongroups/{largePersonGroupId}'} + + def update( + self, large_person_group_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config): + """Update an existing large person group's display name and userData. The + properties which does not appear in request body will not be updated. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + body = models.NameAndUserDataContract(name=name, user_data=user_data) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(body, 'NameAndUserDataContract') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + update.metadata = {'url': '/largepersongroups/{largePersonGroupId}'} + + def get_training_status( + self, large_person_group_id, custom_headers=None, raw=False, **operation_config): + """Retrieve the training status of a large person group (completed or + ongoing). + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TrainingStatus or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.TrainingStatus or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.get_training_status.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TrainingStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + 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. + + :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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: list or ClientRawResponse if raw=true + :rtype: + list[~azure.cognitiveservices.vision.face.models.LargePersonGroup] or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if start is not None: + 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) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('[LargePersonGroup]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/largepersongroups'} + + def train( + self, large_person_group_id, custom_headers=None, raw=False, **operation_config): + """Queue a large person group training task, the training task may not be + started immediately. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.train.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + train.metadata = {'url': '/largepersongroups/{largePersonGroupId}/train'} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py new file mode 100644 index 000000000000..c14a8f809941 --- /dev/null +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py @@ -0,0 +1,666 @@ +# 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 msrest.pipeline import ClientRawResponse + +from .. import models + + +class LargePersonGroupPersonOperations(object): + """LargePersonGroupPersonOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = 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 person in a specified large person group. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Person or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.Person or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + body = models.NameAndUserDataContract(name=name, user_data=user_data) + + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(body, 'NameAndUserDataContract') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Person', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons'} + + def list( + self, large_person_group_id, start=None, top=None, custom_headers=None, raw=False, **operation_config): + """List all persons in a large person group, and retrieve person + information (including personId, name, userData and persistedFaceIds of + registered faces of the person). + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param start: Starting person id to return (used to list a range of + persons). + :type start: str + :param top: Number of persons to return starting with the person id + indicated by the 'start' parameter. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: list or ClientRawResponse if raw=true + :rtype: list[~azure.cognitiveservices.vision.face.models.Person] or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if start is not None: + query_parameters['start'] = self._serialize.query("start", start, 'str') + if top is not None: + query_parameters['top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('[Person]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons'} + + def delete( + self, large_person_group_id, person_id, custom_headers=None, raw=False, **operation_config): + """Delete an existing person from a large person group. All stored person + data, and face features in the person entry will be deleted. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param person_id: Id referencing a particular person. + :type person_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'personId': self._serialize.url("person_id", person_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}'} + + def get( + self, large_person_group_id, person_id, custom_headers=None, raw=False, **operation_config): + """Retrieve a person's information, including registered persisted faces, + name and userData. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param person_id: Id referencing a particular person. + :type person_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Person or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.Person or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'personId': self._serialize.url("person_id", person_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Person', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}'} + + def update( + self, large_person_group_id, person_id, name=None, user_data=None, custom_headers=None, raw=False, **operation_config): + """Update name or userData of a person. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param person_id: Id referencing a particular person. + :type person_id: str + :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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + body = models.NameAndUserDataContract(name=name, user_data=user_data) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'personId': self._serialize.url("person_id", person_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(body, 'NameAndUserDataContract') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + update.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}'} + + def delete_face( + self, large_person_group_id, person_id, persisted_face_id, custom_headers=None, raw=False, **operation_config): + """Delete a face from a person. Relative feature for the persisted face + will also be deleted. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param person_id: Id referencing a particular person. + :type person_id: str + :param persisted_face_id: Id referencing a particular persistedFaceId + of an existing face. + :type persisted_face_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.delete_face.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'personId': self._serialize.url("person_id", person_id, 'str'), + 'persistedFaceId': self._serialize.url("persisted_face_id", persisted_face_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'} + + def get_face( + self, large_person_group_id, person_id, persisted_face_id, custom_headers=None, raw=False, **operation_config): + """Retrieve information about a persisted face (specified by + persistedFaceId, personId and its belonging largePersonGroupId). + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param person_id: Id referencing a particular person. + :type person_id: str + :param persisted_face_id: Id referencing a particular persistedFaceId + of an existing face. + :type persisted_face_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PersistedFace or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.PersistedFace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.get_face.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'personId': self._serialize.url("person_id", person_id, 'str'), + 'persistedFaceId': self._serialize.url("persisted_face_id", persisted_face_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PersistedFace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'} + + def update_face( + self, large_person_group_id, person_id, persisted_face_id, user_data=None, custom_headers=None, raw=False, **operation_config): + """Update a person persisted face's userData field. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param person_id: Id referencing a particular person. + :type person_id: str + :param persisted_face_id: Id referencing a particular persistedFaceId + of an existing face. + :type persisted_face_id: str + :param user_data: User-provided data attached to the face. The size + limit is 1KB. + :type user_data: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + body = models.UpdateFaceRequest(user_data=user_data) + + # Construct URL + url = self.update_face.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'personId': self._serialize.url("person_id", person_id, 'str'), + 'persistedFaceId': self._serialize.url("persisted_face_id", persisted_face_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(body, 'UpdateFaceRequest') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + update_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'} + + def add_person_face_from_url( + self, large_person_group_id, person_id, url, user_data=None, target_face=None, custom_headers=None, raw=False, **operation_config): + """Add a representative face to a person for identification. The input + face is specified as an image with a targetFace rectangle. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param person_id: Id referencing a particular person. + :type person_id: str + :param url: Publicly reachable URL of an image + :type url: str + :param user_data: User-specified data about the face for any purpose. + The maximum length is 1KB. + :type user_data: str + :param 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. + :type target_face: list[int] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PersistedFace or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.PersistedFace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + image_url = models.ImageUrl(url=url) + + # Construct URL + url = self.add_person_face_from_url.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'personId': self._serialize.url("person_id", person_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if user_data is not None: + query_parameters['userData'] = self._serialize.query("user_data", user_data, 'str', max_length=1024) + if target_face is not None: + query_parameters['targetFace'] = self._serialize.query("target_face", target_face, '[int]', div=',') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(image_url, 'ImageUrl') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PersistedFace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_person_face_from_url.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces'} + + def add_person_face_from_stream( + self, large_person_group_id, person_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): + """Add a representative face to a person for identification. The input + face is specified as an image with a targetFace rectangle. + + :param large_person_group_id: Id referencing a particular large person + group. + :type large_person_group_id: str + :param person_id: Id referencing a particular person. + :type person_id: str + :param image: An image stream. + :type image: Generator + :param user_data: User-specified data about the face for any purpose. + The maximum length is 1KB. + :type user_data: str + :param 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. + :type target_face: list[int] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param callback: 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. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PersistedFace or ClientRawResponse if raw=true + :rtype: ~azure.cognitiveservices.vision.face.models.PersistedFace or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.add_person_face_from_stream.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), + 'personId': self._serialize.url("person_id", person_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if user_data is not None: + query_parameters['userData'] = self._serialize.query("user_data", user_data, 'str', max_length=1024) + if target_face is not None: + query_parameters['targetFace'] = self._serialize.query("target_face", target_face, '[int]', div=',') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/octet-stream' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._client.stream_upload(image, callback) + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('PersistedFace', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + add_person_face_from_stream.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces'} 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 a659bfdee8c2..aa609082f5de 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 @@ -90,8 +90,8 @@ def create( def delete( self, person_group_id, custom_headers=None, raw=False, **operation_config): - """Delete an existing person group. Persisted face images of all people in - the person group will also be deleted. + """Delete an existing person group. Persisted face features of all people + in the person group will also be deleted. :param person_group_id: Id referencing a particular person group. :type person_group_id: str diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py index 66d9fc968167..5552a1a723ed 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py @@ -163,8 +163,8 @@ def list( def delete( self, person_group_id, person_id, custom_headers=None, raw=False, **operation_config): - """Delete an existing person from a person group. Persisted face images of - the person will also be deleted. + """Delete an existing person from a person group. All stored person data, + and face features in the person entry will be deleted. :param person_group_id: Id referencing a particular person group. :type person_group_id: str @@ -325,8 +325,8 @@ def update( def delete_face( self, person_group_id, person_id, persisted_face_id, custom_headers=None, raw=False, **operation_config): - """Delete a face from a person. Relative image for the persisted face will - also be deleted. + """Delete a face from a person. Relative feature for the persisted face + will also be deleted. :param person_group_id: Id referencing a particular person group. :type person_group_id: str @@ -460,7 +460,7 @@ def update_face( :raises: :class:`APIErrorException` """ - body = models.UpdatePersonFaceRequest(user_data=user_data) + body = models.UpdateFaceRequest(user_data=user_data) # Construct URL url = self.update_face.metadata['url'] @@ -482,7 +482,7 @@ def update_face( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body, 'UpdatePersonFaceRequest') + body_content = self._serialize.body(body, 'UpdateFaceRequest') # Construct and send request request = self._client.patch(url, query_parameters, header_parameters, body_content) From ca8b8196b3c09b581f68ea064b57c720dfde3e9e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 31 Jul 2018 06:58:32 +0000 Subject: [PATCH 2/5] Generated from a2c9e881121ab738c6142713fd66d08629b7a475 Nit path case refinement. --- .../vision/face/operations/face_list_operations.py | 6 +++--- .../face/operations/large_face_list_face_operations.py | 2 +- .../face/operations/large_face_list_operations.py | 10 +++++----- .../operations/large_person_group_person_operations.py | 10 +++++----- .../face/operations/person_group_person_operations.py | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) 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 566edd5cb6a9..83c7165e7625 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 @@ -339,7 +339,7 @@ def delete_face( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - delete_face.metadata = {'url': '/facelists/{faceListId}/persistedFaces/{persistedFaceId}'} + delete_face.metadata = {'url': '/facelists/{faceListId}/persistedfaces/{persistedFaceId}'} def add_face_from_url( self, face_list_id, url, user_data=None, target_face=None, custom_headers=None, raw=False, **operation_config): @@ -415,7 +415,7 @@ def add_face_from_url( return client_raw_response return deserialized - add_face_from_url.metadata = {'url': '/facelists/{faceListId}/persistedFaces'} + add_face_from_url.metadata = {'url': '/facelists/{faceListId}/persistedfaces'} def add_face_from_stream( self, face_list_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): @@ -494,4 +494,4 @@ def add_face_from_stream( return client_raw_response return deserialized - add_face_from_stream.metadata = {'url': '/facelists/{faceListId}/persistedFaces'} + add_face_from_stream.metadata = {'url': '/facelists/{faceListId}/persistedfaces'} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py index 7666fd768424..28991a025830 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py @@ -98,4 +98,4 @@ def list( return client_raw_response return deserialized - list.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces'} + list.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedfaces'} 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 be9123b5fe95..f123345f0215 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 @@ -446,7 +446,7 @@ def delete_face( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - delete_face.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}'} + delete_face.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}'} def get_face( self, large_face_list_id, persisted_face_id, custom_headers=None, raw=False, **operation_config): @@ -505,7 +505,7 @@ def get_face( return client_raw_response return deserialized - get_face.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}'} + get_face.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}'} def update_face( self, large_face_list_id, persisted_face_id, user_data=None, custom_headers=None, raw=False, **operation_config): @@ -563,7 +563,7 @@ def update_face( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - update_face.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces/{persistedFaceId}'} + update_face.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}'} def add_face_from_url( self, large_face_list_id, url, user_data=None, target_face=None, custom_headers=None, raw=False, **operation_config): @@ -640,7 +640,7 @@ def add_face_from_url( return client_raw_response return deserialized - add_face_from_url.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces'} + add_face_from_url.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedfaces'} def add_face_from_stream( self, large_face_list_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): @@ -720,4 +720,4 @@ def add_face_from_stream( return client_raw_response return deserialized - add_face_from_stream.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedFaces'} + add_face_from_stream.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedfaces'} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py index c14a8f809941..be7db6d0fdd1 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py @@ -379,7 +379,7 @@ def delete_face( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - delete_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'} + delete_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'} def get_face( self, large_person_group_id, person_id, persisted_face_id, custom_headers=None, raw=False, **operation_config): @@ -441,7 +441,7 @@ def get_face( return client_raw_response return deserialized - get_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'} + get_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'} def update_face( self, large_person_group_id, person_id, persisted_face_id, user_data=None, custom_headers=None, raw=False, **operation_config): @@ -502,7 +502,7 @@ def update_face( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - update_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'} + update_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'} def add_person_face_from_url( self, large_person_group_id, person_id, url, user_data=None, target_face=None, custom_headers=None, raw=False, **operation_config): @@ -581,7 +581,7 @@ def add_person_face_from_url( return client_raw_response return deserialized - add_person_face_from_url.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces'} + add_person_face_from_url.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces'} def add_person_face_from_stream( self, large_person_group_id, person_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): @@ -663,4 +663,4 @@ def add_person_face_from_stream( return client_raw_response return deserialized - add_person_face_from_stream.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedFaces'} + add_person_face_from_stream.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces'} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py index 5552a1a723ed..d1f27158f1ab 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py @@ -373,7 +373,7 @@ def delete_face( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - delete_face.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'} + delete_face.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'} def get_face( self, person_group_id, person_id, persisted_face_id, custom_headers=None, raw=False, **operation_config): @@ -434,7 +434,7 @@ def get_face( return client_raw_response return deserialized - get_face.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'} + get_face.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'} def update_face( self, person_group_id, person_id, persisted_face_id, user_data=None, custom_headers=None, raw=False, **operation_config): @@ -494,7 +494,7 @@ def update_face( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response - update_face.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedFaces/{persistedFaceId}'} + update_face.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'} def add_person_face_from_url( self, person_group_id, person_id, url, user_data=None, target_face=None, custom_headers=None, raw=False, **operation_config): @@ -572,7 +572,7 @@ def add_person_face_from_url( return client_raw_response return deserialized - add_person_face_from_url.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedFaces'} + add_person_face_from_url.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces'} def add_person_face_from_stream( self, person_group_id, person_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): @@ -653,4 +653,4 @@ def add_person_face_from_stream( return client_raw_response return deserialized - add_person_face_from_stream.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedFaces'} + add_person_face_from_stream.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces'} From aa3fae699092a2bcfdd7e0c337488c6207abc4ba Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 1 Aug 2018 00:53:58 +0000 Subject: [PATCH 3/5] Generated from 40abfc7205d1bf373e19dca40394598fa9da4843 Fix LargeFaceListFace_List to LargeFaceList_ListFaces and refine example naming. --- .../vision/face/face_client.py | 5 - .../vision/face/operations/__init__.py | 2 - .../large_face_list_face_operations.py | 101 ------------------ .../operations/large_face_list_operations.py | 67 ++++++++++++ 4 files changed, 67 insertions(+), 108 deletions(-) delete mode 100644 azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/face_client.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/face_client.py index bdeff1d449e4..024f0fdac4c5 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/face_client.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/face_client.py @@ -19,7 +19,6 @@ from .operations.large_person_group_person_operations import LargePersonGroupPersonOperations from .operations.large_person_group_operations import LargePersonGroupOperations from .operations.large_face_list_operations import LargeFaceListOperations -from .operations.large_face_list_face_operations import LargeFaceListFaceOperations from . import models @@ -73,8 +72,6 @@ class FaceClient(SDKClient): :vartype large_person_group: azure.cognitiveservices.vision.face.operations.LargePersonGroupOperations :ivar large_face_list: LargeFaceList operations :vartype large_face_list: azure.cognitiveservices.vision.face.operations.LargeFaceListOperations - :ivar large_face_list_face: LargeFaceListFace operations - :vartype large_face_list_face: azure.cognitiveservices.vision.face.operations.LargeFaceListFaceOperations :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). @@ -109,5 +106,3 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.large_face_list = LargeFaceListOperations( self._client, self.config, self._serialize, self._deserialize) - self.large_face_list_face = LargeFaceListFaceOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/__init__.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/__init__.py index 59a70636caef..2e9a921167c3 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/__init__.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/__init__.py @@ -16,7 +16,6 @@ from .large_person_group_person_operations import LargePersonGroupPersonOperations from .large_person_group_operations import LargePersonGroupOperations from .large_face_list_operations import LargeFaceListOperations -from .large_face_list_face_operations import LargeFaceListFaceOperations __all__ = [ 'FaceOperations', @@ -26,5 +25,4 @@ 'LargePersonGroupPersonOperations', 'LargePersonGroupOperations', 'LargeFaceListOperations', - 'LargeFaceListFaceOperations', ] diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py deleted file mode 100644 index 28991a025830..000000000000 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_face_list_face_operations.py +++ /dev/null @@ -1,101 +0,0 @@ -# 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 msrest.pipeline import ClientRawResponse - -from .. import models - - -class LargeFaceListFaceOperations(object): - """LargeFaceListFaceOperations operations. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - - self.config = config - - def list( - self, large_face_list_id, start=None, top=None, custom_headers=None, raw=False, **operation_config): - """List all faces in a large face list, and retrieve face information - (including userData and persistedFaceIds of registered faces of the - face). - - :param large_face_list_id: Id referencing a particular large face - list. - :type large_face_list_id: str - :param start: Starting face id to return (used to list a range of - faces). - :type start: str - :param top: Number of faces to return starting with the face id - indicated by the 'start' parameter. - :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: - list[~azure.cognitiveservices.vision.face.models.PersistedFace] or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`APIErrorException` - """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if start is not None: - query_parameters['start'] = self._serialize.query("start", start, 'str') - if top is not None: - query_parameters['top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if custom_headers: - header_parameters.update(custom_headers) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - raise models.APIErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('[PersistedFace]', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - list.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedfaces'} 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 f123345f0215..02ce62b39fb9 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 @@ -642,6 +642,73 @@ def add_face_from_url( return deserialized add_face_from_url.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedfaces'} + def list_faces( + self, large_face_list_id, start=None, top=None, custom_headers=None, raw=False, **operation_config): + """List all faces in a large face list, and retrieve face information + (including userData and persistedFaceIds of registered faces of the + face). + + :param large_face_list_id: Id referencing a particular large face + list. + :type large_face_list_id: str + :param start: Starting face id to return (used to list a range of + faces). + :type start: str + :param top: Number of faces to return starting with the face id + indicated by the 'start' parameter. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: list or ClientRawResponse if raw=true + :rtype: + list[~azure.cognitiveservices.vision.face.models.PersistedFace] or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`APIErrorException` + """ + # Construct URL + url = self.list_faces.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'largeFaceListId': self._serialize.url("large_face_list_id", large_face_list_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if start is not None: + query_parameters['start'] = self._serialize.query("start", start, 'str') + if top is not None: + query_parameters['top'] = self._serialize.query("top", top, 'int', maximum=1000, minimum=1) + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.APIErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('[PersistedFace]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_faces.metadata = {'url': '/largefacelists/{largeFaceListId}/persistedfaces'} + def add_face_from_stream( self, large_face_list_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): """Add a face to a large face list. The input face is specified as an From 67ae5a4e03e2e9d2422a942766e2596986709408 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 1 Aug 2018 08:15:35 +0000 Subject: [PATCH 4/5] Generated from 6019c551df19f24b8a70a2c9d8f691b43cf7f195 [Minor] Person_AddPersonFace to Person_AddFace. --- .../face/operations/large_person_group_person_operations.py | 6 +++--- .../face/operations/person_group_person_operations.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py index be7db6d0fdd1..ce7ad07945eb 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py @@ -504,7 +504,7 @@ def update_face( return client_raw_response update_face.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'} - def add_person_face_from_url( + def add_face_from_url( self, large_person_group_id, person_id, url, user_data=None, target_face=None, custom_headers=None, raw=False, **operation_config): """Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -539,7 +539,7 @@ def add_person_face_from_url( image_url = models.ImageUrl(url=url) # Construct URL - url = self.add_person_face_from_url.metadata['url'] + url = self.add_face_from_url.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), @@ -581,7 +581,7 @@ def add_person_face_from_url( return client_raw_response return deserialized - add_person_face_from_url.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces'} + add_face_from_url.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces'} def add_person_face_from_stream( self, large_person_group_id, person_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py index d1f27158f1ab..bd462bde2f5e 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py @@ -496,7 +496,7 @@ def update_face( return client_raw_response update_face.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces/{persistedFaceId}'} - def add_person_face_from_url( + def add_face_from_url( self, person_group_id, person_id, url, user_data=None, target_face=None, custom_headers=None, raw=False, **operation_config): """Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -530,7 +530,7 @@ def add_person_face_from_url( image_url = models.ImageUrl(url=url) # Construct URL - url = self.add_person_face_from_url.metadata['url'] + url = self.add_face_from_url.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'personGroupId': self._serialize.url("person_group_id", person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), @@ -572,7 +572,7 @@ def add_person_face_from_url( return client_raw_response return deserialized - add_person_face_from_url.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces'} + add_face_from_url.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces'} def add_person_face_from_stream( self, person_group_id, person_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): From d4c7bda37750c89d6889392e1bf316a1877e90e5 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 1 Aug 2018 08:20:33 +0000 Subject: [PATCH 5/5] Generated from a43b96d1f8ebea7d96449c4fa459519b0c48335e [Minor] Amend last commit of Person_AddPersonFace to Person_AddFace. --- .../face/operations/large_person_group_person_operations.py | 6 +++--- .../face/operations/person_group_person_operations.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py index ce7ad07945eb..a970a9ff50ae 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/large_person_group_person_operations.py @@ -583,7 +583,7 @@ def add_face_from_url( return deserialized add_face_from_url.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces'} - def add_person_face_from_stream( + def add_face_from_stream( self, large_person_group_id, person_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): """Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -621,7 +621,7 @@ def add_person_face_from_stream( :class:`APIErrorException` """ # Construct URL - url = self.add_person_face_from_stream.metadata['url'] + url = self.add_face_from_stream.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'largePersonGroupId': self._serialize.url("large_person_group_id", large_person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), @@ -663,4 +663,4 @@ def add_person_face_from_stream( return client_raw_response return deserialized - add_person_face_from_stream.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces'} + add_face_from_stream.metadata = {'url': '/largepersongroups/{largePersonGroupId}/persons/{personId}/persistedfaces'} diff --git a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py index bd462bde2f5e..8458ff94102d 100644 --- a/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py +++ b/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/person_group_person_operations.py @@ -574,7 +574,7 @@ def add_face_from_url( return deserialized add_face_from_url.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces'} - def add_person_face_from_stream( + def add_face_from_stream( self, person_group_id, person_id, image, user_data=None, target_face=None, custom_headers=None, raw=False, callback=None, **operation_config): """Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @@ -611,7 +611,7 @@ def add_person_face_from_stream( :class:`APIErrorException` """ # Construct URL - url = self.add_person_face_from_stream.metadata['url'] + url = self.add_face_from_stream.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'personGroupId': self._serialize.url("person_group_id", person_group_id, 'str', max_length=64, pattern=r'^[a-z0-9-_]+$'), @@ -653,4 +653,4 @@ def add_person_face_from_stream( return client_raw_response return deserialized - add_person_face_from_stream.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces'} + add_face_from_stream.metadata = {'url': '/persongroups/{personGroupId}/persons/{personId}/persistedfaces'}