Geospatial Semantic Segmentation with Torch and Terra

Provides tools for semantic segmentation of geospatial data using convolutional neural network-based deep learning. Utility functions allow for creating masks, image chips, data frames listing image chips in a directory, and DataSets for use within DataLoaders. Additional functions are provided to serve as checks during the data preparation and training process. A UNet architecture can be defined with 4 blocks in the encoder, a bottleneck block, and 4 blocks in the decoder. The UNet can accept a variable number of input channels, and the user can define the number of feature maps produced in each encoder and decoder block and the bottleneck. Users can also choose to (1) replace all rectified linear unit (ReLU) activation functions with leaky ReLU or swish, (2) implement attention gates along the skip connections, (3) implement squeeze and excitation modules within the encoder blocks, (4) add residual connections within all blocks, (5) replace the bottleneck with a modified atrous spatial pyramid pooling (ASPP) module, and/or (6) implement deep supervision using predictions generated at each stage in the decoder. A unified focal loss framework is implemented after Yeung et al. (2022) . We have also implemented assessment metrics using the 'luz' package including F1-score, recall, and precision. Trained models can be used to predict to spatial data without the need to generate chips from larger spatial extents. Functions are available for performing accuracy assessment. The package relies on 'torch' for implementing deep learning, which does not require the installation of a 'Python' environment. Raster geospatial data are handled with 'terra'. Models can be trained using a Compute Unified Device Architecture (CUDA)-enabled graphics processing unit (GPU); however, multi-GPU training is not supported by 'torch' in 'R'.


geodl geodl hex logo

geodl provides tools for geospatial semantic segmentation using convolutional neural network-based deep learning, built on torch and terra. It includes several configurable UNet-family model architectures, utilities for preparing and augmenting image chips, loss functions and training metrics for use with luz, and functions for generating spatial predictions and assessing accuracy. Models can be trained using a CUDA-enabled GPU and do not require a Python environment.

Full details are described in:

Maxwell, A.E., Farhadpour, S., Das, S. and Yang, Y., 2024. geodl: An R package for geospatial deep learning semantic segmentation using torch and terra. PLoS One, 19(12), p.e0315127. https://doi.org/10.1371/journal.pone.0315127

Installation

You can install the development version of geodl from GitHub with:

# install.packages("devtools")
devtools::install_github("maxwell-geospatial/geodl")

Documentation

Full documentation, including a function reference, is available at the pkgdown website.

Chapters 22, 23, 24, and 25 of the free and openly available online text Geospatial Supervised Learning using R provide detailed workflows and explanations.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("geodl")

0.4.0 by Aaron Maxwell, 14 hours ago


https://github.com/maxwell-geospatial/geodl, https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0315127, https://wvview.org/gslr/index.html


Report a bug at https://github.com/maxwell-geospatial/geodl/issues


Browse source code at https://github.com/cran/geodl


Authors: Aaron Maxwell [aut, cre, cph] , Sarah Farhadpour [aut] , Srinjoy Das [aut] , Yalin Yang [aut]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports torch, luz, torchvision, dplyr, terra, MultiscaleDTM, psych, coro, R6, readr, rlang, sf

Suggests knitr, rmarkdown


See at CRAN