--- license: mit language: en tags: - change-detection - satellite-imagery - deforestation - transformer - gradio - final-year-project datasets: - sentinel-2 model-index: - name: ChangeFormer results: - task: type: image-segmentation name: Change Detection dataset: name: Brazilian Amazon (2020โ€“2021) type: remote-sensing metrics: - type: f1 value: 0.9986 - type: iou value: 0.9972 --- # ๐Ÿ›ฐ๏ธ 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 ```bash 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 ```bash python app.py ``` Then open: [http://localhost:7860](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. ```` ---