diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/CHANGELOG.md b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/CHANGELOG.md index bb340557b7f5..6101c87517a0 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/CHANGELOG.md @@ -1,5 +1,35 @@ # Release History +## 3.0.0 (2020-06-22) + +*Training 3.3* + +**Features** + + - Model ImageUrlCreateBatch has a new parameter metadata + - Model ImageIdCreateBatch has a new parameter metadata + - Model Prediction has a new parameter tag_type + - Model ImageFileCreateBatch has a new parameter metadata + - Model Image has a new parameter metadata + - Added operation get_images + - Added operation update_image_metadata + - Added operation get_artifact + - Added operation get_image_count + +**Breaking changes** + + - Operation import_project has a new signature + - Operation publish_iteration has a new signature + - Operation create_images_from_files has a new signature + - Operation create_images_from_urls has a new signature + - Operation create_images_from_predictions has a new signature + +*Prediction 3.1* + +**Features** + + - Model Prediction has a new parameter tag_type + ## 2.0.0 (2020-05-14) **Features** @@ -21,7 +51,7 @@ **Breaking changes** -- Credentials are now longer a simple string, but a `msrest.authentication.ApiKeyCredentials` instance instead +- Credentials are now longer a simple string, but a `msrest.authentication.ApiKeyCredentials` instance instead **General Breaking changes** diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_configuration.py index 17c83361819f..da2695822d5b 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_configuration.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_configuration.py @@ -33,7 +33,7 @@ def __init__( raise ValueError("Parameter 'endpoint' must not be None.") if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") - base_url = '{Endpoint}/customvision/v3.0/prediction' + base_url = '{Endpoint}/customvision/v3.1/prediction' super(CustomVisionPredictionClientConfiguration, self).__init__(base_url) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_custom_vision_prediction_client.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_custom_vision_prediction_client.py index abfb4a51227f..74d0c50ec5cf 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_custom_vision_prediction_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/_custom_vision_prediction_client.py @@ -37,7 +37,7 @@ def __init__( super(CustomVisionPredictionClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '3.0' + self.api_version = '3.1' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/__init__.py index d654981d00aa..3ec9e2927bba 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/__init__.py @@ -23,6 +23,7 @@ from ._models import Prediction from ._custom_vision_prediction_client_enums import ( CustomVisionErrorCodes, + TagType, ) __all__ = [ @@ -32,4 +33,5 @@ 'ImageUrl', 'Prediction', 'CustomVisionErrorCodes', + 'TagType', ] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_custom_vision_prediction_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_custom_vision_prediction_client_enums.py index cf908ce921ee..2282b02c977c 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_custom_vision_prediction_client_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_custom_vision_prediction_client_enums.py @@ -26,10 +26,13 @@ class CustomVisionErrorCodes(str, Enum): bad_request_project_unknown_classification = "BadRequestProjectUnknownClassification" bad_request_project_unsupported_domain_type_change = "BadRequestProjectUnsupportedDomainTypeChange" bad_request_project_unsupported_export_platform = "BadRequestProjectUnsupportedExportPlatform" + bad_request_project_image_preprocessing_settings = "BadRequestProjectImagePreprocessingSettings" + bad_request_project_duplicated = "BadRequestProjectDuplicated" bad_request_iteration_name = "BadRequestIterationName" bad_request_iteration_name_not_unique = "BadRequestIterationNameNotUnique" bad_request_iteration_description = "BadRequestIterationDescription" bad_request_iteration_is_not_trained = "BadRequestIterationIsNotTrained" + bad_request_iteration_validation_failed = "BadRequestIterationValidationFailed" bad_request_workspace_cannot_be_modified = "BadRequestWorkspaceCannotBeModified" bad_request_workspace_not_deletable = "BadRequestWorkspaceNotDeletable" bad_request_tag_name = "BadRequestTagName" @@ -37,14 +40,17 @@ class CustomVisionErrorCodes(str, Enum): bad_request_tag_description = "BadRequestTagDescription" bad_request_tag_type = "BadRequestTagType" bad_request_multiple_negative_tag = "BadRequestMultipleNegativeTag" + bad_request_multiple_general_product_tag = "BadRequestMultipleGeneralProductTag" bad_request_image_tags = "BadRequestImageTags" bad_request_image_regions = "BadRequestImageRegions" bad_request_negative_and_regular_tag_on_same_image = "BadRequestNegativeAndRegularTagOnSameImage" + bad_request_unsupported_domain = "BadRequestUnsupportedDomain" bad_request_required_param_is_null = "BadRequestRequiredParamIsNull" bad_request_iteration_is_published = "BadRequestIterationIsPublished" bad_request_invalid_publish_name = "BadRequestInvalidPublishName" bad_request_invalid_publish_target = "BadRequestInvalidPublishTarget" bad_request_unpublish_failed = "BadRequestUnpublishFailed" + bad_request_iteration_not_published = "BadRequestIterationNotPublished" bad_request_subscription_api = "BadRequestSubscriptionApi" bad_request_exceed_project_limit = "BadRequestExceedProjectLimit" bad_request_exceed_iteration_per_project_limit = "BadRequestExceedIterationPerProjectLimit" @@ -58,6 +64,7 @@ class CustomVisionErrorCodes(str, Enum): bad_request_image_url = "BadRequestImageUrl" bad_request_image_format = "BadRequestImageFormat" bad_request_image_size_bytes = "BadRequestImageSizeBytes" + bad_request_image_dimensions = "BadRequestImageDimensions" bad_request_image_exceeded_count = "BadRequestImageExceededCount" bad_request_training_not_needed = "BadRequestTrainingNotNeeded" bad_request_training_not_needed_but_training_pipeline_updated = "BadRequestTrainingNotNeededButTrainingPipelineUpdated" @@ -80,6 +87,13 @@ class CustomVisionErrorCodes(str, Enum): bad_request_prediction_results_exceeded_count = "BadRequestPredictionResultsExceededCount" bad_request_prediction_invalid_application_name = "BadRequestPredictionInvalidApplicationName" bad_request_prediction_invalid_query_parameters = "BadRequestPredictionInvalidQueryParameters" + bad_request_invalid_import_token = "BadRequestInvalidImportToken" + bad_request_export_while_training = "BadRequestExportWhileTraining" + bad_request_image_metadata_key = "BadRequestImageMetadataKey" + bad_request_image_metadata_value = "BadRequestImageMetadataValue" + bad_request_operation_not_supported = "BadRequestOperationNotSupported" + bad_request_invalid_artifact_uri = "BadRequestInvalidArtifactUri" + bad_request_customer_managed_key_revoked = "BadRequestCustomerManagedKeyRevoked" bad_request_invalid = "BadRequestInvalid" unsupported_media_type = "UnsupportedMediaType" forbidden = "Forbidden" @@ -105,10 +119,13 @@ class CustomVisionErrorCodes(str, Enum): conflict = "Conflict" conflict_invalid = "ConflictInvalid" error_unknown = "ErrorUnknown" + error_iteration_copy_failed = "ErrorIterationCopyFailed" + error_prepare_performance_migration_failed = "ErrorPreparePerformanceMigrationFailed" error_project_invalid_workspace = "ErrorProjectInvalidWorkspace" error_project_invalid_pipeline_configuration = "ErrorProjectInvalidPipelineConfiguration" error_project_invalid_domain = "ErrorProjectInvalidDomain" error_project_training_request_failed = "ErrorProjectTrainingRequestFailed" + error_project_import_request_failed = "ErrorProjectImportRequestFailed" error_project_export_request_failed = "ErrorProjectExportRequestFailed" error_featurization_service_unavailable = "ErrorFeaturizationServiceUnavailable" error_featurization_queue_timeout = "ErrorFeaturizationQueueTimeout" @@ -125,4 +142,12 @@ class CustomVisionErrorCodes(str, Enum): error_prediction = "ErrorPrediction" error_prediction_storage = "ErrorPredictionStorage" error_region_proposal = "ErrorRegionProposal" + error_unknown_base_model = "ErrorUnknownBaseModel" error_invalid = "ErrorInvalid" + + +class TagType(str, Enum): + + regular = "Regular" + negative = "Negative" + general_product = "GeneralProduct" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models.py index 6c4860c8748c..b245eba70734 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models.py @@ -62,25 +62,29 @@ class CustomVisionError(Model): 'BadRequestProjectUnknownDomain', 'BadRequestProjectUnknownClassification', 'BadRequestProjectUnsupportedDomainTypeChange', - 'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName', + 'BadRequestProjectUnsupportedExportPlatform', + 'BadRequestProjectImagePreprocessingSettings', + 'BadRequestProjectDuplicated', 'BadRequestIterationName', 'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription', - 'BadRequestIterationIsNotTrained', 'BadRequestWorkspaceCannotBeModified', - 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName', - 'BadRequestTagNameNotUnique', 'BadRequestTagDescription', - 'BadRequestTagType', 'BadRequestMultipleNegativeTag', + 'BadRequestIterationIsNotTrained', 'BadRequestIterationValidationFailed', + 'BadRequestWorkspaceCannotBeModified', 'BadRequestWorkspaceNotDeletable', + 'BadRequestTagName', 'BadRequestTagNameNotUnique', + 'BadRequestTagDescription', 'BadRequestTagType', + 'BadRequestMultipleNegativeTag', 'BadRequestMultipleGeneralProductTag', 'BadRequestImageTags', 'BadRequestImageRegions', 'BadRequestNegativeAndRegularTagOnSameImage', - 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished', - 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget', - 'BadRequestUnpublishFailed', 'BadRequestSubscriptionApi', + 'BadRequestUnsupportedDomain', 'BadRequestRequiredParamIsNull', + 'BadRequestIterationIsPublished', 'BadRequestInvalidPublishName', + 'BadRequestInvalidPublishTarget', 'BadRequestUnpublishFailed', + 'BadRequestIterationNotPublished', 'BadRequestSubscriptionApi', 'BadRequestExceedProjectLimit', 'BadRequestExceedIterationPerProjectLimit', 'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit', 'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName', 'BadRequestNotLimitedTrial', 'BadRequestImageBatch', 'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat', - 'BadRequestImageSizeBytes', 'BadRequestImageExceededCount', - 'BadRequestTrainingNotNeeded', + 'BadRequestImageSizeBytes', 'BadRequestImageDimensions', + 'BadRequestImageExceededCount', 'BadRequestTrainingNotNeeded', 'BadRequestTrainingNotNeededButTrainingPipelineUpdated', 'BadRequestTrainingValidationFailed', 'BadRequestClassificationTrainingValidationFailed', @@ -98,7 +102,11 @@ class CustomVisionError(Model): 'BadRequestPredictionTagsExceededCount', 'BadRequestPredictionResultsExceededCount', 'BadRequestPredictionInvalidApplicationName', - 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid', + 'BadRequestPredictionInvalidQueryParameters', + 'BadRequestInvalidImportToken', 'BadRequestExportWhileTraining', + 'BadRequestImageMetadataKey', 'BadRequestImageMetadataValue', + 'BadRequestOperationNotSupported', 'BadRequestInvalidArtifactUri', + 'BadRequestCustomerManagedKeyRevoked', 'BadRequestInvalid', 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled', 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist', @@ -107,19 +115,20 @@ class CustomVisionError(Model): 'NotFoundProject', 'NotFoundProjectDefaultIteration', 'NotFoundIteration', 'NotFoundIterationPerformance', 'NotFoundTag', 'NotFoundImage', 'NotFoundDomain', 'NotFoundApimSubscription', 'NotFoundInvalid', - 'Conflict', 'ConflictInvalid', 'ErrorUnknown', - 'ErrorProjectInvalidWorkspace', + 'Conflict', 'ConflictInvalid', 'ErrorUnknown', 'ErrorIterationCopyFailed', + 'ErrorPreparePerformanceMigrationFailed', 'ErrorProjectInvalidWorkspace', 'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain', - 'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed', - 'ErrorFeaturizationServiceUnavailable', 'ErrorFeaturizationQueueTimeout', - 'ErrorFeaturizationInvalidFeaturizer', + 'ErrorProjectTrainingRequestFailed', 'ErrorProjectImportRequestFailed', + 'ErrorProjectExportRequestFailed', 'ErrorFeaturizationServiceUnavailable', + 'ErrorFeaturizationQueueTimeout', 'ErrorFeaturizationInvalidFeaturizer', 'ErrorFeaturizationAugmentationUnavailable', 'ErrorFeaturizationUnrecognizedJob', 'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform', 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier', 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound', 'ErrorPredictionModelNotCached', 'ErrorPrediction', - 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid' + 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorUnknownBaseModel', + 'ErrorInvalid' :type code: str or ~azure.cognitiveservices.vision.customvision.prediction.models.CustomVisionErrorCodes :param message: Required. A message explaining the error reported by the @@ -236,6 +245,10 @@ class Prediction(Model): :ivar bounding_box: Bounding box of the prediction. :vartype bounding_box: ~azure.cognitiveservices.vision.customvision.prediction.models.BoundingBox + :ivar tag_type: Type of the predicted tag. Possible values include: + 'Regular', 'Negative', 'GeneralProduct' + :vartype tag_type: str or + ~azure.cognitiveservices.vision.customvision.prediction.models.TagType """ _validation = { @@ -243,6 +256,7 @@ class Prediction(Model): 'tag_id': {'readonly': True}, 'tag_name': {'readonly': True}, 'bounding_box': {'readonly': True}, + 'tag_type': {'readonly': True}, } _attribute_map = { @@ -250,6 +264,7 @@ class Prediction(Model): 'tag_id': {'key': 'tagId', 'type': 'str'}, 'tag_name': {'key': 'tagName', 'type': 'str'}, 'bounding_box': {'key': 'boundingBox', 'type': 'BoundingBox'}, + 'tag_type': {'key': 'tagType', 'type': 'str'}, } def __init__(self, **kwargs): @@ -258,3 +273,4 @@ def __init__(self, **kwargs): self.tag_id = None self.tag_name = None self.bounding_box = None + self.tag_type = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models_py3.py index a7ef53998a0a..b9313dc78ab4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/_models_py3.py @@ -62,25 +62,29 @@ class CustomVisionError(Model): 'BadRequestProjectUnknownDomain', 'BadRequestProjectUnknownClassification', 'BadRequestProjectUnsupportedDomainTypeChange', - 'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName', + 'BadRequestProjectUnsupportedExportPlatform', + 'BadRequestProjectImagePreprocessingSettings', + 'BadRequestProjectDuplicated', 'BadRequestIterationName', 'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription', - 'BadRequestIterationIsNotTrained', 'BadRequestWorkspaceCannotBeModified', - 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName', - 'BadRequestTagNameNotUnique', 'BadRequestTagDescription', - 'BadRequestTagType', 'BadRequestMultipleNegativeTag', + 'BadRequestIterationIsNotTrained', 'BadRequestIterationValidationFailed', + 'BadRequestWorkspaceCannotBeModified', 'BadRequestWorkspaceNotDeletable', + 'BadRequestTagName', 'BadRequestTagNameNotUnique', + 'BadRequestTagDescription', 'BadRequestTagType', + 'BadRequestMultipleNegativeTag', 'BadRequestMultipleGeneralProductTag', 'BadRequestImageTags', 'BadRequestImageRegions', 'BadRequestNegativeAndRegularTagOnSameImage', - 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished', - 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget', - 'BadRequestUnpublishFailed', 'BadRequestSubscriptionApi', + 'BadRequestUnsupportedDomain', 'BadRequestRequiredParamIsNull', + 'BadRequestIterationIsPublished', 'BadRequestInvalidPublishName', + 'BadRequestInvalidPublishTarget', 'BadRequestUnpublishFailed', + 'BadRequestIterationNotPublished', 'BadRequestSubscriptionApi', 'BadRequestExceedProjectLimit', 'BadRequestExceedIterationPerProjectLimit', 'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit', 'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName', 'BadRequestNotLimitedTrial', 'BadRequestImageBatch', 'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat', - 'BadRequestImageSizeBytes', 'BadRequestImageExceededCount', - 'BadRequestTrainingNotNeeded', + 'BadRequestImageSizeBytes', 'BadRequestImageDimensions', + 'BadRequestImageExceededCount', 'BadRequestTrainingNotNeeded', 'BadRequestTrainingNotNeededButTrainingPipelineUpdated', 'BadRequestTrainingValidationFailed', 'BadRequestClassificationTrainingValidationFailed', @@ -98,7 +102,11 @@ class CustomVisionError(Model): 'BadRequestPredictionTagsExceededCount', 'BadRequestPredictionResultsExceededCount', 'BadRequestPredictionInvalidApplicationName', - 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid', + 'BadRequestPredictionInvalidQueryParameters', + 'BadRequestInvalidImportToken', 'BadRequestExportWhileTraining', + 'BadRequestImageMetadataKey', 'BadRequestImageMetadataValue', + 'BadRequestOperationNotSupported', 'BadRequestInvalidArtifactUri', + 'BadRequestCustomerManagedKeyRevoked', 'BadRequestInvalid', 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled', 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist', @@ -107,19 +115,20 @@ class CustomVisionError(Model): 'NotFoundProject', 'NotFoundProjectDefaultIteration', 'NotFoundIteration', 'NotFoundIterationPerformance', 'NotFoundTag', 'NotFoundImage', 'NotFoundDomain', 'NotFoundApimSubscription', 'NotFoundInvalid', - 'Conflict', 'ConflictInvalid', 'ErrorUnknown', - 'ErrorProjectInvalidWorkspace', + 'Conflict', 'ConflictInvalid', 'ErrorUnknown', 'ErrorIterationCopyFailed', + 'ErrorPreparePerformanceMigrationFailed', 'ErrorProjectInvalidWorkspace', 'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain', - 'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed', - 'ErrorFeaturizationServiceUnavailable', 'ErrorFeaturizationQueueTimeout', - 'ErrorFeaturizationInvalidFeaturizer', + 'ErrorProjectTrainingRequestFailed', 'ErrorProjectImportRequestFailed', + 'ErrorProjectExportRequestFailed', 'ErrorFeaturizationServiceUnavailable', + 'ErrorFeaturizationQueueTimeout', 'ErrorFeaturizationInvalidFeaturizer', 'ErrorFeaturizationAugmentationUnavailable', 'ErrorFeaturizationUnrecognizedJob', 'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform', 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier', 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound', 'ErrorPredictionModelNotCached', 'ErrorPrediction', - 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid' + 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorUnknownBaseModel', + 'ErrorInvalid' :type code: str or ~azure.cognitiveservices.vision.customvision.prediction.models.CustomVisionErrorCodes :param message: Required. A message explaining the error reported by the @@ -236,6 +245,10 @@ class Prediction(Model): :ivar bounding_box: Bounding box of the prediction. :vartype bounding_box: ~azure.cognitiveservices.vision.customvision.prediction.models.BoundingBox + :ivar tag_type: Type of the predicted tag. Possible values include: + 'Regular', 'Negative', 'GeneralProduct' + :vartype tag_type: str or + ~azure.cognitiveservices.vision.customvision.prediction.models.TagType """ _validation = { @@ -243,6 +256,7 @@ class Prediction(Model): 'tag_id': {'readonly': True}, 'tag_name': {'readonly': True}, 'bounding_box': {'readonly': True}, + 'tag_type': {'readonly': True}, } _attribute_map = { @@ -250,6 +264,7 @@ class Prediction(Model): 'tag_id': {'key': 'tagId', 'type': 'str'}, 'tag_name': {'key': 'tagName', 'type': 'str'}, 'bounding_box': {'key': 'boundingBox', 'type': 'BoundingBox'}, + 'tag_type': {'key': 'tagType', 'type': 'str'}, } def __init__(self, **kwargs) -> None: @@ -258,3 +273,4 @@ def __init__(self, **kwargs) -> None: self.tag_id = None self.tag_name = None self.bounding_box = None + self.tag_type = None diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/operations/_custom_vision_prediction_client_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/operations/_custom_vision_prediction_client_operations.py index 49127e2fb22c..9ee845e0360a 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/operations/_custom_vision_prediction_client_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/operations/_custom_vision_prediction_client_operations.py @@ -15,17 +15,18 @@ class CustomVisionPredictionClientOperationsMixin(object): - def classify_image_url( - self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): - """Classify an image url and saves the result. + def classify_image( + self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): + """Classify an image and saves the result. :param project_id: The project id. :type project_id: str :param published_name: Specifies the name of the model to evaluate against. :type published_name: str - :param url: Url of the image. - :type url: str + :param image_data: Binary image data. Supported formats are JPEG, GIF, + PNG, and BMP. Supports images up to 4MB. + :type image_data: Generator :param application: Optional. Specifies the name of application using the endpoint. :type application: str @@ -41,10 +42,8 @@ def classify_image_url( :raises: :class:`CustomVisionErrorException` """ - image_url = models.ImageUrl(url=url) - # Construct URL - url = self.classify_image_url.metadata['url'] + url = self.classify_image.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -60,15 +59,17 @@ def classify_image_url( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Content-Type'] = 'multipart/form-data' if custom_headers: header_parameters.update(custom_headers) - # Construct body - body_content = self._serialize.body(image_url, 'ImageUrl') + # Construct form data + form_data_content = { + 'imageData': image_data, + } # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -83,11 +84,11 @@ def classify_image_url( return client_raw_response return deserialized - classify_image_url.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/url'} + classify_image.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/image'} - def classify_image( + def classify_image_with_no_store( self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): - """Classify an image and saves the result. + """Classify an image without saving the result. :param project_id: The project id. :type project_id: str @@ -113,7 +114,7 @@ def classify_image( :class:`CustomVisionErrorException` """ # Construct URL - url = self.classify_image.metadata['url'] + url = self.classify_image_with_no_store.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -154,11 +155,11 @@ def classify_image( return client_raw_response return deserialized - classify_image.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/image'} + classify_image_with_no_store.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/image/nostore'} - def classify_image_url_with_no_store( + def classify_image_url( self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): - """Classify an image url without saving the result. + """Classify an image url and saves the result. :param project_id: The project id. :type project_id: str @@ -185,7 +186,7 @@ def classify_image_url_with_no_store( image_url = models.ImageUrl(url=url) # Construct URL - url = self.classify_image_url_with_no_store.metadata['url'] + url = self.classify_image_url.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -224,20 +225,19 @@ def classify_image_url_with_no_store( return client_raw_response return deserialized - classify_image_url_with_no_store.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/url/nostore'} + classify_image_url.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/url'} - def classify_image_with_no_store( - self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): - """Classify an image without saving the result. + def classify_image_url_with_no_store( + self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): + """Classify an image url without saving the result. :param project_id: The project id. :type project_id: str :param published_name: Specifies the name of the model to evaluate against. :type published_name: str - :param image_data: Binary image data. Supported formats are JPEG, GIF, - PNG, and BMP. Supports images up to 0MB. - :type image_data: Generator + :param url: Url of the image. + :type url: str :param application: Optional. Specifies the name of application using the endpoint. :type application: str @@ -253,8 +253,10 @@ def classify_image_with_no_store( :raises: :class:`CustomVisionErrorException` """ + image_url = models.ImageUrl(url=url) + # Construct URL - url = self.classify_image_with_no_store.metadata['url'] + url = self.classify_image_url_with_no_store.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -270,17 +272,15 @@ def classify_image_with_no_store( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'multipart/form-data' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) - # Construct form data - form_data_content = { - 'imageData': image_data, - } + # Construct body + body_content = self._serialize.body(image_url, 'ImageUrl') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) + 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]: @@ -295,19 +295,20 @@ def classify_image_with_no_store( return client_raw_response return deserialized - classify_image_with_no_store.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/image/nostore'} + classify_image_url_with_no_store.metadata = {'url': '/{projectId}/classify/iterations/{publishedName}/url/nostore'} - def detect_image_url( - self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): - """Detect objects in an image url and saves the result. + def detect_image( + self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): + """Detect objects in an image and saves the result. :param project_id: The project id. :type project_id: str :param published_name: Specifies the name of the model to evaluate against. :type published_name: str - :param url: Url of the image. - :type url: str + :param image_data: Binary image data. Supported formats are JPEG, GIF, + PNG, and BMP. Supports images up to 4MB. + :type image_data: Generator :param application: Optional. Specifies the name of application using the endpoint. :type application: str @@ -323,10 +324,8 @@ def detect_image_url( :raises: :class:`CustomVisionErrorException` """ - image_url = models.ImageUrl(url=url) - # Construct URL - url = self.detect_image_url.metadata['url'] + url = self.detect_image.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -342,15 +341,17 @@ def detect_image_url( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + header_parameters['Content-Type'] = 'multipart/form-data' if custom_headers: header_parameters.update(custom_headers) - # Construct body - body_content = self._serialize.body(image_url, 'ImageUrl') + # Construct form data + form_data_content = { + 'imageData': image_data, + } # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -365,11 +366,11 @@ def detect_image_url( return client_raw_response return deserialized - detect_image_url.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/url'} + detect_image.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/image'} - def detect_image( + def detect_image_with_no_store( self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): - """Detect objects in an image and saves the result. + """Detect objects in an image without saving the result. :param project_id: The project id. :type project_id: str @@ -395,7 +396,7 @@ def detect_image( :class:`CustomVisionErrorException` """ # Construct URL - url = self.detect_image.metadata['url'] + url = self.detect_image_with_no_store.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -436,11 +437,11 @@ def detect_image( return client_raw_response return deserialized - detect_image.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/image'} + detect_image_with_no_store.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/image/nostore'} - def detect_image_url_with_no_store( + def detect_image_url( self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): - """Detect objects in an image url without saving the result. + """Detect objects in an image url and saves the result. :param project_id: The project id. :type project_id: str @@ -467,7 +468,7 @@ def detect_image_url_with_no_store( image_url = models.ImageUrl(url=url) # Construct URL - url = self.detect_image_url_with_no_store.metadata['url'] + url = self.detect_image_url.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -506,20 +507,19 @@ def detect_image_url_with_no_store( return client_raw_response return deserialized - detect_image_url_with_no_store.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/url/nostore'} + detect_image_url.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/url'} - def detect_image_with_no_store( - self, project_id, published_name, image_data, application=None, custom_headers=None, raw=False, **operation_config): - """Detect objects in an image without saving the result. + def detect_image_url_with_no_store( + self, project_id, published_name, url, application=None, custom_headers=None, raw=False, **operation_config): + """Detect objects in an image url without saving the result. :param project_id: The project id. :type project_id: str :param published_name: Specifies the name of the model to evaluate against. :type published_name: str - :param image_data: Binary image data. Supported formats are JPEG, GIF, - PNG, and BMP. Supports images up to 0MB. - :type image_data: Generator + :param url: Url of the image. + :type url: str :param application: Optional. Specifies the name of application using the endpoint. :type application: str @@ -535,8 +535,10 @@ def detect_image_with_no_store( :raises: :class:`CustomVisionErrorException` """ + image_url = models.ImageUrl(url=url) + # Construct URL - url = self.detect_image_with_no_store.metadata['url'] + url = self.detect_image_url_with_no_store.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), 'projectId': self._serialize.url("project_id", project_id, 'str'), @@ -552,17 +554,15 @@ def detect_image_with_no_store( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'multipart/form-data' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) - # Construct form data - form_data_content = { - 'imageData': image_data, - } + # Construct body + body_content = self._serialize.body(image_url, 'ImageUrl') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) + 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]: @@ -577,4 +577,4 @@ def detect_image_with_no_store( return client_raw_response return deserialized - detect_image_with_no_store.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/image/nostore'} + detect_image_url_with_no_store.metadata = {'url': '/{projectId}/detect/iterations/{publishedName}/url/nostore'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/_configuration.py index 312e310eeab6..3ce58988527c 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/_configuration.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/_configuration.py @@ -33,7 +33,7 @@ def __init__( raise ValueError("Parameter 'endpoint' must not be None.") if credentials is None: raise ValueError("Parameter 'credentials' must not be None.") - base_url = '{Endpoint}/customvision/v3.2/training' + base_url = '{Endpoint}/customvision/v3.3/training' super(CustomVisionTrainingClientConfiguration, self).__init__(base_url) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/_custom_vision_training_client.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/_custom_vision_training_client.py index a995accbf5c8..31f266dcda99 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/_custom_vision_training_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/_custom_vision_training_client.py @@ -14,6 +14,7 @@ from ._configuration import CustomVisionTrainingClientConfiguration from .operations import CustomVisionTrainingClientOperationsMixin +from msrest.exceptions import HttpOperationError from . import models @@ -37,7 +38,7 @@ def __init__( super(CustomVisionTrainingClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '3.2' + self.api_version = '3.3' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/__init__.py index 987b397f62fc..df2405aed22b 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/__init__.py @@ -21,6 +21,8 @@ from ._models_py3 import ImageFileCreateEntry from ._models_py3 import ImageIdCreateBatch from ._models_py3 import ImageIdCreateEntry + from ._models_py3 import ImageMetadataUpdateEntry + from ._models_py3 import ImageMetadataUpdateSummary from ._models_py3 import ImagePerformance from ._models_py3 import ImagePrediction from ._models_py3 import ImageProcessingSettings @@ -69,6 +71,8 @@ from ._models import ImageFileCreateEntry from ._models import ImageIdCreateBatch from ._models import ImageIdCreateEntry + from ._models import ImageMetadataUpdateEntry + from ._models import ImageMetadataUpdateSummary from ._models import ImagePerformance from ._models import ImagePrediction from ._models import ImageProcessingSettings @@ -113,6 +117,7 @@ ExportPlatform, ExportStatus, ImageCreateStatus, + ImageMetadataUpdateStatus, OrderBy, ProjectStatus, SortBy, @@ -132,6 +137,8 @@ 'ImageFileCreateEntry', 'ImageIdCreateBatch', 'ImageIdCreateEntry', + 'ImageMetadataUpdateEntry', + 'ImageMetadataUpdateSummary', 'ImagePerformance', 'ImagePrediction', 'ImageProcessingSettings', @@ -174,10 +181,11 @@ 'ExportStatus', 'ExportFlavor', 'ImageCreateStatus', + 'ImageMetadataUpdateStatus', + 'TagType', 'Classifier', 'TrainingType', 'OrderBy', 'ProjectStatus', 'SortBy', - 'TagType', ] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_custom_vision_training_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_custom_vision_training_client_enums.py index 8a23ddb1ad59..9aca554c0359 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_custom_vision_training_client_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_custom_vision_training_client_enums.py @@ -40,9 +40,11 @@ class CustomVisionErrorCodes(str, Enum): bad_request_tag_description = "BadRequestTagDescription" bad_request_tag_type = "BadRequestTagType" bad_request_multiple_negative_tag = "BadRequestMultipleNegativeTag" + bad_request_multiple_general_product_tag = "BadRequestMultipleGeneralProductTag" bad_request_image_tags = "BadRequestImageTags" bad_request_image_regions = "BadRequestImageRegions" bad_request_negative_and_regular_tag_on_same_image = "BadRequestNegativeAndRegularTagOnSameImage" + bad_request_unsupported_domain = "BadRequestUnsupportedDomain" bad_request_required_param_is_null = "BadRequestRequiredParamIsNull" bad_request_iteration_is_published = "BadRequestIterationIsPublished" bad_request_invalid_publish_name = "BadRequestInvalidPublishName" @@ -62,6 +64,7 @@ class CustomVisionErrorCodes(str, Enum): bad_request_image_url = "BadRequestImageUrl" bad_request_image_format = "BadRequestImageFormat" bad_request_image_size_bytes = "BadRequestImageSizeBytes" + bad_request_image_dimensions = "BadRequestImageDimensions" bad_request_image_exceeded_count = "BadRequestImageExceededCount" bad_request_training_not_needed = "BadRequestTrainingNotNeeded" bad_request_training_not_needed_but_training_pipeline_updated = "BadRequestTrainingNotNeededButTrainingPipelineUpdated" @@ -86,6 +89,11 @@ class CustomVisionErrorCodes(str, Enum): bad_request_prediction_invalid_query_parameters = "BadRequestPredictionInvalidQueryParameters" bad_request_invalid_import_token = "BadRequestInvalidImportToken" bad_request_export_while_training = "BadRequestExportWhileTraining" + bad_request_image_metadata_key = "BadRequestImageMetadataKey" + bad_request_image_metadata_value = "BadRequestImageMetadataValue" + bad_request_operation_not_supported = "BadRequestOperationNotSupported" + bad_request_invalid_artifact_uri = "BadRequestInvalidArtifactUri" + bad_request_customer_managed_key_revoked = "BadRequestCustomerManagedKeyRevoked" bad_request_invalid = "BadRequestInvalid" unsupported_media_type = "UnsupportedMediaType" forbidden = "Forbidden" @@ -134,6 +142,7 @@ class CustomVisionErrorCodes(str, Enum): error_prediction = "ErrorPrediction" error_prediction_storage = "ErrorPredictionStorage" error_region_proposal = "ErrorRegionProposal" + error_unknown_base_model = "ErrorUnknownBaseModel" error_invalid = "ErrorInvalid" @@ -185,6 +194,21 @@ class ImageCreateStatus(str, Enum): error_negative_and_regular_tag_on_same_image = "ErrorNegativeAndRegularTagOnSameImage" +class ImageMetadataUpdateStatus(str, Enum): + + ok = "OK" + error_image_not_found = "ErrorImageNotFound" + error_limit_exceed = "ErrorLimitExceed" + error_unknown = "ErrorUnknown" + + +class TagType(str, Enum): + + regular = "Regular" + negative = "Negative" + general_product = "GeneralProduct" + + class Classifier(str, Enum): multiclass = "Multiclass" @@ -215,9 +239,3 @@ class SortBy(str, Enum): uncertainty_ascending = "UncertaintyAscending" uncertainty_descending = "UncertaintyDescending" - - -class TagType(str, Enum): - - regular = "Regular" - negative = "Negative" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_models.py index 03c972188bfc..5f12784e1207 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_models.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_models.py @@ -70,19 +70,21 @@ class CustomVisionError(Model): 'BadRequestWorkspaceCannotBeModified', 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName', 'BadRequestTagNameNotUnique', 'BadRequestTagDescription', 'BadRequestTagType', - 'BadRequestMultipleNegativeTag', 'BadRequestImageTags', - 'BadRequestImageRegions', 'BadRequestNegativeAndRegularTagOnSameImage', - 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished', - 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget', - 'BadRequestUnpublishFailed', 'BadRequestIterationNotPublished', - 'BadRequestSubscriptionApi', 'BadRequestExceedProjectLimit', + 'BadRequestMultipleNegativeTag', 'BadRequestMultipleGeneralProductTag', + 'BadRequestImageTags', 'BadRequestImageRegions', + 'BadRequestNegativeAndRegularTagOnSameImage', + 'BadRequestUnsupportedDomain', 'BadRequestRequiredParamIsNull', + 'BadRequestIterationIsPublished', 'BadRequestInvalidPublishName', + 'BadRequestInvalidPublishTarget', 'BadRequestUnpublishFailed', + 'BadRequestIterationNotPublished', 'BadRequestSubscriptionApi', + 'BadRequestExceedProjectLimit', 'BadRequestExceedIterationPerProjectLimit', 'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit', 'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName', 'BadRequestNotLimitedTrial', 'BadRequestImageBatch', 'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat', - 'BadRequestImageSizeBytes', 'BadRequestImageExceededCount', - 'BadRequestTrainingNotNeeded', + 'BadRequestImageSizeBytes', 'BadRequestImageDimensions', + 'BadRequestImageExceededCount', 'BadRequestTrainingNotNeeded', 'BadRequestTrainingNotNeededButTrainingPipelineUpdated', 'BadRequestTrainingValidationFailed', 'BadRequestClassificationTrainingValidationFailed', @@ -102,7 +104,10 @@ class CustomVisionError(Model): 'BadRequestPredictionInvalidApplicationName', 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalidImportToken', 'BadRequestExportWhileTraining', - 'BadRequestInvalid', 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', + 'BadRequestImageMetadataKey', 'BadRequestImageMetadataValue', + 'BadRequestOperationNotSupported', 'BadRequestInvalidArtifactUri', + 'BadRequestCustomerManagedKeyRevoked', 'BadRequestInvalid', + 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled', 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist', 'ForbiddenUserDisabled', 'ForbiddenUserInsufficientCapability', @@ -122,7 +127,8 @@ class CustomVisionError(Model): 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier', 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound', 'ErrorPredictionModelNotCached', 'ErrorPrediction', - 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid' + 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorUnknownBaseModel', + 'ErrorInvalid' :type code: str or ~azure.cognitiveservices.vision.customvision.training.models.CustomVisionErrorCodes :param message: Required. A message explaining the error reported by the @@ -216,7 +222,9 @@ class Export(Model): 'Failed', 'Done' :vartype status: str or ~azure.cognitiveservices.vision.customvision.training.models.ExportStatus - :ivar download_uri: URI used to download the model. + :ivar download_uri: URI used to download the model. If VNET feature is + enabled this will be a relative path to be used with GetArtifact, + otherwise this will be an absolute URI to the resource. :vartype download_uri: str :ivar flavor: Flavor of the export. These are specializations of the export platform. @@ -272,10 +280,16 @@ class Image(Model): :ivar height: Height of the image. :vartype height: int :ivar resized_image_uri: The URI to the (resized) image used for training. + If VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype resized_image_uri: str - :ivar thumbnail_uri: The URI to the thumbnail of the original image. + :ivar thumbnail_uri: The URI to the thumbnail of the original image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype thumbnail_uri: str - :ivar original_image_uri: The URI to the original uploaded image. + :ivar original_image_uri: The URI to the original uploaded image. If VNET + feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype original_image_uri: str :ivar tags: Tags associated with this image. :vartype tags: @@ -283,6 +297,8 @@ class Image(Model): :ivar regions: Regions associated with this image. :vartype regions: list[~azure.cognitiveservices.vision.customvision.training.models.ImageRegion] + :ivar metadata: Metadata associated with this image. + :vartype metadata: dict[str, str] """ _validation = { @@ -295,6 +311,7 @@ class Image(Model): 'original_image_uri': {'readonly': True}, 'tags': {'readonly': True}, 'regions': {'readonly': True}, + 'metadata': {'readonly': True}, } _attribute_map = { @@ -307,6 +324,7 @@ class Image(Model): 'original_image_uri': {'key': 'originalImageUri', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '[ImageTag]'}, 'regions': {'key': 'regions', 'type': '[ImageRegion]'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } def __init__(self, **kwargs): @@ -320,6 +338,7 @@ def __init__(self, **kwargs): self.original_image_uri = None self.tags = None self.regions = None + self.metadata = None class ImageCreateResult(Model): @@ -399,17 +418,23 @@ class ImageFileCreateBatch(Model): list[~azure.cognitiveservices.vision.customvision.training.models.ImageFileCreateEntry] :param tag_ids: :type tag_ids: list[str] + :param metadata: The metadata of image. Limited to 50 key-value pairs per + image. The length of key is limited to 256. The length of value is limited + to 512. + :type metadata: dict[str, str] """ _attribute_map = { 'images': {'key': 'images', 'type': '[ImageFileCreateEntry]'}, 'tag_ids': {'key': 'tagIds', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } def __init__(self, **kwargs): super(ImageFileCreateBatch, self).__init__(**kwargs) self.images = kwargs.get('images', None) self.tag_ids = kwargs.get('tag_ids', None) + self.metadata = kwargs.get('metadata', None) class ImageFileCreateEntry(Model): @@ -449,17 +474,23 @@ class ImageIdCreateBatch(Model): list[~azure.cognitiveservices.vision.customvision.training.models.ImageIdCreateEntry] :param tag_ids: :type tag_ids: list[str] + :param metadata: The metadata of image. Limited to 50 key-value pairs per + image. The length of key is limited to 256. The length of value is limited + to 512. + :type metadata: dict[str, str] """ _attribute_map = { 'images': {'key': 'images', 'type': '[ImageIdCreateEntry]'}, 'tag_ids': {'key': 'tagIds', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } def __init__(self, **kwargs): super(ImageIdCreateBatch, self).__init__(**kwargs) self.images = kwargs.get('images', None) self.tag_ids = kwargs.get('tag_ids', None) + self.metadata = kwargs.get('metadata', None) class ImageIdCreateEntry(Model): @@ -487,6 +518,61 @@ def __init__(self, **kwargs): self.regions = kwargs.get('regions', None) +class ImageMetadataUpdateEntry(Model): + """Entry associating a metadata to an image. + + :param image_id: Id of the image. + :type image_id: str + :param status: Status of the metadata update. Possible values include: + 'OK', 'ErrorImageNotFound', 'ErrorLimitExceed', 'ErrorUnknown' + :type status: str or + ~azure.cognitiveservices.vision.customvision.training.models.ImageMetadataUpdateStatus + :param metadata: Metadata of the image. + :type metadata: dict[str, str] + """ + + _attribute_map = { + 'image_id': {'key': 'imageId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ImageMetadataUpdateEntry, self).__init__(**kwargs) + self.image_id = kwargs.get('image_id', None) + self.status = kwargs.get('status', None) + self.metadata = kwargs.get('metadata', None) + + +class ImageMetadataUpdateSummary(Model): + """ImageMetadataUpdateSummary. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar is_batch_successful: + :vartype is_batch_successful: bool + :ivar images: + :vartype images: + list[~azure.cognitiveservices.vision.customvision.training.models.ImageMetadataUpdateEntry] + """ + + _validation = { + 'is_batch_successful': {'readonly': True}, + 'images': {'readonly': True}, + } + + _attribute_map = { + 'is_batch_successful': {'key': 'isBatchSuccessful', 'type': 'bool'}, + 'images': {'key': 'images', 'type': '[ImageMetadataUpdateEntry]'}, + } + + def __init__(self, **kwargs): + super(ImageMetadataUpdateSummary, self).__init__(**kwargs) + self.is_batch_successful = None + self.images = None + + class ImagePerformance(Model): """Image performance model. @@ -994,17 +1080,23 @@ class ImageUrlCreateBatch(Model): list[~azure.cognitiveservices.vision.customvision.training.models.ImageUrlCreateEntry] :param tag_ids: :type tag_ids: list[str] + :param metadata: The metadata of image. Limited to 50 key-value pairs per + image. The length of key is limited to 256. The length of value is limited + to 512. + :type metadata: dict[str, str] """ _attribute_map = { 'images': {'key': 'images', 'type': '[ImageUrlCreateEntry]'}, 'tag_ids': {'key': 'tagIds', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } def __init__(self, **kwargs): super(ImageUrlCreateBatch, self).__init__(**kwargs) self.images = kwargs.get('images', None) self.tag_ids = kwargs.get('tag_ids', None) + self.metadata = kwargs.get('metadata', None) class ImageUrlCreateEntry(Model): @@ -1212,6 +1304,10 @@ class Prediction(Model): :ivar bounding_box: Bounding box of the prediction. :vartype bounding_box: ~azure.cognitiveservices.vision.customvision.training.models.BoundingBox + :ivar tag_type: Type of the predicted tag. Possible values include: + 'Regular', 'Negative', 'GeneralProduct' + :vartype tag_type: str or + ~azure.cognitiveservices.vision.customvision.training.models.TagType """ _validation = { @@ -1219,6 +1315,7 @@ class Prediction(Model): 'tag_id': {'readonly': True}, 'tag_name': {'readonly': True}, 'bounding_box': {'readonly': True}, + 'tag_type': {'readonly': True}, } _attribute_map = { @@ -1226,6 +1323,7 @@ class Prediction(Model): 'tag_id': {'key': 'tagId', 'type': 'str'}, 'tag_name': {'key': 'tagName', 'type': 'str'}, 'bounding_box': {'key': 'boundingBox', 'type': 'BoundingBox'}, + 'tag_type': {'key': 'tagType', 'type': 'str'}, } def __init__(self, **kwargs): @@ -1234,6 +1332,7 @@ def __init__(self, **kwargs): self.tag_id = None self.tag_name = None self.bounding_box = None + self.tag_type = None class PredictionQueryResult(Model): @@ -1246,7 +1345,7 @@ class PredictionQueryResult(Model): :param token: Prediction Query Token. :type token: ~azure.cognitiveservices.vision.customvision.training.models.PredictionQueryToken - :ivar results: Result of an prediction request. + :ivar results: Result of an image prediction request. :vartype results: list[~azure.cognitiveservices.vision.customvision.training.models.StoredImagePrediction] """ @@ -1361,7 +1460,9 @@ class Project(Model): :vartype created: datetime :ivar last_modified: Gets the date this project was last modified. :vartype last_modified: datetime - :ivar thumbnail_uri: Gets the thumbnail url representing the image. + :ivar thumbnail_uri: Gets the thumbnail url representing the image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype thumbnail_uri: str :ivar dr_mode_enabled: Gets if the Disaster Recovery (DR) mode is on, indicating the project is temporarily read-only. @@ -1587,12 +1688,17 @@ class StoredImagePrediction(Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar resized_image_uri: The URI to the (resized) prediction image. + :ivar resized_image_uri: The URI to the (resized) prediction image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype resized_image_uri: str :ivar thumbnail_uri: The URI to the thumbnail of the original prediction - image. + image. If VNET feature is enabled this will be a relative path to be used + with GetArtifact, otherwise this will be an absolute URI to the resource. :vartype thumbnail_uri: str - :ivar original_image_uri: The URI to the original prediction image. + :ivar original_image_uri: The URI to the original prediction image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype original_image_uri: str :ivar domain: Domain used for the prediction. :vartype domain: str @@ -1656,12 +1762,17 @@ class StoredSuggestedTagAndRegion(Model): :vartype width: int :ivar height: Height of the resized image. :vartype height: int - :ivar resized_image_uri: The URI to the (resized) prediction image. + :ivar resized_image_uri: The URI to the (resized) prediction image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype resized_image_uri: str :ivar thumbnail_uri: The URI to the thumbnail of the original prediction - image. + image. If VNET feature is enabled this will be a relative path to be used + with GetArtifact, otherwise this will be an absolute URI to the resource. :vartype thumbnail_uri: str - :ivar original_image_uri: The URI to the original prediction image. + :ivar original_image_uri: The URI to the original prediction image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype original_image_uri: str :ivar domain: Domain used for the prediction. :vartype domain: str @@ -1867,7 +1978,7 @@ class Tag(Model): :param description: Required. Gets or sets the description of the tag. :type description: str :param type: Required. Gets or sets the type of the tag. Possible values - include: 'Regular', 'Negative' + include: 'Regular', 'Negative', 'GeneralProduct' :type type: str or ~azure.cognitiveservices.vision.customvision.training.models.TagType :ivar image_count: Gets the number of images with this tag. diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_models_py3.py index 8b0e1f518f20..b41b81244da9 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/models/_models_py3.py @@ -70,19 +70,21 @@ class CustomVisionError(Model): 'BadRequestWorkspaceCannotBeModified', 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName', 'BadRequestTagNameNotUnique', 'BadRequestTagDescription', 'BadRequestTagType', - 'BadRequestMultipleNegativeTag', 'BadRequestImageTags', - 'BadRequestImageRegions', 'BadRequestNegativeAndRegularTagOnSameImage', - 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished', - 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget', - 'BadRequestUnpublishFailed', 'BadRequestIterationNotPublished', - 'BadRequestSubscriptionApi', 'BadRequestExceedProjectLimit', + 'BadRequestMultipleNegativeTag', 'BadRequestMultipleGeneralProductTag', + 'BadRequestImageTags', 'BadRequestImageRegions', + 'BadRequestNegativeAndRegularTagOnSameImage', + 'BadRequestUnsupportedDomain', 'BadRequestRequiredParamIsNull', + 'BadRequestIterationIsPublished', 'BadRequestInvalidPublishName', + 'BadRequestInvalidPublishTarget', 'BadRequestUnpublishFailed', + 'BadRequestIterationNotPublished', 'BadRequestSubscriptionApi', + 'BadRequestExceedProjectLimit', 'BadRequestExceedIterationPerProjectLimit', 'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit', 'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName', 'BadRequestNotLimitedTrial', 'BadRequestImageBatch', 'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat', - 'BadRequestImageSizeBytes', 'BadRequestImageExceededCount', - 'BadRequestTrainingNotNeeded', + 'BadRequestImageSizeBytes', 'BadRequestImageDimensions', + 'BadRequestImageExceededCount', 'BadRequestTrainingNotNeeded', 'BadRequestTrainingNotNeededButTrainingPipelineUpdated', 'BadRequestTrainingValidationFailed', 'BadRequestClassificationTrainingValidationFailed', @@ -102,7 +104,10 @@ class CustomVisionError(Model): 'BadRequestPredictionInvalidApplicationName', 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalidImportToken', 'BadRequestExportWhileTraining', - 'BadRequestInvalid', 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', + 'BadRequestImageMetadataKey', 'BadRequestImageMetadataValue', + 'BadRequestOperationNotSupported', 'BadRequestInvalidArtifactUri', + 'BadRequestCustomerManagedKeyRevoked', 'BadRequestInvalid', + 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled', 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist', 'ForbiddenUserDisabled', 'ForbiddenUserInsufficientCapability', @@ -122,7 +127,8 @@ class CustomVisionError(Model): 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier', 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound', 'ErrorPredictionModelNotCached', 'ErrorPrediction', - 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid' + 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorUnknownBaseModel', + 'ErrorInvalid' :type code: str or ~azure.cognitiveservices.vision.customvision.training.models.CustomVisionErrorCodes :param message: Required. A message explaining the error reported by the @@ -216,7 +222,9 @@ class Export(Model): 'Failed', 'Done' :vartype status: str or ~azure.cognitiveservices.vision.customvision.training.models.ExportStatus - :ivar download_uri: URI used to download the model. + :ivar download_uri: URI used to download the model. If VNET feature is + enabled this will be a relative path to be used with GetArtifact, + otherwise this will be an absolute URI to the resource. :vartype download_uri: str :ivar flavor: Flavor of the export. These are specializations of the export platform. @@ -272,10 +280,16 @@ class Image(Model): :ivar height: Height of the image. :vartype height: int :ivar resized_image_uri: The URI to the (resized) image used for training. + If VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype resized_image_uri: str - :ivar thumbnail_uri: The URI to the thumbnail of the original image. + :ivar thumbnail_uri: The URI to the thumbnail of the original image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype thumbnail_uri: str - :ivar original_image_uri: The URI to the original uploaded image. + :ivar original_image_uri: The URI to the original uploaded image. If VNET + feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype original_image_uri: str :ivar tags: Tags associated with this image. :vartype tags: @@ -283,6 +297,8 @@ class Image(Model): :ivar regions: Regions associated with this image. :vartype regions: list[~azure.cognitiveservices.vision.customvision.training.models.ImageRegion] + :ivar metadata: Metadata associated with this image. + :vartype metadata: dict[str, str] """ _validation = { @@ -295,6 +311,7 @@ class Image(Model): 'original_image_uri': {'readonly': True}, 'tags': {'readonly': True}, 'regions': {'readonly': True}, + 'metadata': {'readonly': True}, } _attribute_map = { @@ -307,6 +324,7 @@ class Image(Model): 'original_image_uri': {'key': 'originalImageUri', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '[ImageTag]'}, 'regions': {'key': 'regions', 'type': '[ImageRegion]'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } def __init__(self, **kwargs) -> None: @@ -320,6 +338,7 @@ def __init__(self, **kwargs) -> None: self.original_image_uri = None self.tags = None self.regions = None + self.metadata = None class ImageCreateResult(Model): @@ -399,17 +418,23 @@ class ImageFileCreateBatch(Model): list[~azure.cognitiveservices.vision.customvision.training.models.ImageFileCreateEntry] :param tag_ids: :type tag_ids: list[str] + :param metadata: The metadata of image. Limited to 50 key-value pairs per + image. The length of key is limited to 256. The length of value is limited + to 512. + :type metadata: dict[str, str] """ _attribute_map = { 'images': {'key': 'images', 'type': '[ImageFileCreateEntry]'}, 'tag_ids': {'key': 'tagIds', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } - def __init__(self, *, images=None, tag_ids=None, **kwargs) -> None: + def __init__(self, *, images=None, tag_ids=None, metadata=None, **kwargs) -> None: super(ImageFileCreateBatch, self).__init__(**kwargs) self.images = images self.tag_ids = tag_ids + self.metadata = metadata class ImageFileCreateEntry(Model): @@ -449,17 +474,23 @@ class ImageIdCreateBatch(Model): list[~azure.cognitiveservices.vision.customvision.training.models.ImageIdCreateEntry] :param tag_ids: :type tag_ids: list[str] + :param metadata: The metadata of image. Limited to 50 key-value pairs per + image. The length of key is limited to 256. The length of value is limited + to 512. + :type metadata: dict[str, str] """ _attribute_map = { 'images': {'key': 'images', 'type': '[ImageIdCreateEntry]'}, 'tag_ids': {'key': 'tagIds', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } - def __init__(self, *, images=None, tag_ids=None, **kwargs) -> None: + def __init__(self, *, images=None, tag_ids=None, metadata=None, **kwargs) -> None: super(ImageIdCreateBatch, self).__init__(**kwargs) self.images = images self.tag_ids = tag_ids + self.metadata = metadata class ImageIdCreateEntry(Model): @@ -487,6 +518,61 @@ def __init__(self, *, id: str=None, tag_ids=None, regions=None, **kwargs) -> Non self.regions = regions +class ImageMetadataUpdateEntry(Model): + """Entry associating a metadata to an image. + + :param image_id: Id of the image. + :type image_id: str + :param status: Status of the metadata update. Possible values include: + 'OK', 'ErrorImageNotFound', 'ErrorLimitExceed', 'ErrorUnknown' + :type status: str or + ~azure.cognitiveservices.vision.customvision.training.models.ImageMetadataUpdateStatus + :param metadata: Metadata of the image. + :type metadata: dict[str, str] + """ + + _attribute_map = { + 'image_id': {'key': 'imageId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + } + + def __init__(self, *, image_id: str=None, status=None, metadata=None, **kwargs) -> None: + super(ImageMetadataUpdateEntry, self).__init__(**kwargs) + self.image_id = image_id + self.status = status + self.metadata = metadata + + +class ImageMetadataUpdateSummary(Model): + """ImageMetadataUpdateSummary. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar is_batch_successful: + :vartype is_batch_successful: bool + :ivar images: + :vartype images: + list[~azure.cognitiveservices.vision.customvision.training.models.ImageMetadataUpdateEntry] + """ + + _validation = { + 'is_batch_successful': {'readonly': True}, + 'images': {'readonly': True}, + } + + _attribute_map = { + 'is_batch_successful': {'key': 'isBatchSuccessful', 'type': 'bool'}, + 'images': {'key': 'images', 'type': '[ImageMetadataUpdateEntry]'}, + } + + def __init__(self, **kwargs) -> None: + super(ImageMetadataUpdateSummary, self).__init__(**kwargs) + self.is_batch_successful = None + self.images = None + + class ImagePerformance(Model): """Image performance model. @@ -994,17 +1080,23 @@ class ImageUrlCreateBatch(Model): list[~azure.cognitiveservices.vision.customvision.training.models.ImageUrlCreateEntry] :param tag_ids: :type tag_ids: list[str] + :param metadata: The metadata of image. Limited to 50 key-value pairs per + image. The length of key is limited to 256. The length of value is limited + to 512. + :type metadata: dict[str, str] """ _attribute_map = { 'images': {'key': 'images', 'type': '[ImageUrlCreateEntry]'}, 'tag_ids': {'key': 'tagIds', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, } - def __init__(self, *, images=None, tag_ids=None, **kwargs) -> None: + def __init__(self, *, images=None, tag_ids=None, metadata=None, **kwargs) -> None: super(ImageUrlCreateBatch, self).__init__(**kwargs) self.images = images self.tag_ids = tag_ids + self.metadata = metadata class ImageUrlCreateEntry(Model): @@ -1212,6 +1304,10 @@ class Prediction(Model): :ivar bounding_box: Bounding box of the prediction. :vartype bounding_box: ~azure.cognitiveservices.vision.customvision.training.models.BoundingBox + :ivar tag_type: Type of the predicted tag. Possible values include: + 'Regular', 'Negative', 'GeneralProduct' + :vartype tag_type: str or + ~azure.cognitiveservices.vision.customvision.training.models.TagType """ _validation = { @@ -1219,6 +1315,7 @@ class Prediction(Model): 'tag_id': {'readonly': True}, 'tag_name': {'readonly': True}, 'bounding_box': {'readonly': True}, + 'tag_type': {'readonly': True}, } _attribute_map = { @@ -1226,6 +1323,7 @@ class Prediction(Model): 'tag_id': {'key': 'tagId', 'type': 'str'}, 'tag_name': {'key': 'tagName', 'type': 'str'}, 'bounding_box': {'key': 'boundingBox', 'type': 'BoundingBox'}, + 'tag_type': {'key': 'tagType', 'type': 'str'}, } def __init__(self, **kwargs) -> None: @@ -1234,6 +1332,7 @@ def __init__(self, **kwargs) -> None: self.tag_id = None self.tag_name = None self.bounding_box = None + self.tag_type = None class PredictionQueryResult(Model): @@ -1246,7 +1345,7 @@ class PredictionQueryResult(Model): :param token: Prediction Query Token. :type token: ~azure.cognitiveservices.vision.customvision.training.models.PredictionQueryToken - :ivar results: Result of an prediction request. + :ivar results: Result of an image prediction request. :vartype results: list[~azure.cognitiveservices.vision.customvision.training.models.StoredImagePrediction] """ @@ -1361,7 +1460,9 @@ class Project(Model): :vartype created: datetime :ivar last_modified: Gets the date this project was last modified. :vartype last_modified: datetime - :ivar thumbnail_uri: Gets the thumbnail url representing the image. + :ivar thumbnail_uri: Gets the thumbnail url representing the image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype thumbnail_uri: str :ivar dr_mode_enabled: Gets if the Disaster Recovery (DR) mode is on, indicating the project is temporarily read-only. @@ -1587,12 +1688,17 @@ class StoredImagePrediction(Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar resized_image_uri: The URI to the (resized) prediction image. + :ivar resized_image_uri: The URI to the (resized) prediction image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype resized_image_uri: str :ivar thumbnail_uri: The URI to the thumbnail of the original prediction - image. + image. If VNET feature is enabled this will be a relative path to be used + with GetArtifact, otherwise this will be an absolute URI to the resource. :vartype thumbnail_uri: str - :ivar original_image_uri: The URI to the original prediction image. + :ivar original_image_uri: The URI to the original prediction image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype original_image_uri: str :ivar domain: Domain used for the prediction. :vartype domain: str @@ -1656,12 +1762,17 @@ class StoredSuggestedTagAndRegion(Model): :vartype width: int :ivar height: Height of the resized image. :vartype height: int - :ivar resized_image_uri: The URI to the (resized) prediction image. + :ivar resized_image_uri: The URI to the (resized) prediction image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype resized_image_uri: str :ivar thumbnail_uri: The URI to the thumbnail of the original prediction - image. + image. If VNET feature is enabled this will be a relative path to be used + with GetArtifact, otherwise this will be an absolute URI to the resource. :vartype thumbnail_uri: str - :ivar original_image_uri: The URI to the original prediction image. + :ivar original_image_uri: The URI to the original prediction image. If + VNET feature is enabled this will be a relative path to be used with + GetArtifact, otherwise this will be an absolute URI to the resource. :vartype original_image_uri: str :ivar domain: Domain used for the prediction. :vartype domain: str @@ -1867,7 +1978,7 @@ class Tag(Model): :param description: Required. Gets or sets the description of the tag. :type description: str :param type: Required. Gets or sets the type of the tag. Possible values - include: 'Regular', 'Negative' + include: 'Regular', 'Negative', 'GeneralProduct' :type type: str or ~azure.cognitiveservices.vision.customvision.training.models.TagType :ivar image_count: Gets the number of images with this tag. diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/operations/_custom_vision_training_client_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/operations/_custom_vision_training_client_operations.py index b9c93e6cd9d8..a8780ab7a40d 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/operations/_custom_vision_training_client_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/training/operations/_custom_vision_training_client_operations.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.pipeline import ClientRawResponse +from msrest.exceptions import HttpOperationError from .. import models @@ -397,6 +398,64 @@ def update_project( return deserialized update_project.metadata = {'url': '/projects/{projectId}'} + def get_artifact( + self, project_id, path, custom_headers=None, raw=False, callback=None, **operation_config): + """Get artifact content from blob storage, based on artifact relative path + in the blob. + + :param project_id: The project id. + :type project_id: str + :param path: The relative path for artifact. + :type path: 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 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: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`HttpOperationError` + """ + # Construct URL + url = self.get_artifact.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'projectId': self._serialize.url("project_id", project_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['path'] = self._serialize.query("path", path, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/octet-stream' + 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=True, **operation_config) + + if response.status_code not in [200]: + raise HttpOperationError(self._deserialize, response) + + deserialized = self._client.stream_download(response, callback) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_artifact.metadata = {'url': '/projects/{projectId}/artifacts'} + def export_project( self, project_id, custom_headers=None, raw=False, **operation_config): """Exports a project. @@ -450,6 +509,107 @@ def export_project( return deserialized export_project.metadata = {'url': '/projects/{projectId}/export'} + def get_images( + self, project_id, iteration_id=None, tag_ids=None, tagging_status=None, filter=None, order_by=None, take=50, skip=0, custom_headers=None, raw=False, **operation_config): + """Get images for a given project iteration or workspace. + + This API supports batching and range selection. By default it will only + return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to + return in a given batch. + The filtering is on an and/or relationship. For example, if the + provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be + returned. + + :param project_id: The project id. + :type project_id: str + :param iteration_id: The iteration id. Defaults to workspace. + :type iteration_id: str + :param tag_ids: A list of tags ids to filter the images. Defaults to + all tagged images when null. Limited to 20. + :type tag_ids: list[str] + :param tagging_status: The tagging status filter. It can be 'All', + 'Tagged', or 'Untagged'. Defaults to 'All'. Possible values include: + 'All', 'Tagged', 'Untagged' + :type tagging_status: str + :param filter: An expression to filter the images against image + metadata. Only images where the expression evaluates to true are + included in the response. + The expression supports eq (Equal), ne (Not equal), and (Logical and), + or (Logical or) operators. + Here is an example, metadata=key1 eq 'value1' and key2 ne 'value2'. + :type filter: str + :param order_by: The ordering. Defaults to newest. Possible values + include: 'Newest', 'Oldest' + :type order_by: str + :param take: Maximum number of images to return. Defaults to 50, + limited to 256. + :type take: int + :param skip: Number of images to skip before beginning the image + batch. Defaults to 0. + :type skip: 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.customvision.training.models.Image] + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`CustomVisionErrorException` + """ + # Construct URL + url = self.get_images.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'projectId': self._serialize.url("project_id", project_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if iteration_id is not None: + query_parameters['iterationId'] = self._serialize.query("iteration_id", iteration_id, 'str') + if tag_ids is not None: + query_parameters['tagIds'] = self._serialize.query("tag_ids", tag_ids, '[str]', div=',', max_items=20, min_items=0) + if tagging_status is not None: + query_parameters['taggingStatus'] = self._serialize.query("tagging_status", tagging_status, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if order_by is not None: + query_parameters['orderBy'] = self._serialize.query("order_by", order_by, 'str') + if take is not None: + query_parameters['take'] = self._serialize.query("take", take, 'int', maximum=256, minimum=0) + if skip is not None: + query_parameters['skip'] = self._serialize.query("skip", skip, 'int') + + # 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.CustomVisionErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('[Image]', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_images.metadata = {'url': '/projects/{projectId}/images'} + def create_images_from_data( self, project_id, image_data, tag_ids=None, custom_headers=None, raw=False, **operation_config): """Add the provided images to the set of training images. @@ -457,6 +617,10 @@ def create_images_from_data( This API accepts body content as multipart/form-data and application/octet-stream. When using multipart multiple image files can be sent at once, with a maximum of 64 files. + If all images are successful created, 200(OK) status code will be + returned. + Otherwise, 207 (Multi-Status) status code will be returned and detail + status for each image will be listed in the response payload. :param project_id: The project id. :type project_id: str @@ -507,12 +671,14 @@ def create_images_from_data( request = self._client.post(url, query_parameters, header_parameters, form_content=form_data_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [200, 207]: raise models.CustomVisionErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('ImageCreateSummary', response) + if response.status_code == 207: + deserialized = self._deserialize('ImageCreateSummary', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -642,20 +808,103 @@ def get_image_region_proposals( return deserialized get_image_region_proposals.metadata = {'url': '/projects/{projectId}/images/{imageId}/regionproposals'} + def get_image_count( + self, project_id, iteration_id=None, tagging_status=None, filter=None, tag_ids=None, custom_headers=None, raw=False, **operation_config): + """Get the number of images. + + The filtering is on an and/or relationship. For example, if the + provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be + returned. + + :param project_id: The project id. + :type project_id: str + :param iteration_id: The iteration id. Defaults to workspace. + :type iteration_id: str + :param tagging_status: The tagging status filter. It can be 'All', + 'Tagged', or 'Untagged'. Defaults to 'All'. Possible values include: + 'All', 'Tagged', 'Untagged' + :type tagging_status: str + :param filter: An expression to filter the images against image + metadata. Only images where the expression evaluates to true are + included in the response. + The expression supports eq (Equal), ne (Not equal), and (Logical and), + or (Logical or) operators. + Here is an example, metadata=key1 eq 'value1' and key2 ne 'value2'. + :type filter: str + :param tag_ids: A list of tags ids to filter the images to count. + Defaults to all tags when null. + :type tag_ids: list[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: int or ClientRawResponse if raw=true + :rtype: int or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`CustomVisionErrorException` + """ + # Construct URL + url = self.get_image_count.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'projectId': self._serialize.url("project_id", project_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if iteration_id is not None: + query_parameters['iterationId'] = self._serialize.query("iteration_id", iteration_id, 'str') + if tagging_status is not None: + query_parameters['taggingStatus'] = self._serialize.query("tagging_status", tagging_status, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if tag_ids is not None: + query_parameters['tagIds'] = self._serialize.query("tag_ids", tag_ids, '[str]', div=',') + + # 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.CustomVisionErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('int', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_image_count.metadata = {'url': '/projects/{projectId}/images/count'} + def create_images_from_files( - self, project_id, images=None, tag_ids=None, custom_headers=None, raw=False, **operation_config): + self, project_id, batch, custom_headers=None, raw=False, **operation_config): """Add the provided batch of images to the set of training images. This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags. + If all images are successful created, 200(OK) status code will be + returned. + Otherwise, 207 (Multi-Status) status code will be returned and detail + status for each image will be listed in the response payload. :param project_id: The project id. :type project_id: str - :param images: - :type images: - list[~azure.cognitiveservices.vision.customvision.training.models.ImageFileCreateEntry] - :param tag_ids: - :type tag_ids: list[str] + :param batch: The batch of image files to add. Limited to 64 images + and 20 tags per batch. + :type batch: + ~azure.cognitiveservices.vision.customvision.training.models.ImageFileCreateBatch :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -668,8 +917,6 @@ def create_images_from_files( :raises: :class:`CustomVisionErrorException` """ - batch = models.ImageFileCreateBatch(images=images, tag_ids=tag_ids) - # Construct URL url = self.create_images_from_files.metadata['url'] path_format_arguments = { @@ -695,12 +942,14 @@ def create_images_from_files( 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]: + if response.status_code not in [200, 207]: raise models.CustomVisionErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('ImageCreateSummary', response) + if response.status_code == 207: + deserialized = self._deserialize('ImageCreateSummary', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -774,20 +1023,92 @@ def get_images_by_ids( return deserialized get_images_by_ids.metadata = {'url': '/projects/{projectId}/images/id'} + def update_image_metadata( + self, project_id, image_ids, metadata, custom_headers=None, raw=False, **operation_config): + """Update metadata of images. + + This API accepts a batch of image Ids, and metadata, to update images. + There is a limit of 64 images. + + :param project_id: The project id. + :type project_id: str + :param image_ids: The list of image ids to update. Limited to 64. + :type image_ids: list[str] + :param metadata: The metadata to be updated to the specified images. + Limited to 50 key-value pairs per image. The length of key is limited + to 256. The length of value is limited to 512. + :type metadata: dict[str, 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: ImageMetadataUpdateSummary or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.vision.customvision.training.models.ImageMetadataUpdateSummary + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`CustomVisionErrorException` + """ + # Construct URL + url = self.update_image_metadata.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'projectId': self._serialize.url("project_id", project_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['imageIds'] = self._serialize.query("image_ids", image_ids, '[str]', div=',', max_items=256, min_items=0) + + # 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(metadata, '{str}') + + # 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, 207]: + raise models.CustomVisionErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ImageMetadataUpdateSummary', response) + if response.status_code == 207: + deserialized = self._deserialize('ImageMetadataUpdateSummary', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update_image_metadata.metadata = {'url': '/projects/{projectId}/images/metadata'} + def create_images_from_predictions( - self, project_id, images=None, tag_ids=None, custom_headers=None, raw=False, **operation_config): + self, project_id, batch, custom_headers=None, raw=False, **operation_config): """Add the specified predicted images to the set of training images. This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. + If all images are successful created, 200(OK) status code will be + returned. + Otherwise, 207 (Multi-Status) status code will be returned and detail + status for each image will be listed in the response payload. :param project_id: The project id. :type project_id: str - :param images: - :type images: - list[~azure.cognitiveservices.vision.customvision.training.models.ImageIdCreateEntry] - :param tag_ids: - :type tag_ids: list[str] + :param batch: Image, tag ids, and metadata. Limited to 64 images and + 20 tags per batch. + :type batch: + ~azure.cognitiveservices.vision.customvision.training.models.ImageIdCreateBatch :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -800,8 +1121,6 @@ def create_images_from_predictions( :raises: :class:`CustomVisionErrorException` """ - batch = models.ImageIdCreateBatch(images=images, tag_ids=tag_ids) - # Construct URL url = self.create_images_from_predictions.metadata['url'] path_format_arguments = { @@ -827,12 +1146,14 @@ def create_images_from_predictions( 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]: + if response.status_code not in [200, 207]: raise models.CustomVisionErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('ImageCreateSummary', response) + if response.status_code == 207: + deserialized = self._deserialize('ImageCreateSummary', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -848,6 +1169,10 @@ def create_image_regions( This API accepts a batch of image regions, and optionally tags, to update existing images with region information. There is a limit of 64 entries in the batch. + If all regions are successful created, 200(OK) status code will be + returned. + Otherwise, 207 (Multi-Status) status code will be returned and detail + status for each region will be listed in the response payload. :param project_id: The project id. :type project_id: str @@ -893,12 +1218,14 @@ def create_image_regions( 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]: + if response.status_code not in [200, 207]: raise models.CustomVisionErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('ImageRegionCreateSummary', response) + if response.status_code == 207: + deserialized = self._deserialize('ImageRegionCreateSummary', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -1494,19 +1821,22 @@ def get_untagged_image_count( get_untagged_image_count.metadata = {'url': '/projects/{projectId}/images/untagged/count'} def create_images_from_urls( - self, project_id, images=None, tag_ids=None, custom_headers=None, raw=False, **operation_config): + self, project_id, batch, custom_headers=None, raw=False, **operation_config): """Add the provided images urls to the set of training images. This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags. + If all images are successful created, 200(OK) status code will be + returned. + Otherwise, 207 (Multi-Status) status code will be returned and detail + status for each image will be listed in the response payload. :param project_id: The project id. :type project_id: str - :param images: - :type images: - list[~azure.cognitiveservices.vision.customvision.training.models.ImageUrlCreateEntry] - :param tag_ids: - :type tag_ids: list[str] + :param batch: Image urls, tag ids, and metadata. Limited to 64 images + and 20 tags per batch. + :type batch: + ~azure.cognitiveservices.vision.customvision.training.models.ImageUrlCreateBatch :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1519,8 +1849,6 @@ def create_images_from_urls( :raises: :class:`CustomVisionErrorException` """ - batch = models.ImageUrlCreateBatch(images=images, tag_ids=tag_ids) - # Construct URL url = self.create_images_from_urls.metadata['url'] path_format_arguments = { @@ -1546,12 +1874,14 @@ def create_images_from_urls( 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]: + if response.status_code not in [200, 207]: raise models.CustomVisionErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('ImageCreateSummary', response) + if response.status_code == 207: + deserialized = self._deserialize('ImageCreateSummary', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -2119,7 +2449,7 @@ def get_image_performance_count( get_image_performance_count.metadata = {'url': '/projects/{projectId}/iterations/{iterationId}/performance/images/count'} def publish_iteration( - self, project_id, iteration_id, publish_name, prediction_id, custom_headers=None, raw=False, **operation_config): + self, project_id, iteration_id, publish_name, prediction_id, overwrite=None, custom_headers=None, raw=False, **operation_config): """Publish a specific iteration. :param project_id: The project id. @@ -2130,6 +2460,9 @@ def publish_iteration( :type publish_name: str :param prediction_id: The id of the prediction resource to publish to. :type prediction_id: str + :param overwrite: Whether to overwrite the published model with the + given name (default: false). + :type overwrite: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -2153,6 +2486,8 @@ def publish_iteration( query_parameters = {} query_parameters['publishName'] = self._serialize.query("publish_name", publish_name, 'str') query_parameters['predictionId'] = self._serialize.query("prediction_id", prediction_id, 'str') + if overwrite is not None: + query_parameters['overwrite'] = self._serialize.query("overwrite", overwrite, 'bool') # Construct headers header_parameters = {} @@ -2547,7 +2882,7 @@ def create_tag( :param description: Optional description for the tag. :type description: str :param type: Optional type for the tag. Possible values include: - 'Regular', 'Negative' + 'Regular', 'Negative', 'GeneralProduct' :type type: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -2926,11 +3261,14 @@ def train_project( train_project.metadata = {'url': '/projects/{projectId}/train'} def import_project( - self, token, custom_headers=None, raw=False, **operation_config): + self, token, name=None, custom_headers=None, raw=False, **operation_config): """Imports a project. :param token: Token generated from the export project call. :type token: str + :param name: Optional, name of the project to use instead of + auto-generated name. + :type name: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -2953,6 +3291,8 @@ def import_project( # Construct parameters query_parameters = {} query_parameters['token'] = self._serialize.query("token", token, 'str') + if name is not None: + query_parameters['name'] = self._serialize.query("name", name, 'str') # Construct headers header_parameters = {} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/version.py b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/version.py index a89ae9805392..69dfaa9ef877 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/version.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/version.py @@ -9,4 +9,4 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "3.0.0"