Upload folder using huggingface_hub
Browse files- MODEL_FILES.md +43 -0
- README.md +128 -1
- checkpoints/mambarefine_cd_dsifn_cd_best.pth +3 -0
- checkpoints/mambarefine_cd_whu_cd_best.pth +3 -0
- configs/active.yaml +85 -0
- configs/datasets/dsifn.yaml +6 -0
- configs/datasets/whu.yaml +6 -0
- configs/dsifn_cd_run_config.yaml +296 -0
- configs/encoders/mambavision_small.yaml +4 -0
- configs/whu_cd_run_config.yaml +299 -0
- requirements_hf.txt +1 -0
- scripts/example_download.py +12 -0
- scripts/example_inference.py +45 -0
MODEL_FILES.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MambaRefine-CD Hugging Face Model Files
|
| 2 |
+
|
| 3 |
+
This manifest records the trained checkpoint files selected for the Hugging Face model repository `<HF_USERNAME_OR_ORG>/MambaRefine0cd`.
|
| 4 |
+
|
| 5 |
+
## Selected Checkpoints
|
| 6 |
+
|
| 7 |
+
| Dataset | Original checkpoint path | Hugging Face checkpoint path | Config file used | Metric source | SHA256 | File size | Notes |
|
| 8 |
+
|---|---|---|---|---|---|---:|---|
|
| 9 |
+
| WHU-CD | `outputs/whu/full/run_whu_whu_full_seed42_20260503_031818/checkpoints/best.pth` | `checkpoints/mambarefine_cd_whu_cd_best.pth` | `configs/whu_cd_run_config.yaml` | `outputs/whu/full/run_whu_whu_full_seed42_20260503_031818/test_results/test_metrics.json` | `cd3b176a483d5311c02251d2a72ac399de4aecec89ad2808df02805c89d33758` | 986.65 MiB | Best validation checkpoint, iteration 45000, EMA found, test F1 95.5324. |
|
| 10 |
+
| DSIFN-CD | `archive_legacy/committed_outputs/outputs/dsifn/a6_full/run_dsifn_a6_full_seed42_20260430_105918/checkpoints/best.pth` | `checkpoints/mambarefine_cd_dsifn_cd_best.pth` | `configs/dsifn_cd_run_config.yaml` | `archive_legacy/committed_outputs/outputs/dsifn/a6_full/run_dsifn_a6_full_seed42_20260430_105918/test_results/test_metrics.json` | `6b56becbba10ad6e67e772db939339f9040de61c73dc049e3c752d04eb0bdf6f` | 987.97 MiB | Best validation checkpoint, iteration 50000, EMA found, test F1 96.3963. |
|
| 11 |
+
|
| 12 |
+
## Copied Configs
|
| 13 |
+
|
| 14 |
+
| Release path | Source path | Purpose |
|
| 15 |
+
|---|---|---|
|
| 16 |
+
| `configs/whu_cd_run_config.yaml` | `outputs/whu/full/run_whu_whu_full_seed42_20260503_031818/config.yaml` | Frozen WHU-CD run config. |
|
| 17 |
+
| `configs/dsifn_cd_run_config.yaml` | `archive_legacy/committed_outputs/outputs/dsifn/a6_full/run_dsifn_a6_full_seed42_20260430_105918/config.yaml` | Frozen DSIFN-CD run config. |
|
| 18 |
+
| `configs/datasets/whu.yaml` | `configs/datasets/whu.yaml` | Dataset config. |
|
| 19 |
+
| `configs/datasets/dsifn.yaml` | `configs/datasets/dsifn.yaml` | Dataset config. |
|
| 20 |
+
| `configs/active.yaml` | `configs/active.yaml` | Current repo config entry point. |
|
| 21 |
+
| `configs/encoders/mambavision_small.yaml` | `configs/encoders/mambavision_small.yaml` | Encoder config. |
|
| 22 |
+
|
| 23 |
+
## Split Evidence
|
| 24 |
+
|
| 25 |
+
### WHU-CD
|
| 26 |
+
|
| 27 |
+
- Dataset config name: `WHU-CD`
|
| 28 |
+
- Train samples: 6096
|
| 29 |
+
- Validation samples: 762
|
| 30 |
+
- Test samples: 762
|
| 31 |
+
|
| 32 |
+
### DSIFN-CD
|
| 33 |
+
|
| 34 |
+
- Dataset config name: `DSIFN-CD`
|
| 35 |
+
- Train samples: 3153
|
| 36 |
+
- Validation samples: 3152
|
| 37 |
+
- Test samples: Not specified in selected run manifest
|
| 38 |
+
|
| 39 |
+
## TODOs
|
| 40 |
+
|
| 41 |
+
- Replace `<HF_USERNAME_OR_ORG>` with the actual Hugging Face user or organization at upload time.
|
| 42 |
+
- Add the official MERCon proceedings citation after publication details are available.
|
| 43 |
+
- Add DSIFN-CD test split count only if it is verified from repo artifacts.
|
README.md
CHANGED
|
@@ -1,3 +1,130 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: other
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
pipeline_tag: image-segmentation
|
| 5 |
+
tags:
|
| 6 |
+
- remote-sensing
|
| 7 |
+
- change-detection
|
| 8 |
+
- binary-change-detection
|
| 9 |
+
- semantic-segmentation
|
| 10 |
+
- mamba
|
| 11 |
+
- mambarefine-cd
|
| 12 |
+
- mercon
|
| 13 |
+
metrics:
|
| 14 |
+
- f1
|
| 15 |
+
- iou
|
| 16 |
+
- precision
|
| 17 |
+
- recall
|
| 18 |
---
|
| 19 |
+
|
| 20 |
+
# MambaRefine-CD
|
| 21 |
+
|
| 22 |
+
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.
|
| 23 |
+
|
| 24 |
+
## Model Details
|
| 25 |
+
|
| 26 |
+
- Model name: MambaRefine-CD
|
| 27 |
+
- Hugging Face repo: `<HF_USERNAME_OR_ORG>/MambaRefine0cd`
|
| 28 |
+
- Task: binary remote sensing change detection
|
| 29 |
+
- Input: pre-change and post-change image pair
|
| 30 |
+
- Output: binary change mask
|
| 31 |
+
- Framework: PyTorch
|
| 32 |
+
- Paper status: Accepted at MERCon
|
| 33 |
+
- GitHub repository: `https://github.com/Dineth14/MambaRefine-CD`
|
| 34 |
+
|
| 35 |
+
## Released Checkpoints
|
| 36 |
+
|
| 37 |
+
| Dataset | Checkpoint | Config | Train Split | Validation Split | Test Split | Main Metric | Notes |
|
| 38 |
+
| ------- | ---------- | ------ | ----------- | ---------------- | ---------- | ----------- | ----- |
|
| 39 |
+
| 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. |
|
| 40 |
+
| 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. |
|
| 41 |
+
|
| 42 |
+
## Datasets and Splits
|
| 43 |
+
|
| 44 |
+
### WHU-CD
|
| 45 |
+
|
| 46 |
+
- Official/common dataset name: WHU-CD
|
| 47 |
+
- Dataset name used in config: `WHU-CD`
|
| 48 |
+
- Number of image pairs: train 6096, validation 762, test 762
|
| 49 |
+
- Image size: 256
|
| 50 |
+
- Mask format: binary change mask
|
| 51 |
+
- Binary threshold: `127` in `configs/active.yaml`
|
| 52 |
+
- Ignore index: Not specified in selected WHU-CD run config
|
| 53 |
+
- Normalization: ImageNet mean `[0.485, 0.456, 0.406]` and std `[0.229, 0.224, 0.225]` in `src/datasets/transforms.py`
|
| 54 |
+
|
| 55 |
+
### DSIFN-CD
|
| 56 |
+
|
| 57 |
+
- Official/common dataset name: DSIFN-CD
|
| 58 |
+
- Dataset name used in config: `DSIFN-CD`
|
| 59 |
+
- Number of image pairs: train 3153, validation 3152, test not specified in selected run manifest
|
| 60 |
+
- Image size: 256
|
| 61 |
+
- Mask format: binary change mask
|
| 62 |
+
- Binary threshold: `127` in `configs/active.yaml`
|
| 63 |
+
- Ignore index: Not specified in selected DSIFN-CD binary release run config
|
| 64 |
+
- Normalization: ImageNet mean `[0.485, 0.456, 0.406]` and std `[0.229, 0.224, 0.225]` in `src/datasets/transforms.py`
|
| 65 |
+
|
| 66 |
+
## Results
|
| 67 |
+
|
| 68 |
+
| Dataset | Precision | Recall | F1 | IoU | OA | Notes |
|
| 69 |
+
| ------- | --------: | -----: | -: | --: | -: | ----- |
|
| 70 |
+
| WHU-CD | 96.0072 | 95.0623 | 95.5324 | 91.4469 | 99.5715 | From selected WHU-CD test metrics. |
|
| 71 |
+
| DSIFN-CD | 96.2591 | 96.5340 | 96.3963 | 93.0434 | 97.4721 | From selected DSIFN-CD test metrics. |
|
| 72 |
+
|
| 73 |
+
## Installation
|
| 74 |
+
|
| 75 |
+
```bash
|
| 76 |
+
git clone https://github.com/Dineth14/MambaRefine-CD
|
| 77 |
+
cd MambaRefine-CD
|
| 78 |
+
pip install -r requirements.txt
|
| 79 |
+
pip install huggingface_hub
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Download Weights
|
| 83 |
+
|
| 84 |
+
```python
|
| 85 |
+
from huggingface_hub import hf_hub_download
|
| 86 |
+
|
| 87 |
+
ckpt_path = hf_hub_download(
|
| 88 |
+
repo_id="<HF_USERNAME_OR_ORG>/MambaRefine0cd",
|
| 89 |
+
filename="checkpoints/mambarefine_cd_whu_cd_best.pth",
|
| 90 |
+
)
|
| 91 |
+
print(ckpt_path)
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
## Loading the Model
|
| 95 |
+
|
| 96 |
+
```python
|
| 97 |
+
from src.engine.checkpoint import load_checkpoint
|
| 98 |
+
from src.models.build import build_model
|
| 99 |
+
from src.utils.config import load_config
|
| 100 |
+
from src.utils.device import get_device
|
| 101 |
+
|
| 102 |
+
cfg = load_config("configs/active.yaml")
|
| 103 |
+
device = get_device(cfg)
|
| 104 |
+
model = build_model(cfg).to(device)
|
| 105 |
+
checkpoint = load_checkpoint("checkpoints/mambarefine_cd_whu_cd_best.pth", model)
|
| 106 |
+
model.eval()
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
## Evaluation
|
| 110 |
+
|
| 111 |
+
The repository scripts read `configs/active.yaml`.
|
| 112 |
+
|
| 113 |
+
```bash
|
| 114 |
+
python val.py
|
| 115 |
+
python test.py
|
| 116 |
+
python infer.py
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
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.
|
| 120 |
+
|
| 121 |
+
## Limitations
|
| 122 |
+
|
| 123 |
+
- The weights are intended for remote sensing binary change detection.
|
| 124 |
+
- Results depend on dataset domain, resolution, preprocessing, and split consistency.
|
| 125 |
+
- Users should evaluate with the same preprocessing and splits used during training.
|
| 126 |
+
- DSIFN-CD test split count for the selected release run was not specified in the selected run manifest.
|
| 127 |
+
|
| 128 |
+
## Citation
|
| 129 |
+
|
| 130 |
+
Official citation will be added after the MERCon proceedings information is available.
|
checkpoints/mambarefine_cd_dsifn_cd_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6b56becbba10ad6e67e772db939339f9040de61c73dc049e3c752d04eb0bdf6f
|
| 3 |
+
size 1035963870
|
checkpoints/mambarefine_cd_whu_cd_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cd3b176a483d5311c02251d2a72ac399de4aecec89ad2808df02805c89d33758
|
| 3 |
+
size 1034581134
|
configs/active.yaml
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
project:
|
| 2 |
+
name: MambaRefine-CD
|
| 3 |
+
output_root: outputs
|
| 4 |
+
seed: 42
|
| 5 |
+
|
| 6 |
+
data:
|
| 7 |
+
dataset_name: DSIFN-CD
|
| 8 |
+
root: datasets/DSIFN-CD
|
| 9 |
+
image_size: 256
|
| 10 |
+
train_dir: train
|
| 11 |
+
val_dir: val
|
| 12 |
+
test_dir: test
|
| 13 |
+
a_folder: A
|
| 14 |
+
b_folder: B
|
| 15 |
+
mask_folder: Mask
|
| 16 |
+
binary_threshold: 127
|
| 17 |
+
check_split_overlap: true
|
| 18 |
+
check_hash_overlap: true
|
| 19 |
+
|
| 20 |
+
model:
|
| 21 |
+
name: MambaRefineCD
|
| 22 |
+
encoder_family: mambavision
|
| 23 |
+
encoder_variant: small
|
| 24 |
+
encoder_pretrained: true
|
| 25 |
+
freeze_encoder: false
|
| 26 |
+
unfreeze_after_iters: null
|
| 27 |
+
decoder_channels: 128
|
| 28 |
+
|
| 29 |
+
ablation:
|
| 30 |
+
id: original
|
| 31 |
+
temporal_input_mode: abs_signed # abs_only | signed_only | abs_signed
|
| 32 |
+
|
| 33 |
+
train:
|
| 34 |
+
device: cuda:0
|
| 35 |
+
iterations: 50000
|
| 36 |
+
batch_size: 8
|
| 37 |
+
num_workers: 8
|
| 38 |
+
lr: 0.0001
|
| 39 |
+
weight_decay: 0.01
|
| 40 |
+
optimizer: adamw
|
| 41 |
+
scheduler: cosine
|
| 42 |
+
warmup_iters: 1000
|
| 43 |
+
amp: true
|
| 44 |
+
grad_clip_norm: 1.0
|
| 45 |
+
log_interval: 50
|
| 46 |
+
val_interval: 5000
|
| 47 |
+
save_best_only: true
|
| 48 |
+
best_metric: F1
|
| 49 |
+
higher_is_better: true
|
| 50 |
+
|
| 51 |
+
loss:
|
| 52 |
+
bce_weight: 1.0
|
| 53 |
+
dice_weight: 1.0
|
| 54 |
+
aux_weight: 0.2
|
| 55 |
+
boundary_weight: 0.2
|
| 56 |
+
residual_reg_weight: 0.02
|
| 57 |
+
|
| 58 |
+
eval:
|
| 59 |
+
threshold: 0.5
|
| 60 |
+
sweep_thresholds_on_val: true
|
| 61 |
+
use_val_threshold_for_test: true
|
| 62 |
+
also_report_test_sweep: true
|
| 63 |
+
threshold_min: 0.05
|
| 64 |
+
threshold_max: 0.95
|
| 65 |
+
threshold_step: 0.05
|
| 66 |
+
save_predictions: true
|
| 67 |
+
measure_fps: true
|
| 68 |
+
|
| 69 |
+
checkpoint:
|
| 70 |
+
path: null
|
| 71 |
+
auto_find_latest_best: true
|
| 72 |
+
|
| 73 |
+
resume:
|
| 74 |
+
enabled: false
|
| 75 |
+
path: null
|
| 76 |
+
resume_optimizer: true
|
| 77 |
+
resume_scheduler: true
|
| 78 |
+
resume_iteration: true
|
| 79 |
+
|
| 80 |
+
logging:
|
| 81 |
+
tensorboard: true
|
| 82 |
+
print_params: true
|
| 83 |
+
print_flops: true
|
| 84 |
+
print_peak_memory: true
|
| 85 |
+
print_fps: true
|
configs/datasets/dsifn.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
data:
|
| 2 |
+
dataset_name: DSIFN-CD
|
| 3 |
+
root: datasets/DSIFN-CD
|
| 4 |
+
a_folder: A
|
| 5 |
+
b_folder: B
|
| 6 |
+
mask_folder: Mask
|
configs/datasets/whu.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
data:
|
| 2 |
+
dataset_name: WHU-CD
|
| 3 |
+
root: datasets/WHU-CD
|
| 4 |
+
a_folder: A
|
| 5 |
+
b_folder: B
|
| 6 |
+
mask_folder: Mask
|
configs/dsifn_cd_run_config.yaml
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
experiment:
|
| 2 |
+
name: a6_full
|
| 3 |
+
output_root: outputs/dsifn/a6_full
|
| 4 |
+
seed: 42
|
| 5 |
+
hardware:
|
| 6 |
+
device: cuda:1
|
| 7 |
+
gpu_ids:
|
| 8 |
+
- 1
|
| 9 |
+
mixed_precision: true
|
| 10 |
+
efficiency:
|
| 11 |
+
amp: true
|
| 12 |
+
amp_dtype: fp16
|
| 13 |
+
channels_last: false
|
| 14 |
+
gradient_checkpointing: false
|
| 15 |
+
compile: false
|
| 16 |
+
compile_mode: reduce-overhead
|
| 17 |
+
fast_mode: false
|
| 18 |
+
channels_multiplier: 1.0
|
| 19 |
+
profiling:
|
| 20 |
+
enabled: false
|
| 21 |
+
warmup_iters: 20
|
| 22 |
+
profile_iters: 100
|
| 23 |
+
log_interval: 10
|
| 24 |
+
dataloader:
|
| 25 |
+
num_workers: 8
|
| 26 |
+
pin_memory: true
|
| 27 |
+
persistent_workers: true
|
| 28 |
+
prefetch_factor: 4
|
| 29 |
+
drop_last: true
|
| 30 |
+
logging:
|
| 31 |
+
train_metrics_every_iter: false
|
| 32 |
+
save_visualizations: false
|
| 33 |
+
log_interval: 20
|
| 34 |
+
optimizer:
|
| 35 |
+
grad_clip_norm: 0.5
|
| 36 |
+
dataset:
|
| 37 |
+
name: DSIFN-CD
|
| 38 |
+
root: /storage2/ChangeDetection/MV/Datasets/DSIFN-CD/DSIFN
|
| 39 |
+
mode: binary
|
| 40 |
+
task_type: binary_change
|
| 41 |
+
image_size: 256
|
| 42 |
+
num_workers: 8
|
| 43 |
+
pin_memory: true
|
| 44 |
+
persistent_workers: true
|
| 45 |
+
prefetch_factor: 4
|
| 46 |
+
val_ratio: 0.2
|
| 47 |
+
augmentation: true
|
| 48 |
+
batch_size: 8
|
| 49 |
+
augmentation_ops:
|
| 50 |
+
- horizontal_flip
|
| 51 |
+
- vertical_flip
|
| 52 |
+
cache_images_in_ram: false
|
| 53 |
+
cache_masks_in_ram: false
|
| 54 |
+
model:
|
| 55 |
+
mode: dual
|
| 56 |
+
backbone: mambavision
|
| 57 |
+
variant: small
|
| 58 |
+
decoder: adaptive_rf
|
| 59 |
+
pretrained: true
|
| 60 |
+
output_mode: binary
|
| 61 |
+
num_classes: 1
|
| 62 |
+
freeze_backbone: false
|
| 63 |
+
drbi:
|
| 64 |
+
enabled: true
|
| 65 |
+
signed_diff:
|
| 66 |
+
enabled: true
|
| 67 |
+
cram_lite:
|
| 68 |
+
enabled: true
|
| 69 |
+
alpha: 0.5
|
| 70 |
+
apply_stages:
|
| 71 |
+
- 0
|
| 72 |
+
- 1
|
| 73 |
+
- 2
|
| 74 |
+
attention_type: spatial
|
| 75 |
+
arf_fpn:
|
| 76 |
+
enabled: true
|
| 77 |
+
boundary_refine:
|
| 78 |
+
enabled: true
|
| 79 |
+
enable_semantic_heads: false
|
| 80 |
+
difference:
|
| 81 |
+
enabled: true
|
| 82 |
+
type: region_boundary
|
| 83 |
+
out_channels: 256
|
| 84 |
+
use_depthwise: true
|
| 85 |
+
gate_hidden_ratio: 0.25
|
| 86 |
+
pre_norm: true
|
| 87 |
+
use_absdiff: true
|
| 88 |
+
use_signed_diff: true
|
| 89 |
+
use_product: false
|
| 90 |
+
product_scale: 0.25
|
| 91 |
+
use_region_gate: true
|
| 92 |
+
use_boundary_gate: true
|
| 93 |
+
region_gate_min: 0.2
|
| 94 |
+
region_gate_max: 0.8
|
| 95 |
+
boundary_gate_min: 0.0
|
| 96 |
+
boundary_gate_max: 0.4
|
| 97 |
+
return_debug: false
|
| 98 |
+
decoder:
|
| 99 |
+
type: adaptive_rf
|
| 100 |
+
channels: 256
|
| 101 |
+
dilation_rates:
|
| 102 |
+
- 1
|
| 103 |
+
- 2
|
| 104 |
+
- 4
|
| 105 |
+
- 8
|
| 106 |
+
use_boundary_residual: true
|
| 107 |
+
residual_scale: 0.1
|
| 108 |
+
use_depthwise: true
|
| 109 |
+
aux_weight: 0.4
|
| 110 |
+
training:
|
| 111 |
+
max_iterations: 50000
|
| 112 |
+
batch_size: 8
|
| 113 |
+
lr: 5.0e-05
|
| 114 |
+
optimizer: AdamW
|
| 115 |
+
scheduler: cosine
|
| 116 |
+
warmup_iterations: 2500
|
| 117 |
+
validate_every: 5000
|
| 118 |
+
log_every: 20
|
| 119 |
+
gradient_clip: 0.5
|
| 120 |
+
weight_decay: 0.01
|
| 121 |
+
skip_nan_steps: true
|
| 122 |
+
nan_diag_every: 50
|
| 123 |
+
non_blocking_transfer: true
|
| 124 |
+
gradient_checkpointing: false
|
| 125 |
+
use_ema: true
|
| 126 |
+
ema_decay: 0.999
|
| 127 |
+
overwrite_output_dir: false
|
| 128 |
+
allow_resume_for_ablation: false
|
| 129 |
+
validation:
|
| 130 |
+
batch_size: 4
|
| 131 |
+
save_samples: true
|
| 132 |
+
sample_count: 16
|
| 133 |
+
split: val
|
| 134 |
+
evaluation:
|
| 135 |
+
split: test
|
| 136 |
+
threshold: 0.5
|
| 137 |
+
threshold_sweep:
|
| 138 |
+
enabled: true
|
| 139 |
+
values:
|
| 140 |
+
- 0.3
|
| 141 |
+
- 0.35
|
| 142 |
+
- 0.4
|
| 143 |
+
- 0.45
|
| 144 |
+
- 0.5
|
| 145 |
+
- 0.55
|
| 146 |
+
- 0.6
|
| 147 |
+
threshold_select_metric: F1_1
|
| 148 |
+
use_ema: true
|
| 149 |
+
inference_mode: patch
|
| 150 |
+
crop_size: 256
|
| 151 |
+
overlap: 0.25
|
| 152 |
+
use_tta: false
|
| 153 |
+
save_predictions: false
|
| 154 |
+
save_visualizations: false
|
| 155 |
+
memory_efficient: true
|
| 156 |
+
threshold_list:
|
| 157 |
+
- 0.3
|
| 158 |
+
- 0.35
|
| 159 |
+
- 0.4
|
| 160 |
+
- 0.45
|
| 161 |
+
- 0.5
|
| 162 |
+
- 0.55
|
| 163 |
+
- 0.6
|
| 164 |
+
tta_augmentations:
|
| 165 |
+
- original
|
| 166 |
+
- hflip
|
| 167 |
+
- vflip
|
| 168 |
+
- rot90
|
| 169 |
+
use_cached_predictions: false
|
| 170 |
+
loss:
|
| 171 |
+
type: bce_dice
|
| 172 |
+
final:
|
| 173 |
+
type: bce_dice
|
| 174 |
+
bce_weight: 1.0
|
| 175 |
+
dice_weight: 1.0
|
| 176 |
+
coarse:
|
| 177 |
+
enabled: true
|
| 178 |
+
weight: 0.4
|
| 179 |
+
boundary:
|
| 180 |
+
enabled: true
|
| 181 |
+
weight: 0.1
|
| 182 |
+
type: bce_dice
|
| 183 |
+
target_type: sobel
|
| 184 |
+
edge_width: 3
|
| 185 |
+
bce_weight: 1.0
|
| 186 |
+
dice_weight: 1.0
|
| 187 |
+
focal_weight: 0.0
|
| 188 |
+
boundary_weight: 0.1
|
| 189 |
+
focal_gamma: 1.5
|
| 190 |
+
metrics:
|
| 191 |
+
allowed:
|
| 192 |
+
- Pre
|
| 193 |
+
- Rec
|
| 194 |
+
- F1
|
| 195 |
+
- IoU
|
| 196 |
+
- OA
|
| 197 |
+
average_mode: global
|
| 198 |
+
ema:
|
| 199 |
+
enabled: true
|
| 200 |
+
decay: 0.999
|
| 201 |
+
store_on_cpu: true
|
| 202 |
+
resume:
|
| 203 |
+
enabled: false
|
| 204 |
+
checkpoint_path: null
|
| 205 |
+
strict: true
|
| 206 |
+
checkpoint:
|
| 207 |
+
path: null
|
| 208 |
+
monitor: f1
|
| 209 |
+
mode: max
|
| 210 |
+
save_best_only: true
|
| 211 |
+
selection_metric: F1
|
| 212 |
+
save_best: true
|
| 213 |
+
save_last: true
|
| 214 |
+
save_every: null
|
| 215 |
+
save_latest: true
|
| 216 |
+
latest_every: 5000
|
| 217 |
+
boundary_metrics:
|
| 218 |
+
enabled: true
|
| 219 |
+
boundary_width: 3
|
| 220 |
+
tolerance: 2
|
| 221 |
+
debug:
|
| 222 |
+
enabled: false
|
| 223 |
+
output_root: debug
|
| 224 |
+
ablation_trace: false
|
| 225 |
+
name: memory_debug
|
| 226 |
+
steps: 3
|
| 227 |
+
batch_size: 8
|
| 228 |
+
image_size: 256
|
| 229 |
+
use_amp: true
|
| 230 |
+
profile_torch_ops: true
|
| 231 |
+
profile_one_step_only: true
|
| 232 |
+
compare_modes:
|
| 233 |
+
- baseline_forward_only
|
| 234 |
+
- train_forward_loss_backward
|
| 235 |
+
- train_with_return_features_false
|
| 236 |
+
- train_with_return_features_true
|
| 237 |
+
- train_with_ema_disabled
|
| 238 |
+
- train_with_ema_enabled
|
| 239 |
+
- train_with_tta_disabled
|
| 240 |
+
- eval_no_grad
|
| 241 |
+
- eval_with_tta
|
| 242 |
+
- decoder_baseline
|
| 243 |
+
- decoder_refinement
|
| 244 |
+
- decoder_adaptive_rf
|
| 245 |
+
save_memory_summary: true
|
| 246 |
+
seed: 42
|
| 247 |
+
task: binary_cd
|
| 248 |
+
eval:
|
| 249 |
+
split: test
|
| 250 |
+
threshold: 0.5
|
| 251 |
+
threshold_sweep:
|
| 252 |
+
enabled: true
|
| 253 |
+
values:
|
| 254 |
+
- 0.3
|
| 255 |
+
- 0.35
|
| 256 |
+
- 0.4
|
| 257 |
+
- 0.45
|
| 258 |
+
- 0.5
|
| 259 |
+
- 0.55
|
| 260 |
+
- 0.6
|
| 261 |
+
threshold_select_metric: F1_1
|
| 262 |
+
use_ema: true
|
| 263 |
+
inference_mode: patch
|
| 264 |
+
crop_size: 256
|
| 265 |
+
overlap: 0.25
|
| 266 |
+
use_tta: false
|
| 267 |
+
save_predictions: false
|
| 268 |
+
save_visualizations: false
|
| 269 |
+
memory_efficient: true
|
| 270 |
+
threshold_list:
|
| 271 |
+
- 0.3
|
| 272 |
+
- 0.35
|
| 273 |
+
- 0.4
|
| 274 |
+
- 0.45
|
| 275 |
+
- 0.5
|
| 276 |
+
- 0.55
|
| 277 |
+
- 0.6
|
| 278 |
+
tta_augmentations:
|
| 279 |
+
- original
|
| 280 |
+
- hflip
|
| 281 |
+
- vflip
|
| 282 |
+
- rot90
|
| 283 |
+
use_cached_predictions: false
|
| 284 |
+
post_training: {}
|
| 285 |
+
benchmark:
|
| 286 |
+
model_name: a6_full
|
| 287 |
+
output_dir: outputs/benchmark_runs/summary
|
| 288 |
+
datasets:
|
| 289 |
+
- DSIFN-CD
|
| 290 |
+
- WHU-CD
|
| 291 |
+
eval_split: test
|
| 292 |
+
main_dataset: DSIFN-CD
|
| 293 |
+
checkpoints: {}
|
| 294 |
+
_meta:
|
| 295 |
+
config_path: /storage2/ChangeDetection/MV/MambaRefine-CD/configs/ablations/dsifn/a6_full.yaml
|
| 296 |
+
config_fingerprint: a38e4e9372c18e99
|
configs/encoders/mambavision_small.yaml
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
hardware:
|
| 6 |
+
device: cuda:0
|
| 7 |
+
gpu_ids:
|
| 8 |
+
- 0
|
| 9 |
+
mixed_precision: true
|
| 10 |
+
efficiency:
|
| 11 |
+
amp: true
|
| 12 |
+
amp_dtype: fp16
|
| 13 |
+
channels_last: false
|
| 14 |
+
gradient_checkpointing: false
|
| 15 |
+
compile: false
|
| 16 |
+
compile_mode: reduce-overhead
|
| 17 |
+
fast_mode: false
|
| 18 |
+
channels_multiplier: 1.0
|
| 19 |
+
profiling:
|
| 20 |
+
enabled: false
|
| 21 |
+
warmup_iters: 20
|
| 22 |
+
profile_iters: 100
|
| 23 |
+
log_interval: 10
|
| 24 |
+
dataloader:
|
| 25 |
+
num_workers: 8
|
| 26 |
+
pin_memory: true
|
| 27 |
+
persistent_workers: true
|
| 28 |
+
prefetch_factor: 4
|
| 29 |
+
drop_last: true
|
| 30 |
+
logging:
|
| 31 |
+
train_metrics_every_iter: false
|
| 32 |
+
save_visualizations: false
|
| 33 |
+
log_interval: 20
|
| 34 |
+
optimizer:
|
| 35 |
+
grad_clip_norm: 0.5
|
| 36 |
+
dataset:
|
| 37 |
+
name: WHU-CD
|
| 38 |
+
root: /storage2/ChangeDetection/MV/Datasets/WHU-CD
|
| 39 |
+
split_dir: /storage2/ChangeDetection/MV/Datasets/DSIFN-CD/DSIFN/splits
|
| 40 |
+
require_explicit_splits: true
|
| 41 |
+
mode: binary
|
| 42 |
+
task_type: binary_change
|
| 43 |
+
image_size: 256
|
| 44 |
+
num_workers: 8
|
| 45 |
+
pin_memory: true
|
| 46 |
+
persistent_workers: true
|
| 47 |
+
prefetch_factor: 4
|
| 48 |
+
val_ratio: 0.2
|
| 49 |
+
augmentation: true
|
| 50 |
+
batch_size: 8
|
| 51 |
+
cache_images_in_ram: false
|
| 52 |
+
cache_masks_in_ram: false
|
| 53 |
+
model:
|
| 54 |
+
mode: dual
|
| 55 |
+
backbone: mambavision
|
| 56 |
+
variant: small
|
| 57 |
+
decoder: adaptive_rf
|
| 58 |
+
pretrained: true
|
| 59 |
+
output_mode: binary
|
| 60 |
+
num_classes: 1
|
| 61 |
+
freeze_backbone: false
|
| 62 |
+
drbi:
|
| 63 |
+
enabled: true
|
| 64 |
+
signed_diff:
|
| 65 |
+
enabled: true
|
| 66 |
+
cram_lite:
|
| 67 |
+
enabled: true
|
| 68 |
+
alpha: 0.5
|
| 69 |
+
apply_stages:
|
| 70 |
+
- 0
|
| 71 |
+
- 1
|
| 72 |
+
- 2
|
| 73 |
+
attention_type: spatial
|
| 74 |
+
arf_fpn:
|
| 75 |
+
enabled: true
|
| 76 |
+
boundary_refine:
|
| 77 |
+
enabled: false
|
| 78 |
+
enable_semantic_heads: false
|
| 79 |
+
difference:
|
| 80 |
+
enabled: true
|
| 81 |
+
type: region_boundary
|
| 82 |
+
out_channels: 256
|
| 83 |
+
use_depthwise: true
|
| 84 |
+
gate_hidden_ratio: 0.25
|
| 85 |
+
pre_norm: true
|
| 86 |
+
use_absdiff: true
|
| 87 |
+
use_signed_diff: true
|
| 88 |
+
use_product: false
|
| 89 |
+
product_scale: 0.25
|
| 90 |
+
use_region_gate: true
|
| 91 |
+
use_boundary_gate: true
|
| 92 |
+
region_gate_min: 0.2
|
| 93 |
+
region_gate_max: 0.8
|
| 94 |
+
boundary_gate_min: 0.0
|
| 95 |
+
boundary_gate_max: 0.4
|
| 96 |
+
return_debug: false
|
| 97 |
+
decoder:
|
| 98 |
+
type: adaptive_rf
|
| 99 |
+
channels: 256
|
| 100 |
+
dilation_rates:
|
| 101 |
+
- 1
|
| 102 |
+
- 2
|
| 103 |
+
- 4
|
| 104 |
+
- 8
|
| 105 |
+
use_boundary_residual: false
|
| 106 |
+
residual_scale: 0.0
|
| 107 |
+
use_depthwise: true
|
| 108 |
+
aux_weight: 0.4
|
| 109 |
+
training:
|
| 110 |
+
max_iterations: 50000
|
| 111 |
+
batch_size: 8
|
| 112 |
+
lr: 5.0e-05
|
| 113 |
+
optimizer: AdamW
|
| 114 |
+
scheduler: cosine
|
| 115 |
+
warmup_iterations: 2500
|
| 116 |
+
validate_every: 5000
|
| 117 |
+
log_every: 20
|
| 118 |
+
gradient_clip: 0.5
|
| 119 |
+
weight_decay: 0.01
|
| 120 |
+
skip_nan_steps: true
|
| 121 |
+
nan_diag_every: 50
|
| 122 |
+
non_blocking_transfer: true
|
| 123 |
+
gradient_checkpointing: false
|
| 124 |
+
use_ema: true
|
| 125 |
+
ema_decay: 0.999
|
| 126 |
+
overwrite_output_dir: false
|
| 127 |
+
allow_resume_for_ablation: false
|
| 128 |
+
validation:
|
| 129 |
+
batch_size: 4
|
| 130 |
+
save_samples: true
|
| 131 |
+
sample_count: 16
|
| 132 |
+
split: val
|
| 133 |
+
evaluation:
|
| 134 |
+
split: test
|
| 135 |
+
threshold: 0.5
|
| 136 |
+
threshold_sweep:
|
| 137 |
+
enabled: true
|
| 138 |
+
values:
|
| 139 |
+
- 0.3
|
| 140 |
+
- 0.35
|
| 141 |
+
- 0.4
|
| 142 |
+
- 0.45
|
| 143 |
+
- 0.5
|
| 144 |
+
- 0.55
|
| 145 |
+
- 0.6
|
| 146 |
+
threshold_select_metric: F1_1
|
| 147 |
+
use_ema: true
|
| 148 |
+
inference_mode: patch
|
| 149 |
+
crop_size: 256
|
| 150 |
+
overlap: 0.25
|
| 151 |
+
use_tta: false
|
| 152 |
+
save_predictions: false
|
| 153 |
+
save_visualizations: false
|
| 154 |
+
memory_efficient: true
|
| 155 |
+
log_mask_debug: true
|
| 156 |
+
save_debug_outputs: false
|
| 157 |
+
threshold_list:
|
| 158 |
+
- 0.3
|
| 159 |
+
- 0.35
|
| 160 |
+
- 0.4
|
| 161 |
+
- 0.45
|
| 162 |
+
- 0.5
|
| 163 |
+
- 0.55
|
| 164 |
+
- 0.6
|
| 165 |
+
tta_augmentations:
|
| 166 |
+
- original
|
| 167 |
+
- hflip
|
| 168 |
+
- vflip
|
| 169 |
+
- rot90
|
| 170 |
+
use_cached_predictions: false
|
| 171 |
+
loss:
|
| 172 |
+
type: bce_dice
|
| 173 |
+
final:
|
| 174 |
+
type: bce_dice
|
| 175 |
+
bce_weight: 1.0
|
| 176 |
+
dice_weight: 1.0
|
| 177 |
+
coarse:
|
| 178 |
+
enabled: true
|
| 179 |
+
weight: 0.4
|
| 180 |
+
boundary:
|
| 181 |
+
enabled: true
|
| 182 |
+
weight: 0.1
|
| 183 |
+
type: bce_dice
|
| 184 |
+
target_type: sobel
|
| 185 |
+
edge_width: 3
|
| 186 |
+
bce_weight: 1.0
|
| 187 |
+
dice_weight: 1.0
|
| 188 |
+
focal_weight: 0.0
|
| 189 |
+
boundary_weight: 0.1
|
| 190 |
+
focal_gamma: 1.5
|
| 191 |
+
metrics:
|
| 192 |
+
allowed:
|
| 193 |
+
- Pre
|
| 194 |
+
- Rec
|
| 195 |
+
- F1
|
| 196 |
+
- IoU
|
| 197 |
+
- OA
|
| 198 |
+
average_mode: global
|
| 199 |
+
ema:
|
| 200 |
+
enabled: true
|
| 201 |
+
decay: 0.999
|
| 202 |
+
store_on_cpu: true
|
| 203 |
+
resume:
|
| 204 |
+
enabled: false
|
| 205 |
+
checkpoint_path: null
|
| 206 |
+
strict: true
|
| 207 |
+
checkpoint:
|
| 208 |
+
path: null
|
| 209 |
+
monitor: f1
|
| 210 |
+
mode: max
|
| 211 |
+
save_best_only: true
|
| 212 |
+
selection_metric: F1
|
| 213 |
+
save_best: true
|
| 214 |
+
save_last: true
|
| 215 |
+
save_every: null
|
| 216 |
+
save_latest: true
|
| 217 |
+
latest_every: 5000
|
| 218 |
+
boundary_metrics:
|
| 219 |
+
enabled: true
|
| 220 |
+
boundary_width: 3
|
| 221 |
+
tolerance: 2
|
| 222 |
+
debug:
|
| 223 |
+
enabled: false
|
| 224 |
+
output_root: debug
|
| 225 |
+
ablation_trace: false
|
| 226 |
+
name: memory_debug
|
| 227 |
+
steps: 3
|
| 228 |
+
batch_size: 8
|
| 229 |
+
image_size: 256
|
| 230 |
+
use_amp: true
|
| 231 |
+
profile_torch_ops: true
|
| 232 |
+
profile_one_step_only: true
|
| 233 |
+
compare_modes:
|
| 234 |
+
- baseline_forward_only
|
| 235 |
+
- train_forward_loss_backward
|
| 236 |
+
- train_with_return_features_false
|
| 237 |
+
- train_with_return_features_true
|
| 238 |
+
- train_with_ema_disabled
|
| 239 |
+
- train_with_ema_enabled
|
| 240 |
+
- train_with_tta_disabled
|
| 241 |
+
- eval_no_grad
|
| 242 |
+
- eval_with_tta
|
| 243 |
+
- decoder_baseline
|
| 244 |
+
- decoder_refinement
|
| 245 |
+
- decoder_adaptive_rf
|
| 246 |
+
save_memory_summary: true
|
| 247 |
+
seed: 42
|
| 248 |
+
task: binary_cd
|
| 249 |
+
eval:
|
| 250 |
+
split: test
|
| 251 |
+
threshold: 0.5
|
| 252 |
+
threshold_sweep:
|
| 253 |
+
enabled: true
|
| 254 |
+
values:
|
| 255 |
+
- 0.3
|
| 256 |
+
- 0.35
|
| 257 |
+
- 0.4
|
| 258 |
+
- 0.45
|
| 259 |
+
- 0.5
|
| 260 |
+
- 0.55
|
| 261 |
+
- 0.6
|
| 262 |
+
threshold_select_metric: F1_1
|
| 263 |
+
use_ema: true
|
| 264 |
+
inference_mode: patch
|
| 265 |
+
crop_size: 256
|
| 266 |
+
overlap: 0.25
|
| 267 |
+
use_tta: false
|
| 268 |
+
save_predictions: false
|
| 269 |
+
save_visualizations: false
|
| 270 |
+
memory_efficient: true
|
| 271 |
+
log_mask_debug: true
|
| 272 |
+
save_debug_outputs: false
|
| 273 |
+
threshold_list:
|
| 274 |
+
- 0.3
|
| 275 |
+
- 0.35
|
| 276 |
+
- 0.4
|
| 277 |
+
- 0.45
|
| 278 |
+
- 0.5
|
| 279 |
+
- 0.55
|
| 280 |
+
- 0.6
|
| 281 |
+
tta_augmentations:
|
| 282 |
+
- original
|
| 283 |
+
- hflip
|
| 284 |
+
- vflip
|
| 285 |
+
- rot90
|
| 286 |
+
use_cached_predictions: false
|
| 287 |
+
post_training: {}
|
| 288 |
+
benchmark:
|
| 289 |
+
model_name: whu_full
|
| 290 |
+
output_dir: outputs/benchmark_runs/summary
|
| 291 |
+
datasets:
|
| 292 |
+
- DSIFN-CD
|
| 293 |
+
- WHU-CD
|
| 294 |
+
eval_split: test
|
| 295 |
+
main_dataset: WHU-CD
|
| 296 |
+
checkpoints: {}
|
| 297 |
+
_meta:
|
| 298 |
+
config_path: /storage2/ChangeDetection/MV/MambaRefine-CD/configs/experiments/whu_full.yaml
|
| 299 |
+
config_fingerprint: aeab042b9b84225a
|
requirements_hf.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
huggingface_hub>=0.20.0
|
scripts/example_download.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Download a released MambaRefine-CD checkpoint."""
|
| 3 |
+
|
| 4 |
+
from huggingface_hub import hf_hub_download
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
REPO_ID = "<HF_USERNAME_OR_ORG>/MambaRefine0cd"
|
| 8 |
+
FILENAME = "checkpoints/mambarefine_cd_whu_cd_best.pth"
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
if __name__ == "__main__":
|
| 12 |
+
print(hf_hub_download(repo_id=REPO_ID, filename=FILENAME))
|
scripts/example_inference.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Minimal paired-image inference example.
|
| 3 |
+
|
| 4 |
+
Run from the GitHub repository root after installing repository requirements.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import argparse
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
from PIL import Image
|
| 13 |
+
|
| 14 |
+
from src.engine.checkpoint import load_checkpoint
|
| 15 |
+
from src.engine.inference import predict_pair
|
| 16 |
+
from src.models.build import build_model
|
| 17 |
+
from src.utils.config import load_config
|
| 18 |
+
from src.utils.device import get_device
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def main() -> None:
|
| 22 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 23 |
+
parser.add_argument("--config", default="configs/active.yaml")
|
| 24 |
+
parser.add_argument("--checkpoint", required=True)
|
| 25 |
+
parser.add_argument("--image-a", required=True)
|
| 26 |
+
parser.add_argument("--image-b", required=True)
|
| 27 |
+
parser.add_argument("--output", default="prediction.png")
|
| 28 |
+
parser.add_argument("--threshold", type=float, default=None)
|
| 29 |
+
args = parser.parse_args()
|
| 30 |
+
|
| 31 |
+
cfg = load_config(args.config)
|
| 32 |
+
device = get_device(cfg)
|
| 33 |
+
model = build_model(cfg).to(device)
|
| 34 |
+
checkpoint = load_checkpoint(args.checkpoint, model)
|
| 35 |
+
threshold = args.threshold
|
| 36 |
+
if threshold is None:
|
| 37 |
+
threshold = float(checkpoint.get("best_threshold", cfg.eval.threshold))
|
| 38 |
+
model.eval()
|
| 39 |
+
pred = predict_pair(model, Path(args.image_a), Path(args.image_b), cfg, device, threshold)
|
| 40 |
+
Image.fromarray((pred.numpy() * 255).astype("uint8")).save(args.output)
|
| 41 |
+
print(f"Saved {args.output}")
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
if __name__ == "__main__":
|
| 45 |
+
main()
|