Training models using Satellite imagery on Amazon Rekognition Custom Labels

How to access Sentinel-2 imagery

There are multiple ways how you can access satellite imagery:

  • Use one of the browsers mentioned on the page
  • Download imagery from the Amazon S3 bucket directly. Amazon S3 is a storage service that provides scalable and secure access for downloading and uploading data.

Find Sentinel-2 scene

One of the simplest options to find the necessary scene is to use Sentinel-2 browser. There are multiple browsers out there. In our example, we will use the EO browser as it provides an S3 path for the image. Basically, you just need to define search parameters and then copy the AWS path field.

Download image bands

When dealing with satellite imagery we work with multiple images from different specters. The idea here is that each spectral band can give a different insight. Because of that sometimes it is more useful to construct images not with RGB bands, but with other bands, for example, NIR which stands for Near Infra-Red imagery. This band gives great insight into vegetation. That is why the combination of NIR-Red-Green bands is popular and it’s called False Color since it’s not a true RGB image. Once we have the AWS path we can use AWS CLI commands to download the necessary bands. In our case, we want to construct a False Color vegetation image which will have higher contrast for vegetation areas so we would need to download NIR-Red-Greed bands (8,4,3 respectively).

Prepare False Color Sentinel-2 image

Once bands are downloaded, we can use rasterio python library to compile False Color image and scale the bands since initially they are provided in uint16 format, but their values actually lie in the range 0–2¹². Here is the example code which does that:

How to train and run Amazon Rekognition model

Once we have images we can create a dataset and train our model. One of the main advantages of using Amazon Rekognition is that you don’t need to know deep learning frameworks or write code for deep learning training or inference. You also don’t need to manage deep learning infrastructure and can start using Amazon Rekognition model right away.

Create and label Dataset

  1. Create dataset
  2. Choose “Upload images from your computer”
  3. On the dataset page click “Add images”
  4. On the pop-up window, click Choose Files and choose files from your computer. Then click “Upload images”
  5. Create labels “active field”, “semi-active field”, “non-active field”
  6. Click “Start labeling”, choose images, and then click “Draw bounding box”
  7. On the new page, you can now choose labels and then draw rectangles for each label. After you’ve finished labeling you can switch to a different image or click “Done”.

Train and run the model

  1. On the projects page click “Create Project”
  2. On the project page choose “Train new model”
  3. Choose the dataset which we just created and then choose “Split training dataset” for the test dataset. Then click “Train”.
  4. Once the model is trained you can start making predictions.

Visualize the result

You can visualize the results using the following code in jupyter notebook. This code parses response from the Amazon Rekognition model and draws prediction boxes on the image. It also takes into account the type of labels and marks predictions with different colors based on class.


We’ve trained and deployed a model for finding agriculture fields on satellite imagery using Amazon Rekognition. As you can see setting everything was pretty simple and you can use this example to develop more complex models for other satellite imagery tasks, for example, forest monitoring and building detection.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rustem Feyzkhanov

Rustem Feyzkhanov


I'm a staff machine learning engineer at Instrumental, where I work on analytical models for the manufacturing industry, and AWS Machine Learning Hero.