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 |
|---|---|
| NoError | |
| BadRequest | |
| BadRequestExceededBatchSize | |
| BadRequestNotSupported | |
| BadRequestInvalidIds | |
| BadRequestProjectName | |
| BadRequestProjectNameNotUnique | |
| BadRequestProjectDescription | |
| BadRequestProjectUnknownDomain | |
| BadRequestProjectUnknownClassification | |
| BadRequestProjectUnsupportedDomainTypeChange | |
| BadRequestProjectUnsupportedExportPlatform | |
| BadRequestProjectImagePreprocessingSettings | |
| BadRequestProjectDuplicated | |
| BadRequestIterationName | |
| BadRequestIterationNameNotUnique | |
| BadRequestIterationDescription | |
| BadRequestIterationIsNotTrained | |
| BadRequestIterationValidationFailed | |
| BadRequestWorkspaceCannotBeModified | |
| BadRequestWorkspaceNotDeletable | |
| BadRequestTagName | |
| BadRequestTagNameNotUnique | |
| BadRequestTagDescription | |
| BadRequestTagType | |
| 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 | |
| BadRequestImageDimensions | |
| BadRequestImageExceededCount | |
| BadRequestTrainingNotNeeded | |
| BadRequestTrainingNotNeededButTrainingPipelineUpdated | |
| BadRequestTrainingValidationFailed | |
| BadRequestClassificationTrainingValidationFailed | |
| BadRequestMultiClassClassificationTrainingValidationFailed | |
| BadRequestMultiLabelClassificationTrainingValidationFailed | |
| BadRequestDetectionTrainingValidationFailed | |
| BadRequestTrainingAlreadyInProgress | |
| BadRequestDetectionTrainingNotAllowNegativeTag | |
| BadRequestInvalidEmailAddress | |
| BadRequestDomainNotSupportedForAdvancedTraining | |
| BadRequestExportPlatformNotSupportedForAdvancedTraining | |
| BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining | |
| BadRequestExportValidationFailed | |
| BadRequestExportAlreadyInProgress | |
| BadRequestPredictionIdsMissing | |
| BadRequestPredictionIdsExceededCount | |
| BadRequestPredictionTagsExceededCount | |
| BadRequestPredictionResultsExceededCount | |
| BadRequestPredictionInvalidApplicationName | |
| BadRequestPredictionInvalidQueryParameters | |
| BadRequestInvalidImportToken | |
| BadRequestExportWhileTraining | |
| BadRequestImageMetadataKey | |
| BadRequestImageMetadataValue | |
| BadRequestOperationNotSupported | |
| BadRequestInvalidArtifactUri | |
| BadRequestCustomerManagedKeyRevoked | |
| BadRequestInvalid | |
| UnsupportedMediaType | |
| Forbidden | |
| ForbiddenUser | |
| ForbiddenUserResource | |
| ForbiddenUserSignupDisabled | |
| ForbiddenUserSignupAllowanceExceeded | |
| ForbiddenUserDoesNotExist | |
| ForbiddenUserDisabled | |
| ForbiddenUserInsufficientCapability | |
| ForbiddenDRModeEnabled | |
| ForbiddenInvalid | |
| NotFound | |
| NotFoundProject | |
| NotFoundProjectDefaultIteration | |
| NotFoundIteration | |
| NotFoundIterationPerformance | |
| NotFoundTag | |
| NotFoundImage | |
| NotFoundDomain | |
| NotFoundApimSubscription | |
| NotFoundInvalid | |
| Conflict | |
| ConflictInvalid | |
| ErrorUnknown | |
| ErrorIterationCopyFailed | |
| ErrorPreparePerformanceMigrationFailed | |
| ErrorProjectInvalidWorkspace | |
| ErrorProjectInvalidPipelineConfiguration | |
| ErrorProjectInvalidDomain | |
| ErrorProjectTrainingRequestFailed | |
| ErrorProjectImportRequestFailed | |
| ErrorProjectExportRequestFailed | |
| ErrorFeaturizationServiceUnavailable | |
| ErrorFeaturizationQueueTimeout | |
| ErrorFeaturizationInvalidFeaturizer | |
| ErrorFeaturizationAugmentationUnavailable | |
| ErrorFeaturizationUnrecognizedJob | |
| ErrorFeaturizationAugmentationError | |
| ErrorExporterInvalidPlatform | |
| ErrorExporterInvalidFeaturizer | |
| ErrorExporterInvalidClassifier | |
| ErrorPredictionServiceUnavailable | |
| ErrorPredictionModelNotFound | |
| ErrorPredictionModelNotCached | |
| ErrorPrediction | |
| ErrorPredictionStorage | |
| ErrorRegionProposal | |
| ErrorUnknownBaseModel | |
| ErrorInvalid |
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 (float) |
Height. |
| imageId |
string (uuid) |
Id of the image. |
| left |
number (float) |
Coordinate of the left boundary. |
| tagId |
string (uuid) |
Id of the tag associated with this region. |
| top |
number (float) |
Coordinate of the top boundary. |
| width |
number (float) |
Width. |
ImageRegionCreateResult
| Name | Type | Description |
|---|---|---|
| created |
string (date-time) |
|
| height |
number (float) |
Height. |
| imageId |
string (uuid) |
|
| left |
number (float) |
Coordinate of the left boundary. |
| regionId |
string (uuid) |
|
| tagId |
string (uuid) |
Id of the tag associated with this region. |
| tagName |
string |
|
| top |
number (float) |
Coordinate of the top boundary. |
| width |
number (float) |
Width. |
ImageRegionCreateSummary
| Name | Type | Description |
|---|---|---|
| created | ||
| duplicated |
Entry associating a region to an image. |
|
| exceeded |
Entry associating a region to an image. |