Images - Create 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.
POST {Endpoint}/customvision/v3.3/training/projects/{projectId}/images/regions
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
Endpoint
|
path | True |
string |
Supported Cognitive Services endpoints. |
project
|
path | True |
string uuid |
The project id. |
Request Header
Media Types: "application/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"
Name | Required | Type | Description |
---|---|---|---|
Training-Key | True |
string |
Request Body
Media Types: "application/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"
Name | Type | Description |
---|---|---|
regions |
Entry associating a region to an image. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK Media Types: "application/json", "application/xml", "text/xml" |
|
Other Status Codes |
207 Media Types: "application/json", "application/xml", "text/xml" |
|
Other Status Codes |
Error response Media Types: "application/json", "application/xml", "text/xml" |
Security
Training-Key
Type:
apiKey
In:
header
Examples
Successful CreateImageRegions request
Sample request
POST https://westus.api.cognitive.microsoft.com/customvision/v3.3/training/projects/bc3f7dad-5544-468c-8573-3ef04d55463e/images/regions
{
"regions": [
{
"imageId": "4d6eb844-42ee-42bc-bd6f-c32455ef07c9",
"tagId": "b607964f-7bd6-4a3b-a869-6791fb6aab87",
"left": 0.25,
"top": 0.25,
"width": 0.25,
"height": 0.25
},
{
"imageId": "4d6eb844-42ee-42bc-bd6f-c32455ef07c9",
"tagId": "b607964f-7bd6-4a3b-a869-6791fb6aab87",
"left": 0.35,
"top": 0.35,
"width": 0.25,
"height": 0.25
}
]
}
Sample response
{
"created": [
{
"imageId": "4d6eb844-42ee-42bc-bd6f-c32455ef07c9",
"tagId": "b607964f-7bd6-4a3b-a869-6791fb6aab87",
"left": 0.25,
"top": 0.25,
"width": 0.25,
"height": 0.25
},
{
"imageId": "4d6eb844-42ee-42bc-bd6f-c32455ef07c9",
"tagId": "b607964f-7bd6-4a3b-a869-6791fb6aab87",
"left": 0.35,
"top": 0.35,
"width": 0.25,
"height": 0.25
}
],
"duplicated": [],
"exceeded": []
}
{
"created": [
{
"imageId": "4d6eb844-42ee-42bc-bd6f-c32455ef07c9",
"tagId": "b607964f-7bd6-4a3b-a869-6791fb6aab87",
"left": 0.25,
"top": 0.25,
"width": 0.25,
"height": 0.25
}
],
"duplicated": [],
"exceeded": [
{
"imageId": "4d6eb844-42ee-42bc-bd6f-c32455ef07c9",
"tagId": "b607964f-7bd6-4a3b-a869-6791fb6aab87",
"left": 0.35,
"top": 0.35,
"width": 0.25,
"height": 0.25
}
]
}
Definitions
Name | Description |
---|---|
Custom |
|
Custom |
The error code. |
Image |
Batch of image region information to create. |
Image |
Entry associating a region to an image. |
Image |
|
Image |
CustomVisionError
Name | Type | Description |
---|---|---|
code |
The error code. |
|
message |
string |
A message explaining the error reported by the service. |
CustomVisionErrorCodes
The error code.
Value | Description |
---|---|
BadRequest | |
BadRequestCannotMigrateProjectWithName | |
BadRequestClassificationTrainingValidationFailed | |
BadRequestCustomerManagedKeyRevoked | |
BadRequestDetectionTrainingNotAllowNegativeTag | |
BadRequestDetectionTrainingValidationFailed | |
BadRequestDomainNotSupportedForAdvancedTraining | |
BadRequestExceedIterationPerProjectLimit | |
BadRequestExceedProjectLimit | |
BadRequestExceedTagPerImageLimit | |
BadRequestExceedTagPerProjectLimit | |
BadRequestExceededBatchSize | |
BadRequestExceededQuota | |
BadRequestExportAlreadyInProgress | |
BadRequestExportPlatformNotSupportedForAdvancedTraining | |
BadRequestExportValidationFailed | |
BadRequestExportWhileTraining | |
BadRequestImageBatch | |
BadRequestImageDimensions | |
BadRequestImageExceededCount | |
BadRequestImageFormat | |
BadRequestImageMetadataKey | |
BadRequestImageMetadataValue | |
BadRequestImageRegions | |
BadRequestImageSizeBytes | |
BadRequestImageStream | |
BadRequestImageTags | |
BadRequestImageUrl | |
BadRequestInvalid | |
BadRequestInvalidArtifactUri | |
BadRequestInvalidEmailAddress | |
BadRequestInvalidIds | |
BadRequestInvalidImportToken | |
BadRequestInvalidPublishName | |
BadRequestInvalidPublishTarget | |
BadRequestIterationDescription | |
BadRequestIterationIsNotTrained | |
BadRequestIterationIsPublished | |
BadRequestIterationName | |
BadRequestIterationNameNotUnique | |
BadRequestIterationNotPublished | |
BadRequestIterationValidationFailed | |
BadRequestMultiClassClassificationTrainingValidationFailed | |
BadRequestMultiLabelClassificationTrainingValidationFailed | |
BadRequestMultipleGeneralProductTag | |
BadRequestMultipleNegativeTag | |
BadRequestNegativeAndRegularTagOnSameImage | |
BadRequestNotLimitedTrial | |
BadRequestNotSupported | |
BadRequestOperationNotSupported | |
BadRequestPredictionIdsExceededCount | |
BadRequestPredictionIdsMissing | |
BadRequestPredictionInvalidApplicationName | |
BadRequestPredictionInvalidQueryParameters | |
BadRequestPredictionResultsExceededCount | |
BadRequestPredictionTagsExceededCount | |
BadRequestProjectDescription | |
BadRequestProjectDuplicated | |
BadRequestProjectImagePreprocessingSettings | |
BadRequestProjectName | |
BadRequestProjectNameNotUnique | |
BadRequestProjectUnknownClassification | |
BadRequestProjectUnknownDomain | |
BadRequestProjectUnsupportedDomainTypeChange | |
BadRequestProjectUnsupportedExportPlatform | |
BadRequestRequiredParamIsNull | |
BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining | |
BadRequestSubscriptionApi | |
BadRequestTagDescription | |
BadRequestTagName | |
BadRequestTagNameNotUnique | |
BadRequestTagType | |
BadRequestTrainingAlreadyInProgress | |
BadRequestTrainingNotNeeded | |
BadRequestTrainingNotNeededButTrainingPipelineUpdated | |
BadRequestTrainingValidationFailed | |
BadRequestUnpublishFailed | |
BadRequestUnsupportedDomain | |
BadRequestWorkspaceCannotBeModified | |
BadRequestWorkspaceNotDeletable | |
Conflict | |
ConflictInvalid | |
ErrorExporterInvalidClassifier | |
ErrorExporterInvalidFeaturizer | |
ErrorExporterInvalidPlatform | |
ErrorFeaturizationAugmentationError | |
ErrorFeaturizationAugmentationUnavailable | |
ErrorFeaturizationInvalidFeaturizer | |
ErrorFeaturizationQueueTimeout | |
ErrorFeaturizationServiceUnavailable | |
ErrorFeaturizationUnrecognizedJob | |
ErrorInvalid | |
ErrorIterationCopyFailed | |
ErrorPrediction | |
ErrorPredictionModelNotCached | |
ErrorPredictionModelNotFound | |
ErrorPredictionServiceUnavailable | |
ErrorPredictionStorage | |
ErrorPreparePerformanceMigrationFailed | |
ErrorProjectExportRequestFailed | |
ErrorProjectImportRequestFailed | |
ErrorProjectInvalidDomain | |
ErrorProjectInvalidPipelineConfiguration | |
ErrorProjectInvalidWorkspace | |
ErrorProjectTrainingRequestFailed | |
ErrorRegionProposal | |
ErrorUnknown | |
ErrorUnknownBaseModel | |
Forbidden | |
ForbiddenDRModeEnabled | |
ForbiddenInvalid | |
ForbiddenUser | |
ForbiddenUserDisabled | |
ForbiddenUserDoesNotExist | |
ForbiddenUserInsufficientCapability | |
ForbiddenUserResource | |
ForbiddenUserSignupAllowanceExceeded | |
ForbiddenUserSignupDisabled | |
NoError | |
NotFound | |
NotFoundApimSubscription | |
NotFoundDomain | |
NotFoundImage | |
NotFoundInvalid | |
NotFoundIteration | |
NotFoundIterationPerformance | |
NotFoundProject | |
NotFoundProjectDefaultIteration | |
NotFoundTag | |
UnsupportedMediaType |
ImageRegionCreateBatch
Batch of image region information to create.
Name | Type | Description |
---|---|---|
regions |
Entry associating a region to an image. |
ImageRegionCreateEntry
Entry associating a region to an image.
Name | Type | Description |
---|---|---|
height |
number |
Height. |
imageId |
string |
Id of the image. |
left |
number |
Coordinate of the left boundary. |
tagId |
string |
Id of the tag associated with this region. |
top |
number |
Coordinate of the top boundary. |
width |
number |
Width. |
ImageRegionCreateResult
Name | Type | Description |
---|---|---|
created |
string |
|
height |
number |
Height. |
imageId |
string |
|
left |
number |
Coordinate of the left boundary. |
regionId |
string |
|
tagId |
string |
Id of the tag associated with this region. |
tagName |
string |
|
top |
number |
Coordinate of the top boundary. |
width |
number |
Width. |
ImageRegionCreateSummary
Name | Type | Description |
---|---|---|
created | ||
duplicated |
Entry associating a region to an image. |
|
exceeded |
Entry associating a region to an image. |