Quickly plug satellite imagery into your favorite machine learning framework


3 min read

500786f922ad  0GmVU0A7RrOvhELuN

Label Maker is a python library to help in extracting insight from satellite imagery. Label Maker creates machine-learning-ready training data for most popular ML frameworks, including Keras, Tensor Flow, and MXNet. It pulls data from OpenStreetMap and combines that with imagery sources like Mapbox or Digital Globe to create a single file for use in training machine learning algorithms.

Supervised learning methods require two things: satellite imagery and ground-truth labels. If you’re looking to train a model in Potsdam or a few other select cities, there are good datasets already available. But if you need a custom class label or want to train in areas closer to where you’ll be using the model, you’ll likely need to put together a new dataset. With Label Maker you can define your desired classes as OpenStreetMap features, specify an imagery tileset, and it will handle the rest.

`label-maker download         # download OpenStreetMap QA Tiles
label-maker labels           # create your ground-truth labels
label-maker images           # download satellite imagery tiles
label-maker package          # package tiles and labels into data.npz`

That final command will give you a npz file which contains all the imagery and labels as numpy arrays, split into training and testing sets. The labels can be created to match most types of machine learning problems: it can generate classification labels, object detection bounding boxes, or segmentation masks. Then you can easily load this data into example network architectures or create your own:

`import numpy as np
from keras.models import Sequential

# load the training data
data = np.load('data.npz')
x_train = data['x_train']
x_test = data['x_test']
y_train = data['y_train']
y_test = data['y_test']

# define your model here, example usage in Keras
model = Sequential()
# ...

# train
model.fit(x_train, y_train, batch_size=16, epochs=50)
model.evaluate(x_test, y_test, batch_size=16)`

Installation is as easy as pip install label-maker and you can find more documentation or suggest new features on the project’s Github page. The first item on the roadmap is adding native support for reading Cloud Optimized GeoTIFFs as an imagery source. We’d also like to support WMTS endpoints like Planet’s Mosaics. In the coming weeks, we’ll share examples that demonstrate how to use Label Maker with popular machine learning frameworks and cloud services. Let us know if you use Label Maker to create your next machine learning model.

Update: NaNa shows you how to use Label Maker with Amazon SageMaker to identify buildings in Vietnam.

What we're doing.