Use eo-learn with AWS SageMaker

eo-learn is a powerful library for interacting with earth observation data. AWS SageMaker makes it easy to train and deploy machine learning models. Here's a demonstration of two ways to use them together:

Single notebook training

One way you can train a model is in a hosted SageMaker notebook. SageMaker comes with most of the libraries you’ll need but to add additional dependencies for eo-learn, you can add a lifecycle configuration. For example:

This will add eo-learn, geopandas, and tqdm to the tensorflow_p36 environment. See the linked documentation for adding dependencies to other environments. Now when we create a new notebook instance, we can configure this script to run on instance creation:

This will give us all the necessary dependencies to run an example notebook for eo-learn.

Submitting script for training

SageMaker also provides the ability to train a model on a separate instance. Here are the main steps:

  1. Save data to S3: Instead of using all the data in a single notebook instance, we can use eo-learn to download and process the data then write it to S3:

2. Write a custom training script: Find examples for a variety of frameworks in the amazon-sagemaker-examples repo. Save this script as custom_script.py within the notebook. The custom portion needed for eo-learn is reading data from .npy.gz files:

3. Invoke the training script: Now we can invoke the training script on a separate, and potentially more powerful, instance from the notebook:

4. Deploy the trained model: As a bonus, this makes it very easy to deploy the trained model on SageMaker which can serve real-time prediction requests:

Try some of the other eo-learn examples on AWS SageMaker!

open data, satellite imagery, JS, python, ML @developmentseed

open data, satellite imagery, JS, python, ML @developmentseed