다음을 통해 공유


Images - Create 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.

POST {Endpoint}/customvision/v3.3/training/projects/{projectId}/images
POST {Endpoint}/customvision/v3.3/training/projects/{projectId}/images?tagIds={tagIds}

URI Parameters

Name In Required Type Description
imageData
formData True

file

Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB.

Endpoint
path True

string

Supported Cognitive Services endpoints.

projectId
path True

string

uuid

The project id.

tagIds
query

string[]

The tags ids with which to tag each image. Limited to 20.

Request Header

Media Types: "multipart/form-data", "application/octet-stream"

Name Required Type Description
Training-Key True

string

Responses

Name Type Description
200 OK

ImageCreateSummary

OK

Media Types: "application/json", "application/xml", "text/xml"

Other Status Codes

ImageCreateSummary

207

Media Types: "application/json", "application/xml", "text/xml"

Other Status Codes

CustomVisionError

Error response

Media Types: "application/json", "application/xml", "text/xml"

Security

Training-Key

Type: apiKey
In: header

Examples

Successful CreateImagesFromData request

Sample request

POST https://westus.api.cognitive.microsoft.com/customvision/v3.3/training/projects/64b822c5-8082-4b36-a426-27225f4aa18c/images?tagIds=b607964f-7bd6-4a3b-a869-6791fb6aab87

Sample response

{
  "isBatchSuccessful": true,
  "images": [
    {
      "sourceUrl": "\"hemlock_10.jpg\"",
      "status": "OK",
      "image": {
        "id": "4d6eb844-42ee-42bc-bd6f-c32455ef07c9",
        "created": "2017-12-19T15:56:10Z",
        "width": 1095,
        "height": 900,
        "resizedImageUri": "{Resized Image Uri}",
        "originalImageUri": "{Image Uri}",
        "thumbnailUri": "{Thumbnail Uri}",
        "tags": [
          {
            "tagId": "b607964f-7bd6-4a3b-a869-6791fb6aab87",
            "created": "2017-12-19T15:56:09Z",
            "tagName": "tag 1"
          }
        ]
      }
    },
    {
      "sourceUrl": "\"hemlock_6.jpg\"",
      "status": "OK",
      "image": {
        "id": "f1855a92-b873-47e7-b513-f07a667ceda1",
        "created": "2017-12-19T15:56:10Z",
        "width": 900,
        "height": 1531,
        "resizedImageUri": "{Resized Image Uri}",
        "originalImageUri": "{Image Uri}",
        "thumbnailUri": "{Thumbnail Uri}",
        "tags": [
          {
            "tagId": "b607964f-7bd6-4a3b-a869-6791fb6aab87",
            "created": "2017-12-19T15:56:09Z",
            "tagName": "tag 1"
          }
        ]
      }
    }
  ]
}
{
  "isBatchSuccessful": false,
  "images": [
    {
      "sourceUrl": "\"hemlock_10.jpg\"",
      "status": "OK",
      "image": {
        "id": "4d6eb844-42ee-42bc-bd6f-c32455ef07c9",
        "created": "2017-12-19T15:56:10Z",
        "width": 1095,
        "height": 900,
        "resizedImageUri": "{Resized Image Uri}",
        "originalImageUri": "{Image Uri}",
        "thumbnailUri": "{Thumbnail Uri}",
        "tags": [
          {
            "tagId": "b607964f-7bd6-4a3b-a869-6791fb6aab87",
            "created": "2017-12-19T15:56:09Z",
            "tagName": "tag 1"
          }
        ]
      }
    },
    {
      "sourceUrl": "\"hemlock_6.jpg\"",
      "status": "ErrorLimitExceed"
    }
  ]
}

Definitions

Name Description
CustomVisionError
CustomVisionErrorCodes

The error code.

Image

Image model to be sent as JSON.

ImageCreateResult
ImageCreateStatus

Status of the image creation.

ImageCreateSummary
ImageRegion
ImageTag

CustomVisionError

Name Type Description
code

CustomVisionErrorCodes

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

Image

Image model to be sent as JSON.

Name Type Description
created

string

Date the image was created.

height

integer

Height of the image.

id

string

Id of the image.

metadata

object

Metadata associated with this image.

originalImageUri

string

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.

regions

ImageRegion[]

Regions associated with this image.

resizedImageUri

string

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.

tags

ImageTag[]

Tags associated with this image.

thumbnailUri

string

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.

width

integer

Width of the image.

ImageCreateResult

Name Type Description
image

Image

The image.

sourceUrl

string

Source URL of the image.

status

ImageCreateStatus

Status of the image creation.

ImageCreateStatus

Status of the image creation.

Value Description
ErrorImageFormat
ErrorImageSize
ErrorLimitExceed
ErrorNegativeAndRegularTagOnSameImage
ErrorRegionLimitExceed
ErrorSource
ErrorStorage
ErrorTagLimitExceed
ErrorUnknown
OK
OKDuplicate

ImageCreateSummary

Name Type Description
images

ImageCreateResult[]

List of the image creation results.

isBatchSuccessful

boolean

True if all of the images in the batch were created successfully, otherwise false.

ImageRegion

Name Type Description
created

string

height

number

Height.

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.

ImageTag

Name Type Description
created

string

tagId

string

tagName

string