Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS API for Python

Pixel-based Classification Workflow with arcgis.learn

Prerequisites

  • Please refer to the prerequisites section in our guide for more information. This sample demonstrates how to do export training data and model inference using ArcGIS Image Server. Alternatively, they can be done using ArcGIS Pro as well.
  • If you have already exported training samples using ArcGIS Pro, you can jump straight to the training section. The saved model can also be imported into ArcGIS Pro directly.

Introduction

As an example, we use land cover classification to demonstrate of workflow of pixel-based image classification using arcgis.learn. To begin with, we need input imagery as well as labels for each pixel. With the ArcGIS platform, these datasets are represented as layers, and are available in our GIS. This guide notebook showcases an end-to-end to land cover classification workflow using ArcGIS API for Python. The workflow consists of three major steps: (1) extract training data, (2) train a deep learning image segmentation model, (3) deploy the model for inference and create maps. To better illustrate this process, we will use World Imagery and high-resolution labeled data provided by the Chesapeake Conservancy land cover project.

Figure 1. A subset of of the labeled data for Kent county, Delaware

Export training data for deep learning

Import ArcGIS API for Python and get connected to your GIS

In [1]:
from arcgis import GIS
In [3]:
gis = GIS("home")

Prepare data that will be used for training data export

To export training data, we need a labeled imagery layer that contains the class label for each location, and a raster input that contains all the original pixels and band information. In this land cover classification case, we will be using a subset of the one-meter resolution Kent county, Delaware, dataset as the labeled imagery layer and World Imagery: Color Infrared as the raster input.

In [18]:
label_layer = gis.content.search("Kent_county_full_label_land_cover")[0] # the index might change
label_layer
Out[18]:
Kent_county_full_label_land_cover
land cover labels for Unet sampleImagery Layer by portaladmin
Last Modified: May 09, 2019
0 comments, 35 views
In [32]:
m = gis.map("Kent county, Delaware")
m