Skip to content

Commit b678123

Browse files
AutorestCIlmazuel
authored andcommitted
[AutoPR cognitiveservices/data-plane/CustomVision/Training/cognitiveservices/data-plane/CustomVision/Prediction] Add Custom Vision 3.0 API (Azure#4321)
* Generated from 1630f5cb8b1aa7cfc7a7c197314cce790d30b9b8 Add examples for v3.0 Prediction Endpoint * Packaging update of azure-cognitiveservices-vision-customvision * Generated from eebaa5a8e8f1f30d9688d8f8f79f570ca5ef8df3 Add examples for v3.0 * Generated from dd550d7caa1acd50b4ed7ba1f7d86f56b8c3975b Update Training API * Generated from dbcb8fc77937f546d431b904d13442140041eb49 Fix java defaults * Generated from 370169abdf402f69926ea95090bfd7a16965be25 Rename arg, update comment. * Packaging update of azure-cognitiveservices-vision-customvision * Generated from 1569f403797a5e34f098a04d0d69c5d4678bbbac Remove text/json * Packaging update of azure-cognitiveservices-vision-customvision * Generated from 5a874832754b7eb77befdb2e49d2123478896da5 Update required / x-nullable usage Fix Prediction and examples Fix Training API and examples * Generated from 2cd4f8e34ca378f2e83d492d91b745ca83f50d2d Fix required/readonly * Generated from 28061f5764b1232660469010b44c16d5a91a116e Fix required/readonly * Generated from 47d990ef0e304c8b3d7dd30987d1d7ef9e6e55c6 Fix required/readonly * Generated from 5adc21c930bdad8bccc0fbb82ac7c049aae4b9b0 Add missing field * Generated from 79d1c5ef4f2f3e560fb15ffe3f439e8a8fbf13bd Update HttpDelete operation to be consistent. * Generated from 88b8b15c44d7c0f1fad2ba6d8bbad585ca4d8150 Add missing error. * 1.0.0 * Fix changeLog
1 parent bf5e3d9 commit b678123

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1805
-415
lines changed

azure-cognitiveservices-vision-customvision/HISTORY.rst

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
Release History
44
===============
55

6+
1.0.0 (2019-03-22)
7+
++++++++++++++++++
8+
9+
This is a stable release of the Cognitive Services Custom Vision SDK.
10+
11+
**Training**
12+
13+
- Added an advanced training option to set a budget to train longer for improved iteration performance.
14+
- Added additional export options targetting Vision AI Dev Kit and Docker ARM for Raspberry Pi.
15+
16+
**Prediction**
17+
18+
- PredictImage and PredictImageUrl have been replaced with project type specific calls.
19+
ClassifyImage and ClassifyImageUrl for image classification projects.
20+
DetectImage and DetectImageUrl for object detection projects .
21+
- Prediction methods now take a name to designate which published iteration to use. Iterations can be published using the Custom Vision Training SDK.
22+
623
0.4.0 (2018-11-13)
724
++++++++++++++++++
825

azure-cognitiveservices-vision-customvision/MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
recursive-include tests *.py *.yaml
12
include *.rst
23
include azure/__init__.py
34
include azure/cognitiveservices/__init__.py

azure-cognitiveservices-vision-customvision/README.rst

-19
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,6 @@ This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7.
88
For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/azure>`__ bundle package.
99

1010

11-
Compatibility
12-
=============
13-
14-
**IMPORTANT**: If you have an earlier version of the azure package
15-
(version < 1.0), you should uninstall it before installing this package.
16-
17-
You can check the version using pip:
18-
19-
.. code:: shell
20-
21-
pip freeze
22-
23-
If you see azure==0.11.0 (or any version below 1.0), uninstall it first:
24-
25-
.. code:: shell
26-
27-
pip uninstall azure
28-
29-
3011
Usage
3112
=====
3213

azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/custom_vision_prediction_client.py

+358-75
Large diffs are not rendered by default.

azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@
1414
from .bounding_box_py3 import BoundingBox
1515
from .prediction_py3 import Prediction
1616
from .image_prediction_py3 import ImagePrediction
17+
from .custom_vision_error_py3 import CustomVisionError, CustomVisionErrorException
1718
except (SyntaxError, ImportError):
1819
from .image_url import ImageUrl
1920
from .bounding_box import BoundingBox
2021
from .prediction import Prediction
2122
from .image_prediction import ImagePrediction
23+
from .custom_vision_error import CustomVisionError, CustomVisionErrorException
24+
from .custom_vision_prediction_client_enums import (
25+
CustomVisionErrorCodes,
26+
)
2227

2328
__all__ = [
2429
'ImageUrl',
2530
'BoundingBox',
2631
'Prediction',
2732
'ImagePrediction',
33+
'CustomVisionError', 'CustomVisionErrorException',
34+
'CustomVisionErrorCodes',
2835
]

azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/bounding_box.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,27 @@
1313

1414

1515
class BoundingBox(Model):
16-
"""BoundingBox.
16+
"""Bounding box that defines a region of an image.
1717
18-
:param left:
18+
All required parameters must be populated in order to send to Azure.
19+
20+
:param left: Required. Coordinate of the left boundary.
1921
:type left: float
20-
:param top:
22+
:param top: Required. Coordinate of the top boundary.
2123
:type top: float
22-
:param width:
24+
:param width: Required. Width.
2325
:type width: float
24-
:param height:
26+
:param height: Required. Height.
2527
:type height: float
2628
"""
2729

30+
_validation = {
31+
'left': {'required': True},
32+
'top': {'required': True},
33+
'width': {'required': True},
34+
'height': {'required': True},
35+
}
36+
2837
_attribute_map = {
2938
'left': {'key': 'left', 'type': 'float'},
3039
'top': {'key': 'top', 'type': 'float'},

azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/models/bounding_box_py3.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,35 @@
1313

1414

1515
class BoundingBox(Model):
16-
"""BoundingBox.
16+
"""Bounding box that defines a region of an image.
1717
18-
:param left:
18+
All required parameters must be populated in order to send to Azure.
19+
20+
:param left: Required. Coordinate of the left boundary.
1921
:type left: float
20-
:param top:
22+
:param top: Required. Coordinate of the top boundary.
2123
:type top: float
22-
:param width:
24+
:param width: Required. Width.
2325
:type width: float
24-
:param height:
26+
:param height: Required. Height.
2527
:type height: float
2628
"""
2729

30+
_validation = {
31+
'left': {'required': True},
32+
'top': {'required': True},
33+
'width': {'required': True},
34+
'height': {'required': True},
35+
}
36+
2837
_attribute_map = {
2938
'left': {'key': 'left', 'type': 'float'},
3039
'top': {'key': 'top', 'type': 'float'},
3140
'width': {'key': 'width', 'type': 'float'},
3241
'height': {'key': 'height', 'type': 'float'},
3342
}
3443

35-
def __init__(self, *, left: float=None, top: float=None, width: float=None, height: float=None, **kwargs) -> None:
44+
def __init__(self, *, left: float, top: float, width: float, height: float, **kwargs) -> None:
3645
super(BoundingBox, self).__init__(**kwargs)
3746
self.left = left
3847
self.top = top
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
from msrest.exceptions import HttpOperationError
14+
15+
16+
class CustomVisionError(Model):
17+
"""CustomVisionError.
18+
19+
All required parameters must be populated in order to send to Azure.
20+
21+
:param code: Required. The error code. Possible values include: 'NoError',
22+
'BadRequest', 'BadRequestExceededBatchSize', 'BadRequestNotSupported',
23+
'BadRequestInvalidIds', 'BadRequestProjectName',
24+
'BadRequestProjectNameNotUnique', 'BadRequestProjectDescription',
25+
'BadRequestProjectUnknownDomain',
26+
'BadRequestProjectUnknownClassification',
27+
'BadRequestProjectUnsupportedDomainTypeChange',
28+
'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName',
29+
'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription',
30+
'BadRequestIterationIsNotTrained', 'BadRequestWorkspaceCannotBeModified',
31+
'BadRequestWorkspaceNotDeletable', 'BadRequestTagName',
32+
'BadRequestTagNameNotUnique', 'BadRequestTagDescription',
33+
'BadRequestTagType', 'BadRequestMultipleNegativeTag',
34+
'BadRequestImageTags', 'BadRequestImageRegions',
35+
'BadRequestNegativeAndRegularTagOnSameImage',
36+
'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished',
37+
'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget',
38+
'BadRequestUnpublishFailed', 'BadRequestSubscriptionApi',
39+
'BadRequestExceedProjectLimit',
40+
'BadRequestExceedIterationPerProjectLimit',
41+
'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit',
42+
'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName',
43+
'BadRequestNotLimitedTrial', 'BadRequestImageBatch',
44+
'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat',
45+
'BadRequestImageSizeBytes', 'BadRequestImageExceededCount',
46+
'BadRequestTrainingNotNeeded',
47+
'BadRequestTrainingNotNeededButTrainingPipelineUpdated',
48+
'BadRequestTrainingValidationFailed',
49+
'BadRequestClassificationTrainingValidationFailed',
50+
'BadRequestMultiClassClassificationTrainingValidationFailed',
51+
'BadRequestMultiLabelClassificationTrainingValidationFailed',
52+
'BadRequestDetectionTrainingValidationFailed',
53+
'BadRequestTrainingAlreadyInProgress',
54+
'BadRequestDetectionTrainingNotAllowNegativeTag',
55+
'BadRequestInvalidEmailAddress',
56+
'BadRequestDomainNotSupportedForAdvancedTraining',
57+
'BadRequestExportPlatformNotSupportedForAdvancedTraining',
58+
'BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining',
59+
'BadRequestExportValidationFailed', 'BadRequestExportAlreadyInProgress',
60+
'BadRequestPredictionIdsMissing', 'BadRequestPredictionIdsExceededCount',
61+
'BadRequestPredictionTagsExceededCount',
62+
'BadRequestPredictionResultsExceededCount',
63+
'BadRequestPredictionInvalidApplicationName',
64+
'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid',
65+
'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser',
66+
'ForbiddenUserResource', 'ForbiddenUserSignupDisabled',
67+
'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist',
68+
'ForbiddenUserDisabled', 'ForbiddenUserInsufficientCapability',
69+
'ForbiddenDRModeEnabled', 'ForbiddenInvalid', 'NotFound',
70+
'NotFoundProject', 'NotFoundProjectDefaultIteration', 'NotFoundIteration',
71+
'NotFoundIterationPerformance', 'NotFoundTag', 'NotFoundImage',
72+
'NotFoundDomain', 'NotFoundApimSubscription', 'NotFoundInvalid',
73+
'Conflict', 'ConflictInvalid', 'ErrorUnknown',
74+
'ErrorProjectInvalidWorkspace',
75+
'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain',
76+
'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed',
77+
'ErrorFeaturizationServiceUnavailable', 'ErrorFeaturizationQueueTimeout',
78+
'ErrorFeaturizationInvalidFeaturizer',
79+
'ErrorFeaturizationAugmentationUnavailable',
80+
'ErrorFeaturizationUnrecognizedJob',
81+
'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform',
82+
'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier',
83+
'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound',
84+
'ErrorPredictionModelNotCached', 'ErrorPrediction',
85+
'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid'
86+
:type code: str or
87+
~azure.cognitiveservices.vision.customvision.prediction.models.CustomVisionErrorCodes
88+
:param message: Required. A message explaining the error reported by the
89+
service.
90+
:type message: str
91+
"""
92+
93+
_validation = {
94+
'code': {'required': True},
95+
'message': {'required': True},
96+
}
97+
98+
_attribute_map = {
99+
'code': {'key': 'code', 'type': 'str'},
100+
'message': {'key': 'message', 'type': 'str'},
101+
}
102+
103+
def __init__(self, **kwargs):
104+
super(CustomVisionError, self).__init__(**kwargs)
105+
self.code = kwargs.get('code', None)
106+
self.message = kwargs.get('message', None)
107+
108+
109+
class CustomVisionErrorException(HttpOperationError):
110+
"""Server responsed with exception of type: 'CustomVisionError'.
111+
112+
:param deserialize: A deserializer
113+
:param response: Server response to be deserialized.
114+
"""
115+
116+
def __init__(self, deserialize, response, *args):
117+
118+
super(CustomVisionErrorException, self).__init__(deserialize, response, 'CustomVisionError', *args)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from msrest.serialization import Model
13+
from msrest.exceptions import HttpOperationError
14+
15+
16+
class CustomVisionError(Model):
17+
"""CustomVisionError.
18+
19+
All required parameters must be populated in order to send to Azure.
20+
21+
:param code: Required. The error code. Possible values include: 'NoError',
22+
'BadRequest', 'BadRequestExceededBatchSize', 'BadRequestNotSupported',
23+
'BadRequestInvalidIds', 'BadRequestProjectName',
24+
'BadRequestProjectNameNotUnique', 'BadRequestProjectDescription',
25+
'BadRequestProjectUnknownDomain',
26+
'BadRequestProjectUnknownClassification',
27+
'BadRequestProjectUnsupportedDomainTypeChange',
28+
'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName',
29+
'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription',
30+
'BadRequestIterationIsNotTrained', 'BadRequestWorkspaceCannotBeModified',
31+
'BadRequestWorkspaceNotDeletable', 'BadRequestTagName',
32+
'BadRequestTagNameNotUnique', 'BadRequestTagDescription',
33+
'BadRequestTagType', 'BadRequestMultipleNegativeTag',
34+
'BadRequestImageTags', 'BadRequestImageRegions',
35+
'BadRequestNegativeAndRegularTagOnSameImage',
36+
'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished',
37+
'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget',
38+
'BadRequestUnpublishFailed', 'BadRequestSubscriptionApi',
39+
'BadRequestExceedProjectLimit',
40+
'BadRequestExceedIterationPerProjectLimit',
41+
'BadRequestExceedTagPerProjectLimit', 'BadRequestExceedTagPerImageLimit',
42+
'BadRequestExceededQuota', 'BadRequestCannotMigrateProjectWithName',
43+
'BadRequestNotLimitedTrial', 'BadRequestImageBatch',
44+
'BadRequestImageStream', 'BadRequestImageUrl', 'BadRequestImageFormat',
45+
'BadRequestImageSizeBytes', 'BadRequestImageExceededCount',
46+
'BadRequestTrainingNotNeeded',
47+
'BadRequestTrainingNotNeededButTrainingPipelineUpdated',
48+
'BadRequestTrainingValidationFailed',
49+
'BadRequestClassificationTrainingValidationFailed',
50+
'BadRequestMultiClassClassificationTrainingValidationFailed',
51+
'BadRequestMultiLabelClassificationTrainingValidationFailed',
52+
'BadRequestDetectionTrainingValidationFailed',
53+
'BadRequestTrainingAlreadyInProgress',
54+
'BadRequestDetectionTrainingNotAllowNegativeTag',
55+
'BadRequestInvalidEmailAddress',
56+
'BadRequestDomainNotSupportedForAdvancedTraining',
57+
'BadRequestExportPlatformNotSupportedForAdvancedTraining',
58+
'BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining',
59+
'BadRequestExportValidationFailed', 'BadRequestExportAlreadyInProgress',
60+
'BadRequestPredictionIdsMissing', 'BadRequestPredictionIdsExceededCount',
61+
'BadRequestPredictionTagsExceededCount',
62+
'BadRequestPredictionResultsExceededCount',
63+
'BadRequestPredictionInvalidApplicationName',
64+
'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid',
65+
'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser',
66+
'ForbiddenUserResource', 'ForbiddenUserSignupDisabled',
67+
'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist',
68+
'ForbiddenUserDisabled', 'ForbiddenUserInsufficientCapability',
69+
'ForbiddenDRModeEnabled', 'ForbiddenInvalid', 'NotFound',
70+
'NotFoundProject', 'NotFoundProjectDefaultIteration', 'NotFoundIteration',
71+
'NotFoundIterationPerformance', 'NotFoundTag', 'NotFoundImage',
72+
'NotFoundDomain', 'NotFoundApimSubscription', 'NotFoundInvalid',
73+
'Conflict', 'ConflictInvalid', 'ErrorUnknown',
74+
'ErrorProjectInvalidWorkspace',
75+
'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain',
76+
'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed',
77+
'ErrorFeaturizationServiceUnavailable', 'ErrorFeaturizationQueueTimeout',
78+
'ErrorFeaturizationInvalidFeaturizer',
79+
'ErrorFeaturizationAugmentationUnavailable',
80+
'ErrorFeaturizationUnrecognizedJob',
81+
'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform',
82+
'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier',
83+
'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound',
84+
'ErrorPredictionModelNotCached', 'ErrorPrediction',
85+
'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid'
86+
:type code: str or
87+
~azure.cognitiveservices.vision.customvision.prediction.models.CustomVisionErrorCodes
88+
:param message: Required. A message explaining the error reported by the
89+
service.
90+
:type message: str
91+
"""
92+
93+
_validation = {
94+
'code': {'required': True},
95+
'message': {'required': True},
96+
}
97+
98+
_attribute_map = {
99+
'code': {'key': 'code', 'type': 'str'},
100+
'message': {'key': 'message', 'type': 'str'},
101+
}
102+
103+
def __init__(self, *, code, message: str, **kwargs) -> None:
104+
super(CustomVisionError, self).__init__(**kwargs)
105+
self.code = code
106+
self.message = message
107+
108+
109+
class CustomVisionErrorException(HttpOperationError):
110+
"""Server responsed with exception of type: 'CustomVisionError'.
111+
112+
:param deserialize: A deserializer
113+
:param response: Server response to be deserialized.
114+
"""
115+
116+
def __init__(self, deserialize, response, *args):
117+
118+
super(CustomVisionErrorException, self).__init__(deserialize, response, 'CustomVisionError', *args)

0 commit comments

Comments
 (0)