Skip to content

Contains different RX-based anomaly detection algorithms designed for real-time hyperspectral line-scan/pushbroom cameras.

License

Notifications You must be signed in to change notification settings

WiseGamgee/HyperAD

Repository files navigation

HyperAD

Contents

  1. Introduction
  2. How to Get Started
  3. Datasets
  4. Line-Scan Simulation
  5. Experiments
  6. Cite this Work

Introduction

HyperAD is a Python project that implements various RX-based real-time anomaly detection algorithms designed for hyperspectral line-scan cameras. It also proposes the Exponentially moving RX algorithm (ERX) for this task. An example of ERX detecting live wildfires is shown below:

SNP False Colour SNP Ground Truth

Wildfires in the Sequoia National Park (top) and ERX's detection heatmap (bottom) (Garske et al. 2024).

Line-scan cameras capture one line of pixels at a time, and require the motion of an attached platform such as a drone, aircraft, or satellite to collect an image. They are an affordable way of collecting hyperspectral images with high spectral and spatial resolutions.

Line-scanning (Garske et al. 2024)

A line-scan camera capturing one line of pixels at a time as it’s platform (e.g., a drone) moves over the area of interest. These lines form a hyperspectral image, or datacube, with the depth dimension b representing the spectral bands for each pixel (Garske et al. 2024).

How to Get Started

  1. Install python (this project was built on Python 3.9).

  2. Install requirements (ideally in a virtual environment):

pip install -r requirements.txt
  1. You can run the speed test right away (it uses generated data):
cd test_speed
python3 run_speed_test.py
python3 show_speed_results.py
  1. If you run into problems with the detectors, try this before rerunning step 3 again:
export PYTHONPATH=..
  1. For the other experiments download the datasets from here and put them in a \data folder. Repeat step three for the other experimental directories, and make sure you update and check the configuration file for each experiment for where the data is stored.

Please feel free to raise any issues with this guide or the code in general.

Datasets

Three annotated datasets are openly available here in .npy format (height, width, channels for image files, and height, width for masks):

Beach dataset - a natural coastal area with a variety of human-made anomalies present 🚗

Beach RGB Beach Ground Truth

Synthetic dataset - a constructed dataset using pixels sampled from AVIRIS with anomalous targets 🎯

Synthetic False Colour Synthetic Ground Truth

Sequoia National Park dataset - a national park with live wildfires present 🔥 This image is Sentinel-2 data extracted using sentinelhub.

SNP False Colour SNP Ground Truth

Line-Scan Simulation

The project simulates a line-scan camera by feeding each image dataset one line of pixels at a time to each detection algorithm. The simulation consists of two objects:

  • A sampler, which is used to store a hyperspectral image dataset and feed it line-by-line to the detector
  • A detector, which is the anomaly detection algorithm that processes each line.

The simulator and it's classes are contained in /utils/simulation_core.py, and the detection algorithms are in /detectors.

Experiments

Four experiments are contained in their own folders:

  1. test_speed - Tests the speed of the algorithms over increasing band/channel numbers.
  2. test_detection - Gets AUC of the algorithms for a given dataset.
  3. test_projection - An ablation study of sparse random projection.
  4. test_momentum - An ablation study of the exponentially moving mean and covariance. ERX is evaluated for different momentum values, and when the component is removed.
  5. [TBC] threshold_gridsearch - finds optimal thresholds for each dataset. Still being updated.

Cite this Work

If you use this repository or the datasets please cite this preprint:

@article{garske2024erx,
  title={ERX - a Fast Real-Time Anomaly Detection Algorithm for Hyperspectral Line-Scanning},
  author={Garske, Samuel and Evans, Bradley and Artlett, Christopher and Wong, KC},
  journal={arXiv preprint arXiv:2408.14947},
  year={2024},
}

If you use the beach dataset please cite the following paper as well:

@article{mao2022openhsi,
  title={OpenHSI: A complete open-source hyperspectral imaging solution for everyone},
  author={Mao, Yiwei and Betters, Christopher H and Evans, Bradley and Artlett, Christopher P and Leon-Saval, Sergio G and Garske, Samuel and Cairns, Iver H and Cocks, Terry and Winter, Robert and Dell, Timothy},
  journal={Remote Sensing},
  volume={14},
  number={9},
  pages={2244},
  year={2022},
  publisher={MDPI}
}

About

Contains different RX-based anomaly detection algorithms designed for real-time hyperspectral line-scan/pushbroom cameras.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages