Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentinel-CD: Satellite Change Detection

Given two co-registered images of the same area taken at different times, Sentinel-CD produces a binary mask highlighting regions that have changed — primarily building construction and demolition.


Demo — Hitech City, Hyderabad (2016 → 2026)

Before (2016) After (2026)
2016 2026

Detected changes (red):

Change overlay

New IT campuses and residential complexes constructed between 2016 and 2026 in Hitech City, Hyderabad.


UI

Empty state UI Empty

Detection results UI Results

AI Analysis UI Analysis


Results

Metric Score
F1 0.77
IoU 0.63
OA 0.98

Trained for 50 epochs on LEVIR-CD 256×256 with a Siamese ResNet34-UNet backbone.


Project structure

sentinel-cd/
├── model/
│   ├── model.py               # SiameseUNet architecture
│   └── best_model.pth         # trained checkpoint (not tracked by git)
├── inference/
│   ├── sliding_window.py      # inference on large images
│   └── visualize.py           # overlay mask on image
├── api/
│   └── app.py                 # FastAPI REST endpoint
├── assets/
│   ├── hitech_city_2016.png   # demo T1 image
│   ├── hitech_city_2026.png   # demo T2 image
│   └── change_overlay.png     # demo result
├── notebooks/
│   └── levir_cd_v2.ipynb      # Kaggle training notebook
└── requirements.txt

Setup

git clone https://github.com/keya115251/sentinel-cd.git
cd sentinel-cd
pip install -r requirements.txt

Download your trained checkpoint from Kaggle and place it at model/best_model.pth.


Sliding window inference

python inference/sliding_window.py \
    --t1 path/to/before.png \
    --t2 path/to/after.png \
    --checkpoint model/best_model.pth \
    --output output/change_mask.png
Option Default Description
--stride 128 Overlap between patches (128 = 50%)
--threshold 0.5 Change probability threshold

Visualize results

python inference/visualize.py \
    --t2 path/to/after.png \
    --mask output/change_mask.png \
    --output output/change_overlay.png

REST API

uvicorn api.app:app --host 0.0.0.0 --port 8000
curl -X POST http://localhost:8000/predict \
  -F "t1=@before.png" \
  -F "t2=@after.png" \
  --output change_mask.png

Open http://localhost:8000/docs for the Swagger UI.


Training

Open notebooks/levir_cd_v2.ipynb in Kaggle with a T4 GPU and the levir-cd-256 dataset. Run all cells. Expected runtime ~3–4 hours.


Model

Architecture Siamese UNet, ResNet34 encoder
Pretrained ImageNet
Input Two RGB patches concatenated → (B, 6, H, W)
Output Binary change mask → (B, 1, H, W)
Loss BCE + Dice, pos_weight=10
Dataset LEVIR-CD 256×256

About

Satellite and drone image change detection using a Siamese UNet trained on LEVIR-CD. Includes sliding window inference, a FastAPI backend, and a browser UI with real-time AI analysis powered by local Llama 3.1 8B.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages