Skip to content

emvollmer/TASeg

Repository files navigation

Thermal Anomaly Segmenter (TASeg) for Leak Detection in District Heating Systems (DHSs)

This repository contains the code accompanying the paper "Leak Detection in District Heating Systems: Deep Learning versus Traditional Computer Vision State-of-the-Art", which utilises the Thermal Anomaly Segmentation dataset for model training. Both are based on the related publication "Detecting district heating leaks in thermal imagery: Comparison of anomaly detection methods" and the accompanying code and dataset on Zenodo.

The code aims to identify anomalies in thermal images pertaining to leaks in underground district heating system (DHS) pipelines. To this end, different variants of common deep learning semantic segmentation model architectures, specifically SegFormer, DeepLabV3+, UNet, and PSPNet, are trained on unmanned aircraft system (UAS)- based thermal imagery for thermal anomaly segmentation.

segformer_predictions_flyover.mp4

This repository also contains code for embedding the TASeg model(s) as well as the heuristic triangle-histogram-thresholding method into an overall analysis pipeline. Given inputs of UAS-based thermal image datasets, a map of colour-coded potential leak locations is returned.

The TASeg model-related code was also adapted for use on the AI4EOSC platform for training and inference as part of Horizon Europe's AI4EOSC project. It is publicly available on the platform dashboard as well as directly on GitHub.

Structure

├── cli_tools                           <- Dir for command line interface (CLI) tools
│   ├── __init__.py                         <- module creator
│   ├── README                              <- README for CLIs
│   ├── run_deep_learning.py                <- CLI for DL training and inference
│   └── run_leak_detection.py               <- CLI for leak detection pipeline
│
├── deep_learning                       <- Dir for all DL-related (TASeg) code
│   ├── configs                             <- Dir for training config files
│   ├── data                                <- Dir for data-related code
│   ├── models                              <- Dir for model-related code
│   ├── slurm                               <- Dir for slurm-based training code
│   ├── __init__.py                         <- module creator
│   ├── README                              <- README for TASeg
│   ├── infer.py                            <- inference script
│   └── train.py                            <- training script
│
├── gui_tools                           <- Dir for graphical user interface tools
│   ├── __init__.py                         <- module creator
│   ├── README                              <- README for GUIs
│   ├── classification_labeling_tool.py     <- GUI for manual labeling for classifier
│   └── segmentation_labeling_tool.py       <- GUI for manual labeling for TASeg
│
├── helpers                             <- Dir for helper code
├── pipeline                            <- Dir for DHS leak detection pipeline code
│   ├── configs                             <- Dir for pipeline config files
│   ├── data                                <- Dir for data-related code
│   ├── helpers                             <- Dir for helper code
│   ├── methodology                         <- Dir for methodology-related code
│   ├── __init__.py                         <- module creator
│   ├── README                              <- README for leak detection pipeline
│   ├── dhs_config_loader.py                <- script for config loading class
│   ├── stats_calculation.py                <- script for STEP 1
│   ├── anomaly_detection.py                <- script for STEP 2
│   ├── anomaly_extraction.py               <- script for STEP 3
│   └── anomaly_classification.py           <- script for STEP 4
│
├── resources                           <- Dir for resources
│   ├── assets                              <- Dir for README images
│   ├── building_data                       <- Dir for optional data (LOD1 building model)
│   └── splits                              <- Dir for optional data (splits for DL data) 
│
├── __init__.py                         <- module creator
├── LICENSE                             <- License file
├── README.md                           <- This file
├── requirements.txt                    <- requirements file for CUDA usage
└── requirements_no_cuda.txt            <- requirements file for non CUDA usage

Guides

To lean more about how to use the code in this repository, please refer to the below guides:

For more specific details, see:

Setting Up the Environment

Below are general instructions on how to set up the Python environment (virtualenv/conda environment) to run the repository code. Different platform / OS specific dependencies may require additional adaptations.

Utilise pre-existing

The accompanying Zenodo publication to this repository, "Thermal Anomaly Segmentation - Thermal UAS-based Images from Germany with Annotations for Semantic Segmentation Model Training", contains a packed dl_env.tar.gz which can be used for TASeg training.

To use it, simply unpack and activate via:

tar -xzf dl_env.tar.gz -C /path/to/dst/dir
source /path/to/dst/dir/dl_env/source/activate

It has been tested with Python 3.10. and CUDA 11.8.

Creating a new environment

Create a new conda or venv environment using one of the following command:

conda create --name env python=3.10
python3.10 -m venv env

Due to version conflicts with opencv, it is recommended to install most dependencies using pip instead of conda. The project root contains two files requirements.txt and requirements_no_cuda.txt. Depending on your system, chose the appropriate file and install the dependencies using the following command:

pip install -r requirements.txt

This should include most required dependencies, though it might be necessary to install additional ones.

License

This repository is released under the BSD-3-Clause license.

Acknowledgement

The authors acknowledge support by the state of Baden-Württemberg through bwHPC (bwUniCluster 2.0). We thank Marinus Vogl and the Air Bavarian GmbH for their support with equipment and service for the capturing of images.

About

Thermal Anomaly Segmenter (TASeg) for Leak Detection in District Heating Systems (DHSs)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors