Training your model
After you have created your datasets and labeled the images, you can train your model. As part of the training process, a test dataset is used. If you have a single dataset project, the images in the dataset are automatically split into a test dataset and a training dataset as part of the training process. If your project has a training and a test dataset, they are used to separately train and test the dataset.
After training is complete, you can evaluate the performance of the model and make any necessary improvements. For more information, see Improving your Amazon Lookout for Vision model.
To train your model, Amazon Lookout for Vision makes a copy of your source training and test images. By default the copied images are encrypted with a key that AWS owns and manages. You can also choose to use your own AWS Key Management Service (KMS) key. For more information, see AWS Key Management Service concepts. Your source images are unaffected.
You can assign metadata to your model in the form of tags. For more information, see Tagging models.
Each time you train a model, a new version of the model is created. If you no longer need a version of a model, you can delete it. For more information, see Deleting a model.
You are charged for the amount of time it takes to successfully train your model. For
more information, see Training
Hours
To view the existing models in a project, Viewing your models.
Note
If you've just completed Creating your dataset or Adding images to your dataset. The console should currently show your model dashboard and you don't need to do steps 1 - 4.
Training a model (console)
The following procedure shows you how to train your model using the console.
To train your model (console)
-
Open the Amazon Lookout for Vision console at https://console.aws.amazon.com/lookoutvision/
. -
In the left navigation pane, choose Projects.
-
In the Projects page, choose the project that contains the model that you want to train.
-
On the project details page, choose Train model. The Train model button is available if you have enough labeled images to train the model. If the button isn't available, add more images until you have enough labeled images.
-
(Optional) If you want to use your own AWS KMS encryption key, do the following:
-
In Image data encryption choose Customize encryption settings (advanced).
-
In encryption.aws_kms_key enter the Amazon Resource Name (ARN) of your key, or choose an existing AWS KMS key. To create a new key, choose Create an AWS IMS key.
-
-
(Optional) if you want to add tags to your model do the following:
-
In the Tags section, choose Add new tag.
-
Enter the following:
-
The name of the key in Key.
-
The value of the key in Value.
-
-
To add more tags, repeat steps 6a and 6b.
-
(Optional) If you want to remove a tag, choose Remove next to the tag that you want to remove. If you are removing a previously saved tag, it is removed when you save your changes.
-
-
Choose Train model.
-
In the Do you want to train your model? dialog box, choose Train model.
-
In the Models view, you can see that training has started and you can check the current status by viewing the
Status
column for the model version. Training a model takes a while to complete. -
When training is finished, you can evaluate its performance. For more information, see Improving your Amazon Lookout for Vision model.
Training a model (SDK)
You use the CreateModel operation to start the training, testing and evaluation of a model. Amazon Lookout for Vision trains the model using the training and test dataset associated with the project. For more information, see Creating a project (SDK).
Each time you call CreateModel
, a new version of the model is
created. The response from CreateModel
includes the version of the
model.
You are charged for each successful model training. Use the
ClientToken
input parameter to help prevent charges due to
unnecessary or accidental repeats of model training by your users.
ClientToken
is an idempotent input parameter that ensures
CreateModel
only completes once for a specific set of parameters
— A repeat call to CreateModel
with the same
ClientToken
value ensures that training isn't repeated. 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, but you'll need to provide your own value for your own use cases. For
more information, see CreateModel.
Training takes a while to complete. To check the current status, call
DescribeModel
and pass the project name (specified in the call to
CreateProject
) and the model version. The status
field
indicates the current status of the model training. For example code, see Viewing your models (SDK).
If training is successful, you can evaluate model. For more information, see Improving your Amazon Lookout for Vision model.
To view the models that you have created in a project, call
ListModels
. For example code, see Viewing your models.
To train a model (SDK)
-
If you haven't already done so, install and configure the AWS CLI and the AWS SDKs. For more information, see Step 4: Set up the AWS CLI and AWS SDKs.
-
Use the following example code to train a model.
-
When training is finished, you can evaluate its performance. For more information, see Improving your Amazon Lookout for Vision model.