diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/CHANGELOG.md index 8f7c18458b6d..fdde4b069607 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/CHANGELOG.md @@ -1,6 +1,17 @@ # Release History -## 0.5.0 (2020-03-12) +## 0.6.0 (2021-12-02) + +**Features** + + - Add support for Face Recognition Quality Score. + +**Breaking changes** + + - Various operations that previously accepted an optional name parameter + are now required. + +## 0.5.0 (2021-03-12) **Features** diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/__init__.py index 0260537a02bb..69e3be50dac4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/__init__.py index 0260537a02bb..69e3be50dac4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/__init__.py index 0260537a02bb..69e3be50dac4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/_face_client.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/_face_client.py index 9851fabc3df8..3325cd82e506 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/_face_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/_face_client.py @@ -64,7 +64,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self.api_version = '1.0' self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.face = FaceOperations( diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/__init__.py index 0bdbfd9bd9e4..ac2026362b45 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/__init__.py @@ -114,6 +114,7 @@ MaskType, NoiseLevel, OperationStatusType, + QualityForRecognition, RecognitionModel, SnapshotApplyMode, SnapshotObjectType, @@ -175,6 +176,7 @@ 'ExposureLevel', 'NoiseLevel', 'MaskType', + 'QualityForRecognition', 'FindSimilarMatchMode', 'TrainingStatusType', 'SnapshotApplyMode', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_face_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_face_client_enums.py index 6c78c7d43830..a4e22cdcb640 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_face_client_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_face_client_enums.py @@ -82,6 +82,13 @@ class MaskType(str, Enum): uncertain = "uncertain" +class QualityForRecognition(str, Enum): + + low = "Low" + medium = "Medium" + high = "High" + + class FindSimilarMatchMode(str, Enum): match_person = "matchPerson" @@ -134,6 +141,7 @@ class FaceAttributeType(str, Enum): exposure = "exposure" noise = "noise" mask = "mask" + quality_for_recognition = "qualityForRecognition" class DetectionModel(str, Enum): diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_models.py index 4f1d3b0ec20f..15d076c4bafa 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_models.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_models.py @@ -52,7 +52,7 @@ def __init__(self, **kwargs): class APIErrorException(HttpOperationError): - """Server responded with exception of type: 'APIError'. + """Server responsed with exception of type: 'APIError'. :param deserialize: A deserializer :param response: Server response to be deserialized. @@ -82,7 +82,7 @@ class ApplySnapshotRequest(Model): """ _validation = { - 'object_id': {'required': True}, + 'object_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -317,6 +317,12 @@ class FaceAttributes(Model): :type noise: ~azure.cognitiveservices.vision.face.models.Noise :param mask: Properties describing the presence of a mask on a given face. :type mask: ~azure.cognitiveservices.vision.face.models.Mask + :param quality_for_recognition: Properties describing the overall image + quality regarding whether the image being used in the detection is of + sufficient quality to attempt face recognition on. Possible values + include: 'Low', 'Medium', 'High' + :type quality_for_recognition: str or + ~azure.cognitiveservices.vision.face.models.QualityForRecognition """ _attribute_map = { @@ -335,6 +341,7 @@ class FaceAttributes(Model): 'exposure': {'key': 'exposure', 'type': 'Exposure'}, 'noise': {'key': 'noise', 'type': 'Noise'}, 'mask': {'key': 'mask', 'type': 'Mask'}, + 'quality_for_recognition': {'key': 'qualityForRecognition', 'type': 'QualityForRecognition'}, } def __init__(self, **kwargs): @@ -354,6 +361,7 @@ def __init__(self, **kwargs): self.exposure = kwargs.get('exposure', None) self.noise = kwargs.get('noise', None) self.mask = kwargs.get('mask', None) + self.quality_for_recognition = kwargs.get('quality_for_recognition', None) class FaceLandmarks(Model): @@ -498,32 +506,41 @@ def __init__(self, **kwargs): self.under_lip_bottom = kwargs.get('under_lip_bottom', None) -class NameAndUserDataContract(Model): +class NonNullableNameAndNullableUserDataContract(Model): """A combination of user defined name and user specified data for the person, largePersonGroup/personGroup, and largeFaceList/faceList. - :param name: User defined name, maximum length is 128. + All required parameters must be populated in order to send to Azure. + + :param name: Required. 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 """ + _validation = { + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, } def __init__(self, **kwargs): - super(NameAndUserDataContract, self).__init__(**kwargs) + super(NonNullableNameAndNullableUserDataContract, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.user_data = kwargs.get('user_data', None) -class MetaDataContract(NameAndUserDataContract): +class MetaDataContract(NonNullableNameAndNullableUserDataContract): """A combination of user defined name and user specified data and recognition model name for largePersonGroup/personGroup, and largeFaceList/faceList. - :param name: User defined name, maximum length is 128. + All required parameters must be populated in order to send to Azure. + + :param name: Required. 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 @@ -534,6 +551,11 @@ class MetaDataContract(NameAndUserDataContract): ~azure.cognitiveservices.vision.face.models.RecognitionModel """ + _validation = { + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, @@ -550,7 +572,7 @@ class FaceList(MetaDataContract): All required parameters must be populated in order to send to Azure. - :param name: User defined name, maximum length is 128. + :param name: Required. 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 @@ -567,7 +589,9 @@ class FaceList(MetaDataContract): """ _validation = { - 'face_list_id': {'required': True}, + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + 'face_list_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -687,6 +711,9 @@ 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}, } @@ -720,7 +747,7 @@ class GroupRequest(Model): """ _validation = { - 'face_ids': {'required': True}, + 'face_ids': {'required': True, 'max_items': 1000}, } _attribute_map = { @@ -882,7 +909,7 @@ class IdentifyRequest(Model): 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 + maxNumOfCandidatesReturned is between 1 and 100 (default is 1). Default value: 1 . :type max_num_of_candidates_returned: int :param confidence_threshold: Confidence threshold of identification, used @@ -892,8 +919,10 @@ class IdentifyRequest(Model): """ _validation = { - 'face_ids': {'required': True}, - 'max_num_of_candidates_returned': {'maximum': 5, 'minimum': 1}, + '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': 100, 'minimum': 1}, } _attribute_map = { @@ -971,7 +1000,7 @@ class LargeFaceList(MetaDataContract): All required parameters must be populated in order to send to Azure. - :param name: User defined name, maximum length is 128. + :param name: Required. 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 @@ -986,7 +1015,9 @@ class LargeFaceList(MetaDataContract): """ _validation = { - 'large_face_list_id': {'required': True}, + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + 'large_face_list_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -1006,7 +1037,7 @@ class LargePersonGroup(MetaDataContract): All required parameters must be populated in order to send to Azure. - :param name: User defined name, maximum length is 128. + :param name: Required. 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 @@ -1021,7 +1052,9 @@ class LargePersonGroup(MetaDataContract): """ _validation = { - 'large_person_group_id': {'required': True}, + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + 'large_person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -1080,6 +1113,32 @@ def __init__(self, **kwargs): self.nose_and_mouth_covered = kwargs.get('nose_and_mouth_covered', None) +class NameAndUserDataContract(Model): + """A combination of user defined name and user specified data for the person, + largePersonGroup/personGroup, and largeFaceList/faceList. + + :param name: User defined name, maximum length is 128. + :type name: str + :param user_data: User specified data. Length should not exceed 16KB. + :type user_data: str + """ + + _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'user_data': {'key': 'userData', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(NameAndUserDataContract, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.user_data = kwargs.get('user_data', None) + + class Noise(Model): """Properties describing noise level of the image. @@ -1209,6 +1268,7 @@ class PersistedFace(Model): _validation = { 'persisted_face_id': {'required': True}, + 'user_data': {'max_length': 1024}, } _attribute_map = { @@ -1240,6 +1300,8 @@ class Person(NameAndUserDataContract): """ _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, 'person_id': {'required': True}, } @@ -1261,7 +1323,7 @@ class PersonGroup(MetaDataContract): All required parameters must be populated in order to send to Azure. - :param name: User defined name, maximum length is 128. + :param name: Required. 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 @@ -1276,7 +1338,9 @@ class PersonGroup(MetaDataContract): """ _validation = { - 'person_group_id': {'required': True}, + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + 'person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -1366,6 +1430,7 @@ class Snapshot(Model): 'account': {'required': True}, 'type': {'required': True}, 'apply_scope': {'required': True}, + 'user_data': {'max_length': 16384}, 'created_time': {'required': True}, 'last_update_time': {'required': True}, } @@ -1416,8 +1481,9 @@ class TakeSnapshotRequest(Model): _validation = { 'type': {'required': True}, - 'object_id': {'required': True}, + 'object_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'apply_scope': {'required': True}, + 'user_data': {'max_length': 16384}, } _attribute_map = { @@ -1498,6 +1564,10 @@ class UpdateFaceRequest(Model): :type user_data: str """ + _validation = { + 'user_data': {'max_length': 1024}, + } + _attribute_map = { 'user_data': {'key': 'userData', 'type': 'str'}, } @@ -1521,6 +1591,10 @@ class UpdateSnapshotRequest(Model): :type user_data: str """ + _validation = { + 'user_data': {'max_length': 16384}, + } + _attribute_map = { 'apply_scope': {'key': 'applyScope', 'type': '[str]'}, 'user_data': {'key': 'userData', 'type': 'str'}, @@ -1586,6 +1660,8 @@ class VerifyFaceToPersonRequest(Model): _validation = { 'face_id': {'required': True}, + '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}, } diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_models_py3.py index e4cdcb10ce7f..d18b37fbdec4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/models/_models_py3.py @@ -52,7 +52,7 @@ def __init__(self, *, error=None, **kwargs) -> None: class APIErrorException(HttpOperationError): - """Server responded with exception of type: 'APIError'. + """Server responsed with exception of type: 'APIError'. :param deserialize: A deserializer :param response: Server response to be deserialized. @@ -82,7 +82,7 @@ class ApplySnapshotRequest(Model): """ _validation = { - 'object_id': {'required': True}, + 'object_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -317,6 +317,12 @@ class FaceAttributes(Model): :type noise: ~azure.cognitiveservices.vision.face.models.Noise :param mask: Properties describing the presence of a mask on a given face. :type mask: ~azure.cognitiveservices.vision.face.models.Mask + :param quality_for_recognition: Properties describing the overall image + quality regarding whether the image being used in the detection is of + sufficient quality to attempt face recognition on. Possible values + include: 'Low', 'Medium', 'High' + :type quality_for_recognition: str or + ~azure.cognitiveservices.vision.face.models.QualityForRecognition """ _attribute_map = { @@ -335,9 +341,10 @@ class FaceAttributes(Model): 'exposure': {'key': 'exposure', 'type': 'Exposure'}, 'noise': {'key': 'noise', 'type': 'Noise'}, 'mask': {'key': 'mask', 'type': 'Mask'}, + 'quality_for_recognition': {'key': 'qualityForRecognition', 'type': 'QualityForRecognition'}, } - def __init__(self, *, age: float=None, gender=None, smile: float=None, facial_hair=None, glasses=None, head_pose=None, emotion=None, hair=None, makeup=None, occlusion=None, accessories=None, blur=None, exposure=None, noise=None, mask=None, **kwargs) -> None: + def __init__(self, *, age: float=None, gender=None, smile: float=None, facial_hair=None, glasses=None, head_pose=None, emotion=None, hair=None, makeup=None, occlusion=None, accessories=None, blur=None, exposure=None, noise=None, mask=None, quality_for_recognition=None, **kwargs) -> None: super(FaceAttributes, self).__init__(**kwargs) self.age = age self.gender = gender @@ -354,6 +361,7 @@ def __init__(self, *, age: float=None, gender=None, smile: float=None, facial_ha self.exposure = exposure self.noise = noise self.mask = mask + self.quality_for_recognition = quality_for_recognition class FaceLandmarks(Model): @@ -498,32 +506,41 @@ def __init__(self, *, pupil_left=None, pupil_right=None, nose_tip=None, mouth_le self.under_lip_bottom = under_lip_bottom -class NameAndUserDataContract(Model): +class NonNullableNameAndNullableUserDataContract(Model): """A combination of user defined name and user specified data for the person, largePersonGroup/personGroup, and largeFaceList/faceList. - :param name: User defined name, maximum length is 128. + All required parameters must be populated in order to send to Azure. + + :param name: Required. 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 """ + _validation = { + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, } - def __init__(self, *, name: str=None, user_data: str=None, **kwargs) -> None: - super(NameAndUserDataContract, self).__init__(**kwargs) + def __init__(self, *, name: str, user_data: str=None, **kwargs) -> None: + super(NonNullableNameAndNullableUserDataContract, self).__init__(**kwargs) self.name = name self.user_data = user_data -class MetaDataContract(NameAndUserDataContract): +class MetaDataContract(NonNullableNameAndNullableUserDataContract): """A combination of user defined name and user specified data and recognition model name for largePersonGroup/personGroup, and largeFaceList/faceList. - :param name: User defined name, maximum length is 128. + All required parameters must be populated in order to send to Azure. + + :param name: Required. 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 @@ -534,13 +551,18 @@ class MetaDataContract(NameAndUserDataContract): ~azure.cognitiveservices.vision.face.models.RecognitionModel """ + _validation = { + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_data': {'key': 'userData', 'type': 'str'}, 'recognition_model': {'key': 'recognitionModel', 'type': 'str'}, } - def __init__(self, *, name: str=None, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: + def __init__(self, *, name: str, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: super(MetaDataContract, self).__init__(name=name, user_data=user_data, **kwargs) self.recognition_model = recognition_model @@ -550,7 +572,7 @@ class FaceList(MetaDataContract): All required parameters must be populated in order to send to Azure. - :param name: User defined name, maximum length is 128. + :param name: Required. 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 @@ -567,7 +589,9 @@ class FaceList(MetaDataContract): """ _validation = { - 'face_list_id': {'required': True}, + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + 'face_list_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -578,7 +602,7 @@ class FaceList(MetaDataContract): 'persisted_faces': {'key': 'persistedFaces', 'type': '[PersistedFace]'}, } - def __init__(self, *, face_list_id: str, name: str=None, user_data: str=None, recognition_model="recognition_01", persisted_faces=None, **kwargs) -> None: + def __init__(self, *, name: str, face_list_id: str, user_data: str=None, recognition_model="recognition_01", persisted_faces=None, **kwargs) -> None: super(FaceList, self).__init__(name=name, user_data=user_data, recognition_model=recognition_model, **kwargs) self.face_list_id = face_list_id self.persisted_faces = persisted_faces @@ -687,6 +711,9 @@ 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}, } @@ -720,7 +747,7 @@ class GroupRequest(Model): """ _validation = { - 'face_ids': {'required': True}, + 'face_ids': {'required': True, 'max_items': 1000}, } _attribute_map = { @@ -882,7 +909,7 @@ class IdentifyRequest(Model): 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 + maxNumOfCandidatesReturned is between 1 and 100 (default is 1). Default value: 1 . :type max_num_of_candidates_returned: int :param confidence_threshold: Confidence threshold of identification, used @@ -892,8 +919,10 @@ class IdentifyRequest(Model): """ _validation = { - 'face_ids': {'required': True}, - 'max_num_of_candidates_returned': {'maximum': 5, 'minimum': 1}, + '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': 100, 'minimum': 1}, } _attribute_map = { @@ -971,7 +1000,7 @@ class LargeFaceList(MetaDataContract): All required parameters must be populated in order to send to Azure. - :param name: User defined name, maximum length is 128. + :param name: Required. 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 @@ -986,7 +1015,9 @@ class LargeFaceList(MetaDataContract): """ _validation = { - 'large_face_list_id': {'required': True}, + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + 'large_face_list_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -996,7 +1027,7 @@ class LargeFaceList(MetaDataContract): 'large_face_list_id': {'key': 'largeFaceListId', 'type': 'str'}, } - def __init__(self, *, large_face_list_id: str, name: str=None, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: + def __init__(self, *, name: str, large_face_list_id: str, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: super(LargeFaceList, self).__init__(name=name, user_data=user_data, recognition_model=recognition_model, **kwargs) self.large_face_list_id = large_face_list_id @@ -1006,7 +1037,7 @@ class LargePersonGroup(MetaDataContract): All required parameters must be populated in order to send to Azure. - :param name: User defined name, maximum length is 128. + :param name: Required. 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 @@ -1021,7 +1052,9 @@ class LargePersonGroup(MetaDataContract): """ _validation = { - 'large_person_group_id': {'required': True}, + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + 'large_person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -1031,7 +1064,7 @@ class LargePersonGroup(MetaDataContract): 'large_person_group_id': {'key': 'largePersonGroupId', 'type': 'str'}, } - def __init__(self, *, large_person_group_id: str, name: str=None, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: + def __init__(self, *, name: str, large_person_group_id: str, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: super(LargePersonGroup, self).__init__(name=name, user_data=user_data, recognition_model=recognition_model, **kwargs) self.large_person_group_id = large_person_group_id @@ -1080,6 +1113,32 @@ def __init__(self, *, type=None, nose_and_mouth_covered: bool=None, **kwargs) -> self.nose_and_mouth_covered = nose_and_mouth_covered +class NameAndUserDataContract(Model): + """A combination of user defined name and user specified data for the person, + largePersonGroup/personGroup, and largeFaceList/faceList. + + :param name: User defined name, maximum length is 128. + :type name: str + :param user_data: User specified data. Length should not exceed 16KB. + :type user_data: str + """ + + _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'user_data': {'key': 'userData', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, user_data: str=None, **kwargs) -> None: + super(NameAndUserDataContract, self).__init__(**kwargs) + self.name = name + self.user_data = user_data + + class Noise(Model): """Properties describing noise level of the image. @@ -1209,6 +1268,7 @@ class PersistedFace(Model): _validation = { 'persisted_face_id': {'required': True}, + 'user_data': {'max_length': 1024}, } _attribute_map = { @@ -1240,6 +1300,8 @@ class Person(NameAndUserDataContract): """ _validation = { + 'name': {'max_length': 128}, + 'user_data': {'max_length': 16384}, 'person_id': {'required': True}, } @@ -1261,7 +1323,7 @@ class PersonGroup(MetaDataContract): All required parameters must be populated in order to send to Azure. - :param name: User defined name, maximum length is 128. + :param name: Required. 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 @@ -1276,7 +1338,9 @@ class PersonGroup(MetaDataContract): """ _validation = { - 'person_group_id': {'required': True}, + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'user_data': {'max_length': 16384}, + 'person_group_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, } _attribute_map = { @@ -1286,7 +1350,7 @@ class PersonGroup(MetaDataContract): 'person_group_id': {'key': 'personGroupId', 'type': 'str'}, } - def __init__(self, *, person_group_id: str, name: str=None, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: + def __init__(self, *, name: str, person_group_id: str, user_data: str=None, recognition_model="recognition_01", **kwargs) -> None: super(PersonGroup, self).__init__(name=name, user_data=user_data, recognition_model=recognition_model, **kwargs) self.person_group_id = person_group_id @@ -1366,6 +1430,7 @@ class Snapshot(Model): 'account': {'required': True}, 'type': {'required': True}, 'apply_scope': {'required': True}, + 'user_data': {'max_length': 16384}, 'created_time': {'required': True}, 'last_update_time': {'required': True}, } @@ -1416,8 +1481,9 @@ class TakeSnapshotRequest(Model): _validation = { 'type': {'required': True}, - 'object_id': {'required': True}, + 'object_id': {'required': True, 'max_length': 64, 'pattern': r'^[a-z0-9-_]+$'}, 'apply_scope': {'required': True}, + 'user_data': {'max_length': 16384}, } _attribute_map = { @@ -1498,6 +1564,10 @@ class UpdateFaceRequest(Model): :type user_data: str """ + _validation = { + 'user_data': {'max_length': 1024}, + } + _attribute_map = { 'user_data': {'key': 'userData', 'type': 'str'}, } @@ -1521,6 +1591,10 @@ class UpdateSnapshotRequest(Model): :type user_data: str """ + _validation = { + 'user_data': {'max_length': 16384}, + } + _attribute_map = { 'apply_scope': {'key': 'applyScope', 'type': '[str]'}, 'user_data': {'key': 'userData', 'type': 'str'}, @@ -1586,6 +1660,8 @@ class VerifyFaceToPersonRequest(Model): _validation = { 'face_id': {'required': True}, + '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}, } diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_face_list_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_face_list_operations.py index 0d6e7db263ed..81ea454e9a5a 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_face_list_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_face_list_operations.py @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def create( - self, face_list_id, name=None, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): + self, face_list_id, name, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): """Create an empty face list with user-specified faceListId, name, an optional userData and recognitionModel. Up to 64 face lists are allowed in one subscription. diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_face_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_face_operations.py index 41bf8d917e00..88e0e1b689af 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_face_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_face_operations.py @@ -268,7 +268,7 @@ def identify( 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). + maxNumOfCandidatesReturned is between 1 and 100 (default is 1). :type max_num_of_candidates_returned: int :param confidence_threshold: Confidence threshold of identification, used to judge whether one face belong to one person. The range of @@ -414,8 +414,8 @@ def detect_with_url( * Optional parameters include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, - and mask. Some of the results returned for specific attributes may not - be highly accurate. + mask, and qualityForRecognition. Some of the results returned for + specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for an image. Faces are ranked by @@ -457,10 +457,13 @@ def detect_with_url( "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, - occlusion, accessories, blur, exposure, and noise. While - 'detection_02' does not support any attributes and 'detection_03' only - supports mask. Note that each face attribute analysis has additional - computational and time cost. + occlusion, accessories, blur, exposure, noise, and + qualityForRecognition. While 'detection_02' does not support any + attributes and 'detection_03' only supports mask and + qualityForRecognition. Additionally, qualityForRecognition is only + supported when the 'recognitionModel' is specified as 'recognition_03' + or 'recognition_04'. Note that each face attribute analysis has + additional computational and time cost. :type return_face_attributes: list[str or ~azure.cognitiveservices.vision.face.models.FaceAttributeType] :param recognition_model: Name of recognition model. Recognition model @@ -643,8 +646,8 @@ def detect_with_stream( * Optional parameters include faceId, landmarks, and attributes. Attributes include age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, - and mask. Some of the results returned for specific attributes may not - be highly accurate. + mask, and qualityForRecognition. Some of the results returned for + specific attributes may not be highly accurate. * JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed image file size is from 1KB to 6MB. * Up to 100 faces can be returned for an image. Faces are ranked by @@ -686,10 +689,13 @@ def detect_with_stream( "returnFaceAttributes=age,gender". The available attributes depends on the 'detectionModel' specified. 'detection_01' supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, - occlusion, accessories, blur, exposure, and noise. While - 'detection_02' does not support any attributes and 'detection_03' only - supports mask. Note that each face attribute analysis has additional - computational and time cost. + occlusion, accessories, blur, exposure, noise, and + qualityForRecognition. While 'detection_02' does not support any + attributes and 'detection_03' only supports mask and + qualityForRecognition. Additionally, qualityForRecognition is only + supported when the 'recognitionModel' is specified as 'recognition_03' + or 'recognition_04'. Note that each face attribute analysis has + additional computational and time cost. :type return_face_attributes: list[str or ~azure.cognitiveservices.vision.face.models.FaceAttributeType] :param recognition_model: Name of recognition model. Recognition model diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_large_face_list_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_large_face_list_operations.py index 6342b5b1f709..c00088babc68 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_large_face_list_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_large_face_list_operations.py @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def create( - self, large_face_list_id, name=None, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): + self, large_face_list_id, name, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): """Create an empty large face list with user-specified largeFaceListId, name, an optional userData and recognitionModel.
Large face list is a list of faces, up to 1,000,000 faces, and @@ -342,7 +342,7 @@ def get_training_status( get_training_status.metadata = {'url': '/largefacelists/{largeFaceListId}/training'} def list( - self, return_recognition_model=False, custom_headers=None, raw=False, **operation_config): + self, return_recognition_model=False, start=None, top=None, custom_headers=None, raw=False, **operation_config): """List large face lists’ information of largeFaceListId, name, userData and recognitionModel.
To get face information inside largeFaceList use [LargeFaceList Face - @@ -367,6 +367,12 @@ def list( :param return_recognition_model: A value indicating whether the operation should return 'recognitionModel' in response. :type return_recognition_model: bool + :param start: Starting large face list id to return (used to list a + range of large face lists). + :type start: str + :param top: Number of large face lists to return starting with the + large face list 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 @@ -390,6 +396,10 @@ def list( query_parameters = {} if return_recognition_model is not None: query_parameters['returnRecognitionModel'] = self._serialize.query("return_recognition_model", return_recognition_model, 'bool') + 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 = {} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_large_person_group_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_large_person_group_operations.py index e1c5a238ae9d..cde188815a7d 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_large_person_group_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_large_person_group_operations.py @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def create( - self, large_person_group_id, name=None, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): + self, large_person_group_id, name, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): """Create a new large person group with user-specified largePersonGroupId, name, an optional userData and recognitionModel.
A large person group is the container of the uploaded person diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_person_group_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_person_group_operations.py index 1c911d27dea8..b17aaa35f0c9 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_person_group_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/_person_group_operations.py @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def create( - self, person_group_id, name=None, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): + self, person_group_id, name, user_data=None, recognition_model="recognition_01", custom_headers=None, raw=False, **operation_config): """Create a new person group with specified personGroupId, name, user-provided userData and recognitionModel.
A person group is the container of the uploaded person data, diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/version.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/version.py index 266f5a486d79..901c89378794 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/version.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/version.py @@ -9,5 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.5.0" - +VERSION = "0.6.0"