CreateModel - Amazon Lookout for Vision API Reference

CreateModel

Creates a new version of a model within an an Amazon Lookout for Vision project. CreateModel is an asynchronous operation in which Amazon Lookout for Vision trains, tests, and evaluates a new version of a model.

To get the current status, check the Status field returned in the response from DescribeModel .

If the project has a single dataset, Amazon Lookout for Vision internally splits the dataset to create a training and a test dataset. If the project has a training and a test dataset, Lookout for Vision uses the respective datasets to train and test the model.

After training completes, the evaluation metrics are stored at the location specified in OutputConfig.

This operation requires permissions to perform the lookoutvision:CreateModel operation. If you want to tag your model, you also require permission to the lookoutvision:TagResource operation.

Request Syntax

POST /2020-11-20/projects/projectName/models HTTP/1.1 X-Amzn-Client-Token: ClientToken Content-type: application/json { "Description": "string", "KmsKeyId": "string", "OutputConfig": { "S3Location": { "Bucket": "string", "Prefix": "string" } }, "Tags": [ { "Key": "string", "Value": "string" } ] }

URI Request Parameters

The request uses the following URI parameters.

ClientToken

ClientToken is an idempotency token that ensures a call to CreateModel completes only once. You choose the value to pass. For example, An issue might prevent you from getting a response from CreateModel. In this case, safely retry your call to CreateModel by using the same ClientToken parameter value.

If you don't supply a value for ClientToken, the AWS SDK you are using inserts a value for you. This prevents retries after a network error from starting multiple training jobs. You'll need to provide your own value for other use cases.

An error occurs if the other input parameters are not the same as in the first request. Using a different value for ClientToken is considered a new call to CreateModel. An idempotency token is active for 8 hours.

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: ^[a-zA-Z0-9-]+$

projectName

The name of the project in which you want to create a model version.

Length Constraints: Minimum length of 1. Maximum length of 255.

Pattern: [a-zA-Z0-9][a-zA-Z0-9_\-]*

Required: Yes

Request Body

The request accepts the following data in JSON format.

Description

A description for the version of the model.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 500.

Pattern: [0-9A-Za-z\.\-_]*

Required: No

KmsKeyId

The identifier for your AWS KMS key. The key is used to encrypt training and test images copied into the service for model training. Your source images are unaffected. If this parameter is not specified, the copied images are encrypted by a key that AWS owns and manages.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2048.

Pattern: ^[A-Za-z0-9][A-Za-z0-9:_/+=,@.-]{0,2048}$

Required: No

OutputConfig

The location where Amazon Lookout for Vision saves the training results.

Type: OutputConfig object

Required: Yes

Tags

A set of tags (key-value pairs) that you want to attach to the model.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No

Response Syntax

HTTP/1.1 202 Content-type: application/json { "ModelMetadata": { "CreationTimestamp": number, "Description": "string", "ModelArn": "string", "ModelVersion": "string", "Performance": { "F1Score": number, "Precision": number, "Recall": number }, "Status": "string", "StatusMessage": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 202 response.

The following data is returned in JSON format by the service.

ModelMetadata

The response from a call to CreateModel.

Type: ModelMetadata object

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

You are not authorized to perform the action.

HTTP Status Code: 403

ConflictException

The update or deletion of a resource caused an inconsistent state.

HTTP Status Code: 409

InternalServerException

Amazon Lookout for Vision experienced a service issue. Try your call again.

HTTP Status Code: 500

ResourceNotFoundException

The resource could not be found.

HTTP Status Code: 404

ServiceQuotaExceededException

A service quota was exceeded the allowed limit. For more information, see Limits in Amazon Lookout for Vision in the Amazon Lookout for Vision Developer Guide.

HTTP Status Code: 402

ThrottlingException

Amazon Lookout for Vision is temporarily unable to process the request. Try your call again.

HTTP Status Code: 429

ValidationException

An input validation error occured. For example, invalid characters in a project name, or if a pagination token is invalid.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: