This repository contains the code for reconstructing and improving the methodology proposed in the paper: "Integrating Unsupervised Machine Intelligence and Anomaly Detection for Spatio-Temporal Dynamic Mapping Using Remote Sensing Image Series" (Sustainability 2023).
The goal of this project is to map landscape disturbances (such as the Mariana and Brumadinho dam collapses, and intense deforestation in Altamira) using unsupervised machine learning applied to time-series remote sensing data from Google Earth Engine (GEE).
- Paper Reconstruction (Stage 1): We implemented the Isolation Forest (IF) and One-Class Support Vector Machine (OC-SVM) models to detect temporal anomalies across the reconstructed case study datasets:
- Altamira: MODIS (250m, NDVI)
- Brumadinho: Landsat-8 (30m, NDVI)
- Mariana: Sentinel-2 (10m, NDWI)
- Simple Baseline: We implemented a classical Z-Score thresholding model to serve as a statistical baseline (evaluated under both leaky and walk-forward leak-free settings).
- Improved Method (Stage 2): We introduced a Deep Learning approach using an LSTM Autoencoder. Unlike the classical methods that evaluate isolated pixel values, the LSTM captures the sequential, temporal relationships of the landscape over time, calculating reconstruction errors to flag structural anomalies.
- Task Type: Unsupervised Anomaly Detection (Multivariate input, Univariate output).
- Sampling Frequency: ~16 days (Terra MODIS), ~10-15 days (Landsat/Sentinel).
- Input Window Length: 3 time-steps (used for calculating Time-Aware Features like velocity, acceleration, and rolling stats for the LSTM).
- Forecast Horizon: N/A (Reconstruction-based detection, not future forecasting).
- Random Seeds: Fixed at
42where possible to ensure reproducibility.
Ensure you have Python 3.8+ installed.
Install the required packages using the provided requirements.txt:
pip install -r requirements.txtYou must also authenticate your Google Earth Engine account before running the pipelines:
earthengine authenticateAll experiments, parameters, and generated TIFFs are tracked automatically using MLflow. To start the local server (which includes a background daemon to prevent desktop.ini Google Drive syncing crashes):
python run_mlflow.pyAccess the dashboard at: http://localhost:5000
Download and preprocess the GEE data (removes clouds/shadows, calculates spectral indices, and centers the median trend):
python run_preprocessing.pyRun the classical anomaly detection algorithms (IF, OC-SVM) for each dataset:
python Altamira_Modis_repro.py
python Brumadinho_Landsat_repro.py
python Mariana_Sentinel_repro.pyRun the Simple Baseline (Z-Score) across all datasets:
python run_baseline_all.pyTrain the deep learning model to learn the structural sequences of the environment:
python train_deep.pyOnce trained, run the inference script to calculate reconstruction errors and map the anomalies:
python inference_deep.pyCompute the full 6-metric benchmark suite (Spatial Coherence, Flicker Ratio, Persistence, Cluster Size, Entropy, Contrast Ratio):
python compute_custom_metrics.py- MLflow Database: All models will log their
total_anomalies,total_transitions, unsupervised stability metrics, and hyperparameters directly to the MLflow UI. - GeoTIFFs: Georeferenced
.tifanomaly maps will be saved in theTiff/directory, categorized by algorithm and leak-free status. - Summary Reports: A consolidated benchmark table will be exported to
PAPER_TEXT_ALL_METRICS.csv.