ArcGIS Developer

ArcGIS API for Python

Glacial Terminus Extraction using HRNet

  • 🔬 Data Science
  • 🥠 Deep Learning and Segmentation


With the change in global climate, glaciers all over the world are experiencing an increasing mass loss, resulting in changing calving fronts. This calving front delineation is important for monitoring the rate of glacial mass loss. Currently, most calving front delineation is done manually, resulting in excessive time consumption and under-utilization of satellite imagery.

Extracting calving fronts from satellite images of marine-terminating glaciers is a two-step process. The first step involves segmenting the front using different segmentation techniques, and the second step involves post-processing mechanisms to extract the terminus line. This notebook presents the use of an HRNet model from the arcgis.learn module to accomplish the first task of segmenting calving fronts. We have used data provided in the CALFIN repository. The training data includes 1600+ Greenlandic glaciers and 200+ Antarctic glaciers/ice shelves images from Landsat (optical) and Sentinel-1 (SAR) satellites.

Necessary imports

In [1]:
import os
import glob
import zipfile
from pathlib import Path

from arcgis.gis import GIS
from arcgis.learn import MMSegmentation, prepare_data

Connect to your GIS

In [14]:
# Connect to GIS
gis = GIS("home")

Download training data

In [3]:
training_data = gis.content.get('cc750295180a487aa7af67a67cadff78')
Sample data for Glacial terminus segmentation using HRNet Image Collection by api_data_owner
Last Modified: August 06, 2021
0 comments, 0 views

The data size is approximately 6.5 GBs and may take some time to download.

In [4]:
filepath =
In [5]:
with zipfile.ZipFile(filepath, 'r') as zip_ref:
In [6]:
output_path = os.path.join(os.path.splitext(filepath)[0])
In [7]:
output_path = glob.glob(output_path)

Train the model

arcgis.learn provides an HRNet model through the integration of the MMSegmentation class. For more in-depth information on MMSegmentation, see this guide - Using MMSegmentation with arcgis.learn.

Prepare data

Next, we will specify the path to our training data and a few hyperparameters.

  • path: path of the folder/list of folders containing the training data.
  • batch_size: The number of images your model will train on for each step of an epoch. This will directly depend on the memory of your graphics card.
In [4]:
data = prepare_data(path=output_path, dataset_type='Classified_Tiles', batch_size=24)

Visualize training data

To get a sense of what the training data looks like, the arcgis.learn.show_batch() method will randomly select training chips and visualizes them.

  • rows: Number of rows to visualize
In [5]:
data.show_batch(5, alpha=0.7)