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.
| Before (2016) | After (2026) |
|---|---|
![]() |
![]() |
Detected changes (red):
New IT campuses and residential complexes constructed between 2016 and 2026 in Hitech City, Hyderabad.
| 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.
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
git clone https://github.com/keya115251/sentinel-cd.git
cd sentinel-cd
pip install -r requirements.txtDownload your trained checkpoint from Kaggle and place it at model/best_model.pth.
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 |
python inference/visualize.py \
--t2 path/to/after.png \
--mask output/change_mask.png \
--output output/change_overlay.pnguvicorn api.app:app --host 0.0.0.0 --port 8000curl -X POST http://localhost:8000/predict \
-F "t1=@before.png" \
-F "t2=@after.png" \
--output change_mask.pngOpen http://localhost:8000/docs for the Swagger UI.
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.
| 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 |





