πŸ›°οΈ Deforestation Detection App

This application uses a transformer-based ChangeFormer model to detect deforestation in the Brazilian Amazon using Sentinel-2 satellite imagery. Developed as a final year project, it processes 4-band (RGB + NIR) .tif images from 2020 and 2021 to generate binary change masks and overlay predictions, achieving an F1-score of 0.9986 and IoU of 0.9972 on validation data.


🌍 Overview

  • Model: Custom ChangeFormer with a Vision Transformer encoder, Feature Difference Module, and Deconv Decoder.
  • Data: Sentinel-2 Level-2A imagery (10m resolution) and PRODES deforestation labels.
  • Interface: Gradio-powered app for drag-and-drop uploads and real-time visualization.
  • Purpose: Scalable and interpretable tool for land monitoring, policy-making, and conservation.

✨ Features

  • Upload two .tif images (2020 and 2021) with 4 bands: B2 (blue), B3 (green), B4 (red), and B8 (NIR).
  • Outputs:
    • βœ… Raw RGB base image (2021)
    • βœ… Binary change mask (black/white)
    • βœ… RGB + red overlay for deforested regions
    • βœ… Comment on % of detected change
  • Handles large images with patch-based tiling, normalization, and stitching.

βš™οΈ Setup & Usage

πŸ”§ Prerequisites

  • Python 3.8+
  • Required libraries: torch, torchvision, timm, rasterio, numpy, pillow, gradio

πŸ“¦ Installation

git clone https://github.com/manuelhorvey/ChangeFormer.git
cd ChangeFormer
pip install -r requirements.txt

Place your trained model checkpoint as:

models/best_model.pth

πŸš€ Run Locally

python app.py

Then open: http://localhost:7860


πŸ§ͺ Input & Output

Input

  • Two 4-band .tif images from the same area:

    • One from 2020
    • One from 2021
  • Patches preferred (e.g., 256Γ—256)

Output

  • RGB image from 2021
  • Red-highlighted deforestation overlay
  • Binary change mask
  • Textual feedback on % change

☁️ Images with <20% cloud cover yield best accuracy.


πŸ“Š Project Details

Item Value
Region Brazilian Amazon (e.g., APA Triunfo do Xingu)
Dataset Size 19,560 patches (256Γ—256), 4 channels, 2 years
Metrics F1-score: 0.9986, IoU: 0.9972
Augmentations Rotations (90/180/270), flips
Future Plans Web-based monitoring alerts, SAR fusion, forecasting

πŸ‘₯ Authors

  • Emmanuel Amey
  • Sammuel Young Appiah
  • Asare Prince Owusu
  • Yaaya Pearl Apenu

Based on ideas from Alshehri et al. (2024), IEEE GRSL.


πŸͺͺ License

This project is licensed under the MIT License.


---
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ 1 Ask for provider support

Evaluation results