How Detect Drainage Crossings works
Available with the Spatial Analyst license.
High-resolution digital elevation models (DEMs) are instrumental in hydrologic analyses, but they don't have any information about subsurface structures. These are structures such as culverts or bridges that route water underneath roads. These locations where water infrastructure crosses roads can cause hydrologic products based on DEMs to lose precision. Locating these drainage crossings has become an important step in ensuring the accuracy of streams.
The Detect Drainage Crossings tool finds the locations of drainage crossings using a pretrained deep learning object detection model. It does not require in-depth knowledge of deep learning to use. However, the following are two important requirements to run the tool:
The deep learning framework Python API in the ArcGIS Pro Python environment must be installed to run the tool. To set up your machine to use deep learning frameworks in ArcGIS Pro, see Install deep learning frameworks for ArcGIS.
The pretrained model used by default, Culvert Detection, requires GPU processing to make its detections. See GPU processing with Spatial Analyst for more details about compatible GPUs and working with GPU devices.
The tool outputs drainage crossings locations detected by the model in the form of points and polygons. The Output Crossing Points (out_crossing_points in Python) parameter value records the approximate center of the drainage crossings. The Output Bounding Polygons (out_bounding_polygons in Python) parameter value records the polygons bounding the detected crossings.
Deep learning concepts
This tool does not require prior knowledge of deep learning to use. This section offers a brief overview of key deep learning concepts relevant to this tool.
Machine learning is a branch of artificial intelligence (AI) in which structured data is processed with an algorithm or statistical methods to solve a problem. Deep learning is a subset of machine learning that uses multiple layers of neural networks to draw complex patterns from data without predefined rules. It's often used for tasks such as classification, regression, and object detection.
Object detection is an area of deep learning in which a model locates objects within images or videos. The Detect Drainage Crossings tool performs object detection using a pretrained neural network. Neural networks are comprised of layers of interconnected nodes that perform mathematical calculations. By connecting layers with hidden weights, the neural networks can be optimized to generate outputs from adjusted weights and thresholds that are applied to the inputs
The default model used for prediction in this tool was trained with examples of terrain when a culvert is present and when one is not present. Using these examples, the model extracted characteristics that are helpful for recognizing culverts. More examples were used to help refine the characteristics and patterns the model found. Following training, the model is used to predict culvert locations using data that wasn't part of the training examples. This is done to validate and tune the model to ensure that it can perform well on other data and is not overfit to its training data. For more specifics about the default model's training process, data, and other details, see the next section.
Get a more in-depth introduction to deep learning. For more information about the different object detection models in ArcGIS Pro, visit Object Detection.
Default deep learning model
By default, the tool uses a pretrained DETReg Culvert Detection model to detect drainage crossings in the specified Input Surface Raster parameter value.
The model uses a DETReg architecture with a ResNet-50 backbone. DETReg (Bar, et al, 2023) is a transformer-based object detection architecture consisting of a convolutional feature extraction backbone, a transformer encoder-decoder, and detection heads that predict object classes and bounding boxes. This model architecture requires GPU processing resources to be available on your computer.
The model was trained using single-band or grayscale high-resolution digital elevation model (HRDEM) rasters of 1 meter by 1 meter. It is recommended that the specified raster have the same cell size the model was trained with, 1 meter. Using a different cell size can produce poor results.
The training data came from West Fork Big Blue Watershed, Nebraska, with approximately 3,471 square kilometers of area, rolling terrain, and extensive row-crop agriculture. The model was subsequently validated in the following geographic regions:
Vermilion River Watershed — Illinois
Maple River Watershed — North Dakota
Sacramento-Stone Corral Watershed — California
The model obtained an Average Precision (AP) of 0.81 over the regions used for validation. AP is an evaluation metric used in object detection that ranges from 0 to 1. A score of 0 indicates very poor detection performance, and a score of 1 indicates perfect performance across the precision-recall curve.
For each detected drainage crossing, the model returns a predicted bounding box identifying the spatial extent of the detected feature, a predicted class, and a confidence score indicating the model's confidence in the detection. The Detect Drainage Crossings tool only returns predicted classes of True, or locations where it detects a culvert.
Model arguments parameter
Information from the model is used to populate the Model Arguments (model_arguments in Python) parameter values. The arguments supported may vary depending on the model architecture.
If a model is specified for the Input Pretrained Model (in_pretrained_model in Python) parameter value, it will contain the arguments within the model's Python raster function.
When the Culvert Detection model is used, three arguments will populate the Model Arguments parameter: Confidence Threshold, NMS Overlap, and Batch Size.
Confidence Threshold argument
The Confidence Threshold (threshold in Python) parameter value determines which model detections are retained as final predictions and output from the tool. Each area examined by the model is given a confidence score. This is the model's estimated likelihood that a location is a drainage crossing. The Confidence Threshold parameter filters out the locations with confidence scores less than its value. Both outputs of the tool contain a Confidence field that shows the confidence score assigned to each detection.
NMS Overlap argument
The NMS Overlap (nms_overlap in Python) parameter value controls controls how much overlap between two detections is allowed. To make predictions on large rasters, the data is divided into many individual tiles. After this is done, sometimes the same object can be detected in adjacent tiles. This could cause a single drainage crossing to be detected more than once, creating a duplicate entry in the output. Non-Maximum Suppression (NMS) is used to identify these duplicate detections and retain the detection with the higher confidence score. The NMS Overlap parameter value is based on Intersection over Union (IoU), the equation for which is as follows:
\(IoU\ =\ Area\ of\ Intersection\ \space / \space Area\ of\ Union\)
If two detections have an \(IoU\) greater than the specified NMS Overlap parameter value, the detection with the lower confidence score will be removed.
Batch Size argument
The Batch Size (batch_size in Python) parameter value is the number of image tiles that will be processed in each step of the model's inference. When a large raster is divided into many overlapping tiles, multiple tiles can be sent to the model and processed as a batch. A larger Batch Size value can improve the model's efficiency because the GPU can process more tiles simultaneously. However, this also increases the memory requirements of the GPU. Acceptable values follow a square number sequence (1, 4, 9, 16, 25, 64, and so on). If the input value is not a perfect square, the highest possible square value will be used. For example, if a value of 6 is specified, the batch size will be set to 4.
Use of a GPU
Under default conditions, this tool requires GPU processing to detect drainage crossings. See GPU Processing with Spatial Analyst for details about how this capability is supported, how to configure it, and how to enable it.
References
See the following references for additional information:
Bar, A., Wang, X., Kantorov, V., Reed, C. J., Herzig, R., Chechik, G., Rohrbach, A., Darrell, T., and Globerson, A. 2023. DETReg: Unsupervised pretraining with region priors for object detection (arXiv:2106.04550). arXiv. https://doi.org/10.48550/arXiv.2106.04550
SIUC, GeoFEW. 2024. Drainage crossing Detection data. figshare. Dataset. https://doi.org/10.6084/m9.figshare.25909453.v1. Licensed under the MIT License. Copyright © GeoFEW SIUC. Permission is hereby granted, free of charge, to any person obtaining a copy of this dataset and associated documentation files to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the dataset, subject to inclusion of the copyright notice and this permission notice in all copies or substantial portions of the dataset.