Tutorial videos
The videos show you how to use Amazon Rekognition Custom Labels to train and use a model.
To view the tutorial videos
1. Sign in to the AWS Management Console and open the Amazon Rekognition console at https://
console.aws.amazon.com/rekognition/.
2. In the left pane, choose Use Custom Labels. The Amazon Rekognition Custom Labels landing page is shown. If you don't see Use Custom Labels, check that the AWS Region you are using supports Amazon Rekognition Custom Labels.
3. In the navigation pane, choose Get started.
4. In What is Amazon Rekognition Custom Labels?, choose the video to watch the overview video.
5. In the navigation pane, choose Tutorials.
6. On the Tutorials page, choose the tutorial videos that you want to watch.
Example projects
Amazon Rekognition Custom Labels provides the following example projects.
Image classification
Image classification
The image classification project (Rooms) trains a model that finds one or more household locations in an image, such as backyard, kitchen, and patio. The training and test images represent a single location.
Each image is labeled with a single image-level label, such as kitchen, patio, or living_space. For an analyzed image, the trained model returns one or more matching labels from the set of image-level labels used for training. For example, the model might find the label living_space in the following image.
For more information, see Find objects, scenes, and concepts (p. 55).
Multi-label image classification
The multi-label image classification project (Flowers) trains a model that categorizes images of flowers into three concepts (flower type, leaf presence, and growth stage).
The training and test images have image-level labels for each concept, such as camellia for a flower type, with_leaves for a flower with leaves, and fully_grown for a flower that is fully grown.
For an analyzed image, the trained model returns matching labels from the set of image-level labels used for training. For example, the model returns the labels mediterranean_spurge and with_leaves for the following image. For more information, see Find objects, scenes, and concepts (p. 55).
Brand detection
The brand detection project (Logos) trains a model that model finds the location of certain AWS logos such as Amazon Textract, and AWS lambda. The training images are of the logo only and have a single image level-label, such as lambda or textract. It is also possible to train a brand detection model with training images that have bounding boxes for brand locations. The test images have labeled bounding boxes that represent the location of logos in natural locations, such as an architectural diagram. The trained model finds the logos and returns a labeled bounding box for each logo found. For more information, see Find brand locations (p. 56).
Object localization
Object localization
The object localization project (Circuit boards) trains a model that finds the location of parts on a printed circuit board, such as a comparator or an infra red light emitting diode. The training and test images include bounding boxes that surround the circuit board parts and a label that identifies the part within the bounding box. The label names are ir_phototransistor, ir_led, pot_resistor, and comparator. The trained model finds the circuit board parts and returns a labeled bounding for each circuit part found.
For more information, see Find object locations (p. 56).
Using the example projects
These Getting Started instructions show you how to train a model by using example projects that Amazon Rekognition Custom Labels creates for you. It also shows you how to start the model and use it to analyze an image.
Creating the example project
To get started, decide which project to use. For more information, see Step 1: Choose an example project (p. 14).
Amazon Rekognition Custom Labels uses datasets to train and evaluate (test) a model. A dataset manages images and the labels that identify the contents of images. The example projects include a training dataset and a test dataset in which all images are labeled. You don't need to make any changes before training your model. The example projects show the two ways in which Amazon Rekognition Custom Labels uses labels to train different types of models.
• image-level – The label identifies an object, scene, or concept that represents the entire image.
• bounding box – The label identifies the contents of a bounding box. A bounding box is a set of image coordinates that surround an object in an image.
Training the model
Later, when you create a project with your own images, you must create training and test datasets, and also label your images. For more information, see Decide your model type (p. 27).
Training the model
After Amazon Rekognition Custom Labels creates the example project, you can train the model. For more information, see Step 2: Train your model (p. 16). After training finishes, you normally evaluate the performance of the model. The images in the example dataset already create a high-performance model, and you don't need to evaluate the model before running the model. For more information, see Improving a trained Amazon Rekognition Custom Labels model (p. 135).
Using the model
Next you start the model. For more information, see Step 3: Start your model (p. 18).
After you start running your model, you can use it to analyze new images. For more information, see Step 4: Analyze an image with your model (p. 19).
You are charged for the amount of time that your model runs. When you finish using the example model, you should stop the model. For more information, see Step 5: Stop your model (p. 24).
Next steps
When you're ready, you can create your own projects. For more information, see Step 6: Next steps (p. 25).
Step 1: Choose an example project
In this step you use choose an example project. Amazon Rekognition Custom Labels then creates a project and a dataset for you. A project manages the files used to train your model. For more information, see Managing an Amazon Rekognition Custom Labels project (p. 180). Datasets contain the images, assigned labels, and bounding boxes that you use to train and test a model. For more information, see the section called “Managing datasets” (p. 191).
For information about the example projects, see Example projects (p. 11).
Choose an example project
1. Sign in to the AWS Management Console and open the Amazon Rekognition console at https://
console.aws.amazon.com/rekognition/.
2. In the left pane, choose Use Custom Labels. The Amazon Rekognition Custom Labels landing page is shown. If you don't see Use Custom Labels, check that the AWS Region you are using supports Amazon Rekognition Custom Labels.
3. Choose Get started.
Step 1: Choose an example project
4. In Explore example projects, choose Try example projects.
5. Decide which project you want to use and choose Create project "project name" within the example section. Amazon Rekognition Custom Labels then creates the example project for you.
Note
If this is the first time that you've opened the console in the current AWS Region, the First Time Set Up dialog box is shown. Do the following:1. Note the name of the Amazon S3 bucket that's shown.
2. Choose Continue to let Amazon Rekognition Custom Labels create an Amazon S3 bucket (console bucket) on your behalf.
6. After your project is ready, choose Go to dataset.
Step 2: Train your model
Step 2: Train your model
In this step you train your model. The training and test datasets are automatically configured for you.
After training successfully completes, you can see the overall evaluation results, and evaluation results for individual test images. For more information, see Training an Amazon Rekognition Custom Labels model (p. 89).
To train your model
1. On the dataset page, choose Train model.
2. On the Train model page, Choose Train model. The Amazon Resource Name (ARN) for your project is in the Choose project edit box.
Step 2: Train your model
3. In the Do you want to train your model? dialog box, choose Train model.
4. After training completes, choose the model name. Training is finished when the model status is TRAINING_COMPLETED.
5. Choose the Evaluate button to see the evaluation results. For information about evaluating a model, see Improving a trained Amazon Rekognition Custom Labels model (p. 135).
6. Choose View test results to see the results for individual test images.
Step 3: Start your model
7. After viewing the test results, choose the project name to return to the model page.
Step 3: Start your model
In this step you start your model. After your model starts, you can use it to analyze images.
You are charged for the amount of time that your model runs. Stop your model if you don't need to analyze images. You can restart your model at a later time. For more information, see Running a trained Amazon Rekognition Custom Labels model (p. 147).
To start your model
1. Choose the Use model tab on the model page.
Step 4: Analyze an image with your model
2. In the Start or stop model section do the following:
a. Choose Start.
b. In the Start model dialog box, choose Start.
3. Wait until the model is running. The model is running when the status in the Start or stop model section is Running.
4. Use your model to classify images. For more information, see Step 4: Analyze an image with your model (p. 19).
Step 4: Analyze an image with your model
You analyze an image by calling the DetectCustomLabels API. In this step, you use the detect-custom-labels AWS Command Line Interface (AWS CLI) command to analyze an example image. You get the AWS CLI command from the Amazon Rekognition Custom Labels console. The console configures the AWS CLI command to use your model. You only need to supply an image that's stored in an Amazon S3 bucket. This topic provides an image that you can use for each example project.
Note
The console also provides Python example code.
The output from detect-custom-labels includes a list of labels found in the image, bounding boxes (if the model finds object locations), and the confidence that the model has in the accuracy of the predictions.
For more information, see Analyzing an image with a trained model (p. 162).
To analyze an image (console)
1. If you haven't already, set up the AWS CLI. For instructions, see the section called “Step 3: Set Up the AWS CLI and AWS SDKs” (p. 5).
Step 4: Analyze an image with your model
2. If you haven't already, start running your model. For more information, see Step 2: Train your model (p. 16).
3. Choose the Use Model tab and then choose API code.
4. Choose AWS CLI command.
5. In the Analyze image section, copy the AWS CLI command that calls detect-custom-labels.
Step 4: Analyze an image with your model
6. Upload an example image to an Amazon S3 bucket. For instructions, see Getting an example image (p. 22).
7. At the command prompt, enter the AWS CLI command that you copied in the previous step. It should look like the following example.
The value of --project-version-arn should be Amazon Resource Name (ARN) of your model.
The value of --region should be the AWS Region in which you created the model.
Change MY_BUCKET and PATH_TO_MY_IMAGE to the Amazon S3 bucket and image that you used in the previous step.
aws rekognition detect-custom-labels \ --project-version-arn "model_arn" \
--image "{"S3Object": {"Bucket": "MY_BUCKET","Name": "PATH_TO_MY_IMAGE"}}" \ --region us-east-1
If the model finds objects, scenes, and concepts, the JSON output from the AWS CLI command should look similar to the following. Name is the name of the image-level label that the model found. Confidence (0-100) is the model's confidence in the accuracy of the prediction.
{
Getting an example image
"CustomLabels": [ {
"Name": "living_space",
"Confidence": 83.41299819946289 }
] }
If the model finds object locations or finds brand, labeled bounding boxes are returned.
BoundingBox contains the location of a box that surrounds the object. Name is the object that the model found in the bounding box. Confidence is the model's confidence that the bounding box contains the object.
{ "CustomLabels": [ {
"Name": "textract",
"Confidence": 87.7729721069336, "Geometry": {
"BoundingBox": {
"Width": 0.198987677693367, "Height": 0.31296101212501526, "Left": 0.07924537360668182, "Top": 0.4037395715713501 }
} } ] }
8. Continue to use the model to analyze other images. Stop the model if you are no longer using it. For more information, see Step 5: Stop your model (p. 24).
Getting an example image
You can use the following images with the DetectCustomLabels operation. There is one image for each project. To use the images, you upload them to an S3 bucket.
To use an example image
1. Right-click the following image that matches the example project that you are using. Then choose Save image to save the image to your computer. The menu option might be different, depending on which browser you are using.
2. Upload the image to an Amazon S3 bucket that's owned by your AWS account and is in the same AWS region in which you are using Amazon Rekognition Custom Labels.
For instructions, see Uploading Objects into Amazon S3 in the Amazon Simple Storage Service User Guide.
Getting an example image
Image classification
Multi-label classification
Brand detection
Step 5: Stop your model
Object localization
Step 5: Stop your model
In this step you stop running your model. You are charged for the amount of time your model is running.
If you have finished using the model, you should stop it.
To stop your model
1. In the Start or stop model section choose Stop.
2. In the Stop model dialog box, enter stop to confirm that you want to stop the model.
Step 6: Next steps
3. Choose Stop to stop your model. The model has stopped when the status in the Start or stop model section is Stopped.
Step 6: Next steps
After you finished trying the examples projects, you can use your own images and datasets to create your own model. For more information, see Understanding Amazon Rekognition Custom Labels (p. 27).
Use the labeling information in the following table to train models similar to the example projects.
Example Training images Test images
Image classification (Rooms) 1 Image-level label per image 1 Image-level label per image Multi-label classification
(Flowers) Multiple image-level labels per
image Multiple image-level labels per
image
Step 6: Next steps
Example Training images Test images
Brand detection (Logos) image level-labels (you can also
use Labeled bounding boxes) Labeled bounding boxes Image localization (Circuit
boards) Labeled bounding boxes Labeled bounding boxes
The Tutorial: Classifying images (p. 34) shows you how to create a project, datasets, and models for an Image classification model.
For detailed information about creating datasets and training models, see Creating an Amazon Rekognition Custom Labels model (p. 50).
Decide your model type
Understanding Amazon Rekognition Custom Labels
This section gives you an overview of the workflow to train and use an Amazon Rekognition Custom Labels model with the console and the AWS SDK.
Note
Amazon Rekognition Custom Labels now manages datasets within a project. You can create datasets for your projects with the console and with the AWS SDK. If you have previously used Amazon Rekognition Custom Labels, your older datasets might need associating with a new project. For more information, see (Optional) Step 7: Associate prior datasets with new projects (p. 10)
Topics
• Decide your model type (p. 27)
• Create a model (p. 29)
• Improve your model (p. 31)
• Start your model (p. 32)
• Analyze an image (p. 32)
• Stop your model (p. 33)
Decide your model type
You first decide which type of model you want to train, which depends on your business goals. For example, you could train a model to find your logo in social media posts, identify your products on store shelves, or classify machine parts in an assembly line.
Amazon Rekognition Custom Labels can train the following types of model:
• Find objects, scenes, and concepts (p. 27)
• Find object locations (p. 28)
• Find the location of brands (p. 29)
To help you decide which type of model to train, Amazon Rekognition Custom Labels provides example projects that you can use. For more information, see Getting started with Amazon Rekognition Custom Labels (p. 11).
Find objects, scenes, and concepts
The model predicts objects, scenes, and concepts associated with an entire image. For example, you can train a model that determines if an image contains a tourist attraction, or not.
Find object locations
Alternatively, you can train a model that categorizes images into multiple categories. For example, the previous image might have categories such as sky color, reflection, or lake.
The Image classification (p. 12) and Multi-label image classification (p. 12) example projects show different uses for image-level labels.
Find object locations
The model predicts the location of an object on an image. The prediction includes bounding box information for the object location and a label that identifies the object within the bounding box. For example, the following image shows bounding boxes around various parts of a circuit board, such as a comparator or pot resistor.
Find the location of brands
The Object localization (p. 13) example project shows how Amazon Rekognition Custom Labels uses labeled bounding boxes to train a model that finds object locations.
Find the location of brands
Amazon Rekognition Custom Labels can train a model that finds the location of brands, such as logos, on an image. The prediction includes bounding box information for the brand location and a label that identifies the object within the bounding box.
Create a model
The steps to create a model are creating a project, creating training and test datasets, and training the model.
Create a project
An Amazon Rekognition Custom Labels project is a group of resources needed to create and manage a model. A project manages the following:
• Datasets – The images and image labels used to train a model. A project has a training dataset and a test dataset.
Create training and test datasets
• Models – The software that you train to find the concepts, scenes, and objects unique to your business.
You can have multiple versions of a model in a project.
We recommend that you use a project for a single use case, such as finding circuit board parts on a circuit board.
You can create a project with the Amazon Rekognition Custom Labels console and with the CreateProject API. For more information, see Creating a project (p. 50).
Create training and test datasets
A dataset is a set of images and labels that describe those images. Within your project, you create a training dataset and a test dataset that Amazon Rekognition Custom Labels uses to train and test your model.
A label identifies an object, scene, concept, or bounding box around an object in an image. Labels are either assigned to an entire image (image-level) or they are assigned to a bounding box that surrounds an object on an image.
Important
How you label the images in your datasets determines the type of model that Amazon Rekognition Custom Labels creates. For example, to train a model that finds objects, scenes and concepts, you assign image level labels to the images in your training and test datasets. For more information, see Purposing datasets (p. 55).
Images must be in PNG and JPEG format, and you should follow the input images recommendations. For more information, see Preparing images (p. 58).
Create training and test datasets (Console)
You can start a project with a single dataset, or with separate training and test datasets. If you start with a single dataset, Amazon Rekognition Custom Labels splits your dataset during training to create a training dataset (80%) and a test dataset (20%) for your project. Start with a single dataset if you want Amazon Rekognition Custom Labels to decide which images are used for training and testing. For complete control over training, testing, and performance tuning, we recommend that you start your project with separate training and test datasets.
To create the datasets for a project, you import the images in one of the following ways:
• Import images from your local computer.
• Import images from an S3 bucket. Amazon Rekognition Custom Labels can label the images using the folder names that contain the images.
• Import an Amazon SageMaker Ground Truth manifest file.
• Import an Amazon SageMaker Ground Truth manifest file.