Generate ice or water predictions using models trained with Sentinel-1 images.
This repository contains three different Anaconda environment files:
- environment.yml - The working environment with package versions identified.
- env_windows_full.yml - A full environment exported from a Windows installation.
- env_from-history.yml - A minimum working environment. Package versions are not identified.
Install the environment using the command:
conda env create -f environment.yml
Installing the environment.yml might take some time while Anaconda checks for conflicts. The other enviroment files might be helpful in case the installation cannot be completed.
Activate the environment to use the program:
conda activate sea-ice-prediction
All the Python code necessary to read the models and raster files and output the predictions is contained in main.py. The program expects one argument -c
with the path to a configuration file. The default value for -c
is config.cfg. Users might control program behavior by changing the options in config.cfg
config.cfg is a configuration file that contains sections and parameters. config.cfg contains a single section io
and the following parameters:
dir_out
- Path to output directory. The program creates the directory in case it does not exist. All rasters are written onto this directory.model_path
- Path to TorchScripts trained models. The program accepts one or more models separated by breaklines for different models. When multiple models are provided, the ice probability is computed as the mean probability for multiple realizations.input_rasters
- Path to input rasters. The program accepts one or more input rasters, separated by breaklines for different files. The program expects raster files with three bands.device
- PyTorch device.cpu
,cuda
, orcuda:0
, etc are valid options.
The program writes the resulting predictions on raster files that use the input raster as template:
mean-prob-[inputname]
- Raster with two bands, the first one identifying water probability and the second showing ice probability. This output is the mean average of the ensemble of models when multiple models are provided in config.cfg.class-[inputname]
- Raster with a single band containing0
for pixels classified as water and1
for pixels identified as ice. Argmax ofmean-prob-[inputname]
.pred-std-[inputname]
- Raster with two bands, the first band identifies the standard deviation of water predictions (std of ensemble predictions), and the second band idenfies the standard deviation of ice predictions. Only available when multiple models are provided in config.cfg.
This program was created to generate outputs for models trained with the ready-to-train AI4Arctic Sea Ice Challenge Dataset, therefore ideally the input rasters should have similar processing. This includes pixel size of 80 m by 80 m. Currently the preprocessing stage is hardcoded, and models expect a three band input (HH, HV, incidence angle). Mean and standard deviations required for normalizations are the ones listed in the AI4ArcticSeaIceChallenge github repository.
The image below is an RGB (HH, HV, incidence angle) composition of a Sentinel-1 image identified in ExtremeEarth Polar Use Case Training Data for the January example. The HH and HV channels are in decibels.
An ensemble of two models trained with the ready-to-train AI4Arctic Sea Ice Challenge Dataset processes the image above and produces the ice probabililty below (yellow is one, blue is zero).
Please reach out to [email protected] if you would like access to trained models.