Table of Contents¶
- Necessary imports
- Connect to your GIS
- Download training data
- Train the model
- Model inference
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.
import os import glob import zipfile from pathlib import Path from arcgis.gis import GIS from arcgis.learn import MMSegmentation, prepare_data
# Connect to GIS gis = GIS("home")
training_data = gis.content.get('cc750295180a487aa7af67a67cadff78') training_data
The data size is approximately 6.5 GBs and may take some time to download.
filepath = training_data.download(file_name=training_data.name)
with zipfile.ZipFile(filepath, 'r') as zip_ref: zip_ref.extractall(Path(filepath).parent)
output_path = os.path.join(os.path.splitext(filepath))
output_path = glob.glob(output_path)
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.
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.
data = prepare_data(path=output_path, dataset_type='Classified_Tiles', batch_size=24)
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