ArcGIS Pro

Repurposing Deep Learning Models using Transfer Learning in ArcGIS

Transfer learning is a technique in deep learning that allows a model trained on one task to be repurposed for another related task. It involves using a pre-trained model as a starting point to train a new model. This approach can save time and computational resources since the pre-trained model has already learned many features that are useful for the new task. It can be applied in many deep learning tasks, especially when there is limited data available for training a new model.

In this blog, we are going to use the Road Extraction – North America pre-trained model hosted on ArcGIS Living Atlas. The model works well on 8-bit, 3-band high resolution (30-50 cm) aerial imagery. It uses the MultiTaskRoadExtractor model architecture. The model is trained to extract paved roads. The screen-captures below show how the model performs in different cases. The input images have a 30cm resolution, and are located in Joshua Tree, California.

Before Transfer Learning: Paved Roads vs. Unpaved Roads and Trails
Before Transfer Learning: Paved Roads vs. Unpaved Roads and Trails

From the examples above, we can see that the model is able to extract paved roads very accurately. However, it does not perform as well when extracting unpaved roads and trails.

We will use the Transfer Learning technique to build a new model that can extract unpaved roads and trails as well. To do this, we will use the Train Deep Learning Model tool. Inputs are going to be the Road Extraction – North America pre-trained model and some training samples for unpaved roads and trails.

Let’s start by creating training samples.

Create Training Samples

We need to create some training samples for unpaved roads and trails. One method is to use a polyline feature class to collect these samples. Below are some of my examples.

 

Samples of Unpaved Roads and Trails during training
Samples of Unpaved Roads and Trails

In the feature class, I created a field called Classvalue, and populated the field with 1. The Classvalue number can be value other than 0.

Classvalue field that contains the class values
Classvalue field that contains the class values

We are now ready to export our training samples using the Export Training Data for Deep Learning tool.

In the tool, we will input our raster and feature class. Since the Road Extraction – North America model uses the MultiTaskRoadExtractor model architecture, we need to make sure we use the right metadata format; we will select the Classified Tiles metadata type in the Metadata Format parameter. We will make sure the Classvalue field of the feature class is selected in the Class Value Field parameter. Since we are using a polyline feature class, we will use a buffer so that better see the pixels of roads and trails. Then, we run the tool.

Training the model

Now that we have both: a pre-trained model and training samples for the new task, we can train a new model using transfer learning. The Train Deep Learning Model tool supports transfer learning through the Pre-trained Model and the Freeze Model parameters. In the Input Training Data parameter, we will specify the folder that contains our training data. In the Pre-Trained Model parameter, we will input the Road Extraction – North America model. We will make sure that the Freeze Model parameter is checked. Finally, we will specify the output folder for our model and run the tool.

Result

We will use the Classify Pixels Using Deep Learning tool to use the model. In the tool, we will input the raster data and the model. Then we will run the tool.

Below, the animation shows the input image, the output from the Road Extraction – North America model, and output from the new Road Extraction model that we retrained using the transfer learning. As expected, the new model works well on unpaved roads and trails.

Result of transfer learning
Animated result: the output from the Road Extraction pre-trained model, and output from the new Road Extraction model that we retrained using the transfer learning.

In this example, we demonstrated how we can use transfer learning to re-purpose a pre-trained model for a new task. This is just one example; you can use the Transfer Learning techniques to solve many other deep learning workflows.

Banner Image: Aerial view of Twentynine Palms from the south. Wikimedia Commons, the Free Media Commons 13 June 2023. <https://commons.wikimedia.org/wiki/File:Twentynine_Palms_aerial.jpg >.

Test data: sunfair_ne.tif and joshua_tree_south_nw.tif from https://earthexplorer.usgs.gov/ courtesy of the U.S. Geological Survey

About the author

Pavan Yadav

Pavan Yadav is a product engineer with the ArcGIS Imagery team. He is passionate about GeoAI, more specifically Deep Learning, and applying them to solve GIS, Image Analysis, and Image processing problems.

Connect:
2 Comments
Oldest
Newest
Inline Feedbacks
View all comments

Next Article

Change detection in Map Viewer Part 2: Measuring change with raster functions

Read this article