This page has example workflows to demonstrate uses of TensorFlow with Earth Engine. See the TensorFlow page for more details. These examples are written using the Earth Engine Python API and TensorFlow running in Colab Notebooks.
Multi-class prediction with a DNN
A "deep" neural network (DNN) is simply an artificial neural network (ANN) with one or more hidden layers. This example demonstrates a very simple DNN with a single hidden layer. The DNN takes spectral vectors as inputs (i.e. one pixel at a time) and outputs a single class label and class probabilities per pixel. The Colab notebook below demonstrates creating the DNN, training it with data from Earth Engine, making predictions on exported imagery and importing the predictions to Earth Engine.
Regression with an FCNN
A "convolutional" neural network (CNN) contains one or more convolutional layers, in which inputs are neighborhoods of pixels, resulting in a network that is not fully-connected, but is suited to identifying spatial patterns. A fully convolutional neural network (FCNN) does not contain a fully-connected layer as output. This means that it does not learn a global output (i.e. a single output per image), but rather localized outputs (i.e. per-pixel).
This Colab notebook demonstrates the use of the UNET model, an FCNN developed for medical image segmentation, for predicting a continuous [0,1] output in each pixel from 256x256 neighborhoods of pixels. Specifically, this example shows how to export patches of data to train the network and how to overtile image patches for inference, to eliminate tile boundary artifacts.
Deploying to AI Platform
For relatively large models (like the FCNN example), the longevity of the free virtual
machine on which Colab notebooks run may not be sufficent for a long-running training
job. Specifically, if the expected prediction error is not minimized on the evaluation
dataset, then more training iterations may be prudent. For performing large training
jobs in the Cloud, this Colab notebook demonstrates how to
package your training
code, start a
training job, prepare a
earthengine mode prepare command, and get predictions in Earth
Engine interactively with