Skip to content

The Github repository include the code for training and predicting levees using Unet, Attention Unet and Swin UNETR deep learning models (Buławka et al...)

License

Notifications You must be signed in to change notification settings

nazarb/Levees_DL

Repository files navigation

Leveraging Big Multitemporal Multisource Satellite Data and Artificial Intelligence for the Detection of Complex and Invisible Features - the Case of Extensive Irrigation Mapping: Swin UNETR levee detection model

Buławka, Nazarij, Hector A. Orengo, Felipe Lumbreras Ruiz, Iban Berganzo-Besga and Ekta Gupta. n.d. ‘Leveraging Big Multitemporal Multisource Satellite Data and Artificial Intelligence for the Detection of Complex and Invisible Features - the Case of Extensive Irrigation Mapping’.

In publication

Abstract

The detection of buried or obscured archaeological features remains a central challenge in landscape archaeology, particularly in the irrigated floodplains of Mesopotamia where levees and canals formed the basis of complex agrarian systems. This study presents a deep learning–based approach for the large-scale, semi-automated detection of ancient levees in central Iraq, integrating big multitemporal and multisource satellite datasets with advanced instance segmentation models. Datasets were assembled from multitemporal Landsat 5, Sentinel-1 SAR, Sentinel-2 multispectral imagery, and the TanDEM-X Edited DSM, combined with vegetation and moisture indices, PCA reductions of seasonal variability, and Multi-Scale Relief Model (MSRM) outputs. Training labels were generated through both threshold-based automatic extraction and detailed manual digitisation. Three architectures: U-Net, Attention U-Net, and Swin UNETR, were evaluated on datasets containing 53, 48, and 36 bands. Results demonstrate that Swin UNETR consistently outperformed other models, particularly when trained on the 48-band dataset with manually digitised levees. Unlike wide automatic annotations, which produced irregular noisy patches, thin manual annotations yielded clearer, more linear predictions. Post-processing further refined outputs, allowing the model to achieve precision of 0.5140 and recall of 0.5919 at the pixel level. While metric scores remain modest, reflecting the irregularity of the archaeological features, the model successfully predicted levee networks across ~23,600 km², extending from Babylon to Uruk. Comparative analysis with independent palaeochannel reconstructions confirmed that the model identified many of the most prominent irrigation features while avoiding misclassification of modern infrastructure. The results highlight both the challenges and promise of deep learning in archaeological remote sensing. Automated predictions cannot yet replace interpretative digitisation, but they provide reproducible, standardised, and scalable outputs that can accelerate archaeological mapping and support regional-scale analysis. By leveraging multitemporal, multisource datasets and advanced AI architectures, this study demonstrates a pathway towards reconstructing irrigation systems of different historical periods and landscapes. The approach opens new possibilities for documenting, preserving, and interpreting water-management legacies in some of the world’s most significant ancient landscapes.

Levee detection demo

Open demo

Demo of the model includes:

  1. Initiate libraries
  2. Download raw data (utilize Copernicus GLO30 and the trained model
  3. Predict the the levees using Swin UNETR model
  4. Postprocessing

Full project workflow

Model

Setup

The Docker container and virtual envinronment used to run all the scripts is available here. More information how to install Docker is provided on the Docker website.

Pre-processing

The project constisted of two steps. First step was to develop a Deep Learning dataset, which was developed gradually. The final version of the dataset consisted of 20GB. The final steps was the development of the deep learning model.

  1. Calculate the multisource rasters using published Google Earth Engine code
  2. Create annotations
    1. Rasterize the levee network created for the purpose of this work - code
    2. Clip (QGIS 3.34.13)
    3. Adjust pixels in multisource raster and annotations (QGIS 3.34.13)
  3. Devide the images and annotations into tiles of 96x96 pixels - code
  4. Create JSON file with structure of the dataset
    1. Create JSON for one or all rasters - code
    2. Merge JSON files if necessary - code
  5. Perform augmentations using albumentations - code
  6. Create an augmented dataset
    1. Append augmented tiles to a JSON file
    2. Shuffle the tiles within collections used to train, validate and test the model (with a data leakage prevention mechanism) - code
    3. Check if the dataset does not have data leakage between train, validation and testing - code

The dataset structure is provided with following link

Train and validate the model

The research utilizes the Unet, Attention Unet and Swin UNETR developed by MONAI

Model selection part

The selection phase of the training included separate sets od code for training Unet, Attention Unet and Swin UNETR models

  • Unet
  • Attention Unet
  • Swin UNETR

The final model

The final version of the model utilized Swin UNETR

The code used in this stage is available using following link

Predict

The code used for prediction consists of several steps

  1. Calculate the multisource rasters using published Google Earth Engine code
  2. Run the detection code
    1. Select raster
    2. Convert to NPY
    3. Predict levees
    4. Convert predictions to TIF and merge them

Post-processing

  1. Post-processing code include:
    1. Filter by size (the filter excludes small features) - opencv-python connectedComponentsWithStats(); min_area = 350; connectivity=8
    2. Closing - opencv-python Closing; kernel = 7x7

Citation

@article{bulawkaLeveragingBigMultitemporal01,
	title = {Leveraging big multitemporal multisource satellite data and artificial intelligence for the detection of complex and invisible features - the case of extensive irrigation mapping},
	volume = {},
	doi = {},
	number = {},
	journal = {},
	author = {Buławka, Nazarij and Orengo, Hector A. and Lumbreras Ruiz, Felipe and Berganzo-Besga, Iban and Gupta, Ekta},
	pages = {},
}

Shield: CC BY 4.0

This work is licensed under a Creative Commons Attribution 4.0 International License.

CC BY 4.0

About

The Github repository include the code for training and predicting levees using Unet, Attention Unet and Swin UNETR deep learning models (Buławka et al...)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors