File size: 4,407 Bytes
6872ad9
0d0ec29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6872ad9
0d0ec29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
license: other
library_name: pytorch
pipeline_tag: image-segmentation
tags:
- remote-sensing
- change-detection
- binary-change-detection
- semantic-segmentation
- mamba
- mambarefine-cd
- mercon
metrics:
- f1
- iou
- precision
- recall
---

# MambaRefine-CD

MambaRefine-CD is a remote sensing binary change detection model. It takes a bi-temporal image pair as input and outputs a binary change mask. The paper has been accepted at MERCon. This Hugging Face repository contains trained weights, configs, and usage instructions.

## Model Details

- Model name: MambaRefine-CD
- Task: binary remote sensing change detection
- Input: pre-change and post-change image pair
- Output: binary change mask
- Framework: PyTorch
- Paper status: Accepted at MERCon
- GitHub repository: `https://github.com/Dineth14/MambaRefine-CD`

## Released Checkpoints

| Dataset | Checkpoint | Config | Train Split | Validation Split | Test Split | Main Metric | Notes |
| ------- | ---------- | ------ | ----------- | ---------------- | ---------- | ----------- | ----- |
| WHU-CD | `checkpoints/mambarefine_cd_whu_cd_best.pth` | `configs/whu_cd_run_config.yaml` | 6096 samples | 762 samples | 762 samples | Test F1 95.5324 | Best validation checkpoint, iteration 45000, threshold 0.55, EMA found. |
| DSIFN-CD | `checkpoints/mambarefine_cd_dsifn_cd_best.pth` | `configs/dsifn_cd_run_config.yaml` | 3153 samples | 3152 samples | Not specified in selected run manifest | Test F1 96.3963 | Best validation checkpoint, iteration 50000, threshold 0.60, EMA found. |

## Datasets and Splits

### WHU-CD

- Official/common dataset name: WHU-CD
- Dataset name used in config: `WHU-CD`
- Number of image pairs: train 6096, validation 762, test 762
- Image size: 256
- Mask format: binary change mask
- Binary threshold: `127` in `configs/active.yaml`
- Ignore index: Not specified in selected WHU-CD run config
- Normalization: ImageNet mean `[0.485, 0.456, 0.406]` and std `[0.229, 0.224, 0.225]` in `src/datasets/transforms.py`

### DSIFN-CD

- Official/common dataset name: DSIFN-CD
- Dataset name used in config: `DSIFN-CD`
- Number of image pairs: train 3153, validation 3152, test not specified in selected run manifest
- Image size: 256
- Mask format: binary change mask
- Binary threshold: `127` in `configs/active.yaml`
- Ignore index: Not specified in selected DSIFN-CD binary release run config
- Normalization: ImageNet mean `[0.485, 0.456, 0.406]` and std `[0.229, 0.224, 0.225]` in `src/datasets/transforms.py`

## Results

| Dataset | Precision | Recall | F1 | IoU | OA | Notes |
| ------- | --------: | -----: | -: | --: | -: | ----- |
| WHU-CD | 96.0072 | 95.0623 | 95.5324 | 91.4469 | 99.5715 | From selected WHU-CD test metrics. |
| DSIFN-CD | 96.2591 | 96.5340 | 96.3963 | 93.0434 | 97.4721 | From selected DSIFN-CD test metrics. |

## Installation

```bash
git clone https://github.com/Dineth14/MambaRefine-CD
cd MambaRefine-CD
pip install -r requirements.txt
pip install huggingface_hub
```

## Download Weights

```python
from huggingface_hub import hf_hub_download

ckpt_path = hf_hub_download(
    repo_id="<HF_USERNAME_OR_ORG>/MambaRefine0cd",
    filename="checkpoints/mambarefine_cd_whu_cd_best.pth",
)
print(ckpt_path)
```

## Loading the Model

```python
from src.engine.checkpoint import load_checkpoint
from src.models.build import build_model
from src.utils.config import load_config
from src.utils.device import get_device

cfg = load_config("configs/active.yaml")
device = get_device(cfg)
model = build_model(cfg).to(device)
checkpoint = load_checkpoint("checkpoints/mambarefine_cd_whu_cd_best.pth", model)
model.eval()
```

## Evaluation

The repository scripts read `configs/active.yaml`.

```bash
python val.py
python test.py
python infer.py
```

Before running evaluation with downloaded weights, set `checkpoint.path` in `configs/active.yaml` to the downloaded checkpoint path and set the dataset root to your local dataset.

## Limitations

- The weights are intended for remote sensing binary change detection.
- Results depend on dataset domain, resolution, preprocessing, and split consistency.
- Users should evaluate with the same preprocessing and splits used during training.
- DSIFN-CD test split count for the selected release run was not specified in the selected run manifest.

## Citation

Official citation will be added after the MERCon proceedings information is available.