File size: 47,062 Bytes
0b43866
ce209f5
 
 
 
 
 
0b43866
ce209f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bac3e47
ce209f5
 
 
 
 
bac3e47
 
0b6122c
ce209f5
0b6122c
 
 
bac3e47
0b6122c
 
ce209f5
 
 
 
 
 
0b6122c
 
 
 
 
 
 
 
 
 
 
 
 
ce209f5
bac3e47
ce209f5
 
 
bac3e47
 
 
 
 
 
 
 
 
 
 
 
 
 
ce209f5
 
 
 
 
 
0b6122c
 
 
 
 
 
 
ce209f5
 
 
 
 
 
0b6122c
 
 
 
 
 
 
ce209f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0b6122c
ce209f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
---
license: other
library_name: pytorch
tags:
  - change-detection
  - remote-sensing
  - pytorch
---

# CD-Models: A Unified Change Detection Benchmark Suite

> **A multi-dataset, multi-model benchmark for binary remote sensing change detection.**  
> Covers 21 registered models spanning CNN, Transformer, and Mamba architectures, evaluated across the dataset configs in this repository with a shared training pipeline.

![Python](https://img.shields.io/badge/python-3.10%20recommended-blue)
![PyTorch](https://img.shields.io/badge/PyTorch-2.6.0%2Bcu124-ee4c2c)
![Models](https://img.shields.io/badge/models-21-0f766e)
![Datasets](https://img.shields.io/badge/datasets-8-7c3aed)
![License](https://img.shields.io/badge/license-see%20upstream-lightgrey)

## Overview

CD-Models is a benchmark harness for binary remote sensing change detection. It brings original research repositories and newly added model wrappers under one launcher, one dataset-config convention, one weight-management layer, and one result aggregation layout. The repository exists to make model comparisons reproducible across the same prepared dataset folders instead of relying on isolated, model-specific scripts. It also keeps the limits visible: result tables are populated only from `results/*/*/metrics_test.json`, and framework-specific models remain marked until their required stacks are installed.

## Supported Models

The model list below is taken from `configs/models/registry.yaml`, which is what `run_training.py` uses for `--model` choices.

| Model | Paper | Venue | Backbone | Params | Training Script | Status |
|-------|-------|-------|----------|--------|-----------------|--------|
| `bifa` | BiFA: Remote Sensing Image Change Detection with Bitemporal Feature Alignment | IEEE TGRS 2024 | MixTransformer | β€” | `train/train_bifa.py` | πŸ”„ In Progress |
| `bit_cd` | Remote Sensing Image Change Detection with Transformers | IEEE TGRS 2021 | ResNet-18 + base transformer | ~11M† | `train/train_bit_cd.py` | βœ… Working |
| `cdmamba` | CDMamba: Incorporating Local Clues into Mamba for Binary Change Detection | IEEE TGRS 2025 | Mamba | β€” | `train/train_cdmamba.py` | πŸ”„ In Progress |
| `cgnet` | Change Guiding Network | IEEE JSTARS 2023 | CGNet custom backbone | β€” | `train/train_cgnet.py` | βœ… Working |
| `change3d` | Change3D: Revisiting Change Detection and Captioning from a Video Modeling Perspective | CVPR 2025 Highlight | X3D-L | β€” | `train/train_change3d.py` | βœ… Working |
| `changeformer` | A Transformer-Based Siamese Network for Change Detection | IGARSS 2022 | MiT-b4 | ~41M† | `train/train_changeformer.py` | βœ… Working |
| `changemamba` | ChangeMamba: Remote Sensing Change Detection with Spatio-Temporal State Space Model | IEEE TGRS 2024 | VMamba | β€” | `train/train_changemamba.py` | ⚠️ Framework Required |
| `changer` | Changer: Feature Interaction is What You Need for Change Detection | IEEE TGRS / Open-CD | ResNet-18 | β€” | `train/train_changer.py` | ⚠️ Framework Required |
| `dsamnet` | Deeply-supervised Attention Metric-based Network | IEEE TGRS 2021 | ResNet | β€” | `train/train_dsamnet.py` | βœ… Working |
| `dsifn` | Deeply Supervised Image Fusion Network | ISPRS JPRS 2020 | VGG-16 | β€” | `train/train_dsifn.py` | πŸ”„ In Progress |
| `elgcnet` | ELGC-Net: Efficient Local-Global Context Aggregation | IEEE TGRS 2024 | ResNet-18 / ELGCA | β€” | `train/train_elgcnet.py` | βœ… Working |
| `fc_ef` | Fully Convolutional Early Fusion | ICIP 2018 | FCN | β€” | `train/train_fc_variants.py` | βœ… Working |
| `fc_siam_conc` | Fully Convolutional Siamese Concatenation | ICIP 2018 | Siamese FCN | β€” | `train/train_fc_variants.py` | βœ… Working |
| `fc_siam_diff` | Fully Convolutional Siamese Difference | ICIP 2018 | Siamese FCN | β€” | `train/train_fc_variants.py` | βœ… Working |
| `hanet` | HANet: Hierarchical Attention Network | IEEE JSTARS 2023 | HANet custom backbone | β€” | `train/train_hanet.py` | βœ… Working |
| `ifnet` | Deeply Supervised Image Fusion Network | ISPRS JPRS 2020 | VGG-16 | β€” | `train/train_ifnet.py` | πŸ”„ In Progress |
| `rsm_cd` | RS-Mamba for Large Remote Sensing Image Dense Prediction | arXiv 2024 | VMamba/RSM-CD tiny | β€” | `train/train_rsm_cd.py` | ❌ Failed |
| `schanger` | SChanger: Semantic Change and Spatial Consistency Perspective | IEEE JSTARS 2025 | SChanger-base | β€” | `train/train_schanger.py` | πŸ”„ In Progress |
| `siam_nestedunet` | SNUNet-CD / Siamese NestedUNet | IEEE GRSL 2021 | UNet++ | β€” | `train/train_siam_nestedunet.py` | πŸ”„ In Progress |
| `stanet` | Spatial-Temporal Attention Network | Remote Sensing 2020 | ResNet-18 + PAM | ~17M† | `train/train_stanet.py` | βœ… Working |
| `tinycd` | TinyCD: A Not So Deep Learning Model for Change Detection | Neural Computing and Applications 2023 | EfficientNet-B4 | β€” | `train/train_tinycd.py` | βœ… Working |

† Parameter counts are inherited from the previous project README or upstream publications, not measured by the current harness.

## Supported Datasets

Every dataset below is a real YAML file under `configs/datasets/`. The harness expands `${DATA_ROOT}` through `utils/config_loader.py`; if `${DATA_ROOT}` is unset, it first checks `/new-home/buddhiw/Datasets` and then the sibling `mamba-cd/datasets` fallback.

### LEVIR-CD+

| Property | Value |
|---|---|
| Task | Binary building change detection |
| Source | [LEVIR-CD project page](https://justchenhao.github.io/LEVIR/) |
| Train / Val / Test | Determined by files under `$DATA_ROOT/LEVIR-CD-plus-256/{train,val,test}` |
| Image size | 256 x 256 |
| Resolution | Original LEVIR-CD is 0.5 m/pixel; this config uses prepared 256 patches |
| Channels | RGB |
| Label convention | Thresholded binary mask; `Mask/` folder, changed pixels above `127` |
| Mean / Std (A) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Mean / Std (B) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Config | `configs/datasets/levir_cd.yaml` |
| Root pattern | `${DATA_ROOT}/LEVIR-CD-plus-256` |

### LEVIR-CD+ Test-as-Val

| Property | Value |
|---|---|
| Task | Binary building change detection with literature-style test-as-validation protocol |
| Source | [LEVIR-CD project page](https://justchenhao.github.io/LEVIR/) |
| Train / Val / Test | Determined by files under `$DATA_ROOT/LEVIR-CD-plus-256-test-as-val/{train,val,test}` |
| Image size | 256 x 256 |
| Channels | RGB |
| Label convention | Thresholded binary mask; `Mask/` folder, changed pixels above `127` |
| Mean / Std (A) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Mean / Std (B) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Config | `configs/datasets/levir_cd_test_as_val.yaml` |
| Root pattern | `${DATA_ROOT}/LEVIR-CD-plus-256-test-as-val` |

### WHU-CD

| Property | Value |
|---|---|
| Task | Binary building change detection |
| Source | [WHU building dataset page](https://study.rsgis.whu.edu.cn/pages/download/building_dataset.html) |
| Train / Val / Test | Determined by files under `$DATA_ROOT/WHU-CD/{train,val,test}` |
| Image size | 256 x 256 |
| Channels | RGB |
| Label convention | Thresholded binary mask; `OUT/` folder, changed pixels above `127` |
| Mean / Std (A) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Mean / Std (B) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Config | `configs/datasets/whu_cd.yaml` |
| Root pattern | `${DATA_ROOT}/WHU-CD` |

### DSIFN-CD

| Property | Value |
|---|---|
| Task | Binary high-resolution change detection |
| Source | [DSIFN dataset reference](https://github.com/GeoZcx/A-deeply-supervised-image-fusion-network-for-change-detection-in-remote-sensing-images/tree/master/dataset) |
| Train / Val / Test | Determined by files under `$DATA_ROOT/DSIFN-CD/DSIFN/{train,val,test}` |
| Image size | 256 x 256 |
| Channels | RGB |
| Label convention | `mask/` folder; raw masks may be `0/1`; generated model views convert to `0/255` where required |
| Mean / Std (A) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Mean / Std (B) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Config | `configs/datasets/dsifn_cd.yaml` |
| Root pattern | `${DATA_ROOT}/DSIFN-CD/DSIFN` |

### WildFire-S2

| Property | Value |
|---|---|
| Task | Binary burned-area change detection from bi-temporal Sentinel-2 style imagery |
| Source | Local project dataset card in sibling `WildFire-S2/` |
| Train / Val / Test | Determined by files under `$DATA_ROOT/WildFireS2/{train,val,test}` |
| Image size | 256 x 256 |
| Channels | RGB |
| Label convention | Thresholded binary mask; `label/` folder, changed pixels above `127` |
| Mean / Std (A) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Mean / Std (B) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Config | `configs/datasets/wildfire_s2.yaml` |
| Root pattern | `${DATA_ROOT}/WildFireS2` |

### SYSU-CD

| Property | Value |
|---|---|
| Task | Binary change detection |
| Source | [SYSU-CD project page](https://github.com/liumency/SYSU-CD) |
| Train / Val / Test | Determined by files under `$DATA_ROOT/SYSU-CD-folders/{train,val,test}` |
| Image size | 256 x 256 |
| Channels | RGB |
| Label convention | Thresholded binary mask; `Mask/` folder, changed pixels above `127` |
| Mean / Std (A) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Mean / Std (B) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Config | `configs/datasets/sysu_cd.yaml` |
| Root pattern | `${DATA_ROOT}/SYSU-CD-folders` |

### KATE-CD-256

| Property | Value |
|---|---|
| Task | Binary change detection |
| Source | Local prepared dataset config |
| Train / Val / Test | Determined by files under `$DATA_ROOT/KATE-CD-256/{train,val,test}` |
| Image size | 256 x 256 |
| Channels | RGB |
| Label convention | Thresholded binary mask; `label/` folder, changed pixels above `127` |
| Mean / Std (A) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Mean / Std (B) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Config | `configs/datasets/kate_cd.yaml` |
| Root pattern | `${DATA_ROOT}/KATE-CD-256` |

### Custom-CD

| Property | Value |
|---|---|
| Task | User-supplied binary change detection |
| Source | Local template config |
| Train / Val / Test | Determined by files under `$DATA_ROOT/Custom-CD/{train,val,test}` |
| Image size | 256 x 256 |
| Channels | RGB |
| Label convention | Thresholded binary mask; `Mask/` folder, changed pixels above `127` |
| Mean / Std (A) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Mean / Std (B) | `[0.485, 0.456, 0.406]` / `[0.229, 0.224, 0.225]` |
| Config | `configs/datasets/custom_cd.yaml` |
| Root pattern | `${DATA_ROOT}/Custom-CD` |

## Results and released checkpoints

Only completed `metrics_test.json` evaluations are eligible for rankings. Rankings are computed per dataset by test-set F1 (descending), and the canonical `best_model.pth` checkpoint for every ranked model is released.

All accuracy values are fractions. GPU memory is the PyTorch peak reserved memory for inference, with peak allocated memory used only when reserved memory is absent. FPS is model-only throughput. A dash means the evaluator did not record that metric; values are never estimated.

The current evaluator records BF1 but not boundary mean IoU (BmIoU), so BmIoU remains explicitly unavailable rather than being inferred from BF1. Boundary IoU and boundary F1 are distinct measures.

The LEVIR-CD+ comparison combines the project-compatible `levir_cd_test_as_val` and `levir_val_as_test` result records. The ChangeMamba row uses the completed `levir_val_as_test` evaluation over 5,568 samples.

### Dataset summary

| Dataset | Tested models | F1 leader | Best test F1 |
| --- | --- | --- | --- |
| DSIFN-CD | 14 | BIT-CD | 0.6732 |
| LEVIR-CD+ comparison | 14 | ChangeMamba | 0.8753 |
| SYSU-CD | 8 | ChangeMamba | 0.8216 |
| WHU-CD | 8 | ChangeMamba | 0.9521 |

### DSIFN-CD

| Rank | Model | F1 | mIoU | Overall accuracy | Recall | Precision | BF1 | BmIoU | GFLOPs | GPU (GB) | FPS | Parameters (M) | Checkpoint |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | BIT-CD | 0.6732 | 0.6929 | 0.8919 | 0.6552 | 0.6923 | 0.2819 | β€” | 10.63 | 2.24 | 127.76 | 12.40 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/bit_cd/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 2 | SChanger | 0.6629 | 0.6835 | 0.8857 | 0.6612 | 0.6647 | 0.2847 | β€” | β€” | 2.45 | 24.05 | β€” | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/schanger/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 3 | ChangeMamba | 0.6435 | 0.6729 | 0.8849 | 0.6113 | 0.6792 | 0.1903 | β€” | 28.70 | 1.93 | 15.42 | 54.00 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/changemamba/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 4 | CGNet | 0.6204 | 0.6290 | 0.8343 | 0.7970 | 0.5079 | 0.2903 | β€” | 82.23 | 6.52 | 65.39 | 38.99 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/cgnet/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 5 | FC-EF | 0.6078 | 0.6400 | 0.8604 | 0.6365 | 0.5816 | 0.1955 | β€” | 3.58 | 0.74 | 204.13 | 1.35 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_ef/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 6 | ChangeFormer | 0.5964 | 0.6152 | 0.8299 | 0.7397 | 0.4996 | 0.2422 | β€” | 21.18 | 4.07 | 49.74 | 29.75 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/changeformer/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 7 | BiFA | 0.5876 | 0.6111 | 0.8296 | 0.7142 | 0.4991 | 0.2692 | β€” | 53.00 | 15.10 | 13.81 | 9.87 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/bifa/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 8 | Siam-NestedUNet | 0.5839 | 0.6024 | 0.8188 | 0.7482 | 0.4788 | 0.2374 | β€” | 54.83 | 7.34 | 29.18 | 12.03 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/siam_nestedunet/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 9 | FC-Siam-diff | 0.5829 | 0.6277 | 0.8593 | 0.5784 | 0.5875 | 0.1691 | β€” | 4.73 | 1.06 | 113.98 | 1.35 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_siam_diff/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 10 | STANet | 0.5483 | 0.6258 | 0.8829 | 0.4184 | 0.7953 | 0.1613 | β€” | 13.16 | 14.11 | 133.96 | 16.93 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/stanet/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 11 | FC-Siam-conc | 0.5479 | 0.5665 | 0.7873 | 0.7583 | 0.4288 | 0.1811 | β€” | 5.33 | 1.02 | 127.67 | 1.55 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_siam_conc/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 12 | DSAMNet | 0.5467 | 0.5757 | 0.8020 | 0.7027 | 0.4474 | 0.2374 | β€” | 75.39 | 2.91 | 166.43 | 16.95 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/dsamnet/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 13 | HANet | 0.5347 | 0.5817 | 0.8193 | 0.6109 | 0.4754 | 0.2418 | β€” | 17.67 | 11.36 | 42.36 | 3.03 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/hanet/dsifn_cd/checkpoints/best_model.pth?download=true) |
| 14 | IFNet | 0.4579 | 0.5102 | 0.7524 | 0.6153 | 0.3647 | 0.1325 | β€” | 82.26 | 6.08 | 104.88 | 50.71 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/ifnet/dsifn_cd/checkpoints/best_model.pth?download=true) |

### LEVIR-CD+ comparison

| Rank | Model | F1 | mIoU | Overall accuracy | Recall | Precision | BF1 | BmIoU | GFLOPs | GPU (GB) | FPS | Parameters (M) | Checkpoint |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | ChangeMamba | 0.8753 | 0.8840 | 0.9901 | 0.8572 | 0.8942 | 0.8307 | β€” | 28.70 | 1.93 | 76.82 | 54.00 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/changemamba/levir_val_as_test/checkpoints/best_model.pth?download=true) |
| 2 | CGNet | 0.8138 | 0.8356 | 0.9856 | 0.7746 | 0.8572 | 0.7651 | β€” | 82.23 | 6.01 | 44.01 | 38.99 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/cgnet/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 3 | Siam-NestedUNet | 0.8046 | 0.8282 | 0.9839 | 0.8129 | 0.7965 | 0.7386 | β€” | β€” | 2.67 | 108.71 | β€” | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/siam_nestedunet/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 4 | SChanger | 0.8007 | 0.8253 | 0.9836 | 0.8112 | 0.7906 | 0.7364 | β€” | β€” | 2.45 | 48.96 | β€” | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/schanger/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 5 | BIT-CD | 0.7996 | 0.8247 | 0.9838 | 0.7946 | 0.8047 | 0.7143 | β€” | 10.63 | 2.27 | 236.60 | 12.40 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/bit_cd/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 6 | HANet | 0.7841 | 0.8131 | 0.9819 | 0.8064 | 0.7630 | 0.7043 | β€” | β€” | 5.04 | 84.44 | β€” | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/hanet/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 7 | BiFA | 0.7772 | 0.8084 | 0.9818 | 0.7785 | 0.7760 | 0.6581 | β€” | 53.00 | 15.14 | 30.38 | 9.87 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/bifa/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 8 | FC-Siam-conc | 0.7650 | 0.7999 | 0.9809 | 0.7623 | 0.7678 | 0.7175 | β€” | 5.33 | 1.02 | 308.81 | 1.55 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_siam_conc/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 9 | STANet | 0.7544 | 0.7921 | 0.9791 | 0.7865 | 0.7249 | 0.6388 | β€” | β€” | 4.45 | 174.00 | β€” | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/stanet/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 10 | ChangeFormer | 0.7488 | 0.7887 | 0.9795 | 0.7505 | 0.7472 | 0.6525 | β€” | 21.18 | 4.03 | 157.64 | 29.75 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/changeformer/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 11 | DSAMNet | 0.7444 | 0.7850 | 0.9779 | 0.7897 | 0.7040 | 0.5370 | β€” | 75.39 | 2.90 | 37.84 | 16.95 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/dsamnet/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 12 | IFNet | 0.7410 | 0.7833 | 0.9786 | 0.7510 | 0.7313 | 0.3489 | β€” | 82.26 | 6.08 | 105.44 | 50.71 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/ifnet/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 13 | FC-EF | 0.7319 | 0.7766 | 0.9768 | 0.7785 | 0.6905 | 0.6497 | β€” | 3.58 | 0.74 | 457.44 | 1.35 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_ef/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |
| 14 | FC-Siam-diff | 0.7196 | 0.7667 | 0.9725 | 0.8650 | 0.6160 | 0.5447 | β€” | 4.73 | 1.06 | 262.80 | 1.35 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_siam_diff/levir_cd_test_as_val/checkpoints/best_model.pth?download=true) |

### SYSU-CD

| Rank | Model | F1 | mIoU | Overall accuracy | Recall | Precision | BF1 | BmIoU | GFLOPs | GPU (GB) | FPS | Parameters (M) | Checkpoint |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | ChangeMamba | 0.8216 | 0.8006 | 0.9214 | 0.7677 | 0.8836 | 0.3197 | β€” | 28.70 | 1.93 | 77.65 | 54.00 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/changemamba/sysu_cd/checkpoints/best_model.pth?download=true) |
| 2 | FC-Siam-conc | 0.7778 | 0.7558 | 0.8975 | 0.7609 | 0.7955 | 0.1939 | β€” | 5.33 | 1.02 | 356.94 | 1.55 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_siam_conc/sysu_cd/checkpoints/best_model.pth?download=true) |
| 3 | STANet | 0.7728 | 0.7482 | 0.8913 | 0.7841 | 0.7619 | 0.1962 | β€” | β€” | 4.45 | 176.02 | β€” | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/stanet/sysu_cd/checkpoints/best_model.pth?download=true) |
| 4 | FC-EF | 0.7710 | 0.7489 | 0.8936 | 0.7596 | 0.7828 | 0.1857 | β€” | 3.58 | 0.73 | 553.75 | 1.35 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_ef/sysu_cd/checkpoints/best_model.pth?download=true) |
| 5 | ChangeFormer | 0.7635 | 0.7382 | 0.8851 | 0.7863 | 0.7420 | 0.1591 | β€” | 21.18 | 4.03 | 143.73 | 29.75 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/changeformer/sysu_cd/checkpoints/best_model.pth?download=true) |
| 6 | FC-Siam-diff | 0.7630 | 0.7457 | 0.8956 | 0.7129 | 0.8208 | 0.1853 | β€” | 4.73 | 1.08 | 552.90 | 1.35 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_siam_diff/sysu_cd/checkpoints/best_model.pth?download=true) |
| 7 | BIT-CD | 0.7618 | 0.7395 | 0.8881 | 0.7584 | 0.7652 | 0.1780 | β€” | 10.63 | 2.24 | 111.11 | 12.40 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/bit_cd/sysu_cd/checkpoints/best_model.pth?download=true) |
| 8 | IFNet | 0.7145 | 0.7020 | 0.8724 | 0.6772 | 0.7562 | 0.1158 | β€” | β€” | 3.29 | 109.80 | β€” | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/ifnet/sysu_cd/checkpoints/best_model.pth?download=true) |

### WHU-CD

| Rank | Model | F1 | mIoU | Overall accuracy | Recall | Precision | BF1 | BmIoU | GFLOPs | GPU (GB) | FPS | Parameters (M) | Checkpoint |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | ChangeMamba | 0.9521 | 0.9519 | 0.9954 | 0.9401 | 0.9644 | 0.8605 | β€” | 28.70 | 1.93 | 75.28 | 54.00 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/changemamba/whu_cd/checkpoints/best_model.pth?download=true) |
| 2 | CGNet | 0.9331 | 0.9340 | 0.9936 | 0.9299 | 0.9364 | 0.8138 | β€” | 82.23 | 5.62 | 129.54 | 38.99 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/cgnet/whu_cd/checkpoints/best_model.pth?download=true) |
| 3 | BIT-CD | 0.8940 | 0.8989 | 0.9899 | 0.8845 | 0.9037 | 0.6879 | β€” | 10.63 | 2.24 | 46.28 | 12.40 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/bit_cd/whu_cd/checkpoints/best_model.pth?download=true) |
| 4 | DSAMNet | 0.8905 | 0.8956 | 0.9891 | 0.9167 | 0.8657 | 0.5855 | β€” | 75.39 | 2.90 | 116.58 | 16.95 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/dsamnet/whu_cd/checkpoints/best_model.pth?download=true) |
| 5 | IFNet | 0.8389 | 0.8534 | 0.9849 | 0.8147 | 0.8644 | 0.3245 | β€” | 82.26 | 6.08 | 104.98 | 50.71 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/ifnet/whu_cd/checkpoints/best_model.pth?download=true) |
| 6 | FC-EF | 0.8385 | 0.8531 | 0.9850 | 0.8067 | 0.8729 | 0.5818 | β€” | 3.58 | 0.74 | 498.55 | 1.35 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_ef/whu_cd/checkpoints/best_model.pth?download=true) |
| 7 | FC-Siam-conc | 0.7789 | 0.8062 | 0.9756 | 0.8907 | 0.6920 | 0.4733 | β€” | 5.33 | 1.03 | 397.86 | 1.55 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_siam_conc/whu_cd/checkpoints/best_model.pth?download=true) |
| 8 | FC-Siam-diff | 0.7135 | 0.7580 | 0.9631 | 0.9540 | 0.5699 | 0.2148 | β€” | 4.73 | 1.09 | 567.87 | 1.35 | [Download](https://huggingface.co/dineth18/CD-Models/resolve/main/results/fc_siam_diff/whu_cd/checkpoints/best_model.pth?download=true) |

### Datasets without a released checkpoint

WildFire-S2, KATE-CD-256, the standard LEVIR-CD+ configuration, and Custom-CD currently have no eligible completed test result. Their validation-only or incomplete checkpoints are intentionally not uploaded.


## Installation

### 1. Clone this repository

```bash
git clone https://github.com/<your-username>/CD-Models.git
cd CD-Models
```

### 2. Create and activate environment

```bash
conda create -n cd-models python=3.10 -y
conda activate cd-models
```

### 3. Install PyTorch (CUDA 12.4)

```bash
pip install torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu124
```

Adjust the CUDA version for your system. See [PyTorch Get Started](https://pytorch.org/get-started/locally/).

### 4. Run automatic setup

```bash
python setup.py
```

This single command:

- Checks all required Python packages.
- Auto-installs safe pure-Python/common packages when missing.
- Clones confirmed model repositories into `model_repos/`.
- Downloads or warms pretrained backbone weights.
- Generates dataset list files for datasets already present on disk.
- Prints a full status report.

### 5. ChangeMamba / Changer MMSeg stack

These two models require OpenMMLab packages that should be installed after PyTorch:

```bash
pip install mmengine==0.10.1
pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu124/torch2.6/index.html
pip install mmsegmentation==1.2.2 mmdet==3.3.0 mmpretrain==1.2.0
```

### 6. Set your dataset root

```bash
export DATA_ROOT=/path/to/your/datasets
```

Add the export to `~/.bashrc` or your scheduler job script if you want it to persist.

## Dataset Preparation

All datasets follow the same high-level split structure: `train/`, `val/`, and `test/`, each with a pre-change image folder, a post-change image folder, and a mask folder. Folder names differ by dataset and are encoded in YAML.

### LEVIR-CD+

**Download:** [Official LEVIR page](https://justchenhao.github.io/LEVIR/)

Expected structure:

```text
$DATA_ROOT/LEVIR-CD-plus-256/
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── Mask/
β”œβ”€β”€ val/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── Mask/
└── test/
    β”œβ”€β”€ A/
    β”œβ”€β”€ B/
    └── Mask/
```

Prepare list files:

```bash
python setup.py --dataset levir_cd
```

Config: `configs/datasets/levir_cd.yaml`

### LEVIR-CD+ Test-as-Val

**Download:** Use the same source data as LEVIR-CD+ and prepare the test-as-validation split protocol locally.

Expected structure:

```text
$DATA_ROOT/LEVIR-CD-plus-256-test-as-val/
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── Mask/
β”œβ”€β”€ val/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── Mask/
└── test/
    β”œβ”€β”€ A/
    β”œβ”€β”€ B/
    └── Mask/
```

Prepare list files:

```bash
python setup.py --dataset levir_cd_test_as_val
```

Config: `configs/datasets/levir_cd_test_as_val.yaml`

### WHU-CD

**Download:** [WHU building dataset page](https://study.rsgis.whu.edu.cn/pages/download/building_dataset.html)

Expected structure:

```text
$DATA_ROOT/WHU-CD/
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── OUT/
β”œβ”€β”€ val/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── OUT/
└── test/
    β”œβ”€β”€ A/
    β”œβ”€β”€ B/
    └── OUT/
```

Prepare list files:

```bash
python setup.py --dataset whu_cd
```

Config: `configs/datasets/whu_cd.yaml`

### DSIFN-CD

**Download:** [DSIFN dataset reference](https://github.com/GeoZcx/A-deeply-supervised-image-fusion-network-for-change-detection-in-remote-sensing-images/tree/master/dataset)

Expected structure:

```text
$DATA_ROOT/DSIFN-CD/DSIFN/
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ t1/
β”‚   β”œβ”€β”€ t2/
β”‚   └── mask/
β”œβ”€β”€ val/
β”‚   β”œβ”€β”€ t1/
β”‚   β”œβ”€β”€ t2/
β”‚   └── mask/
└── test/
    β”œβ”€β”€ t1/
    β”œβ”€β”€ t2/
    └── mask/
```

Prepare list files:

```bash
python setup.py --dataset dsifn_cd
```

Config: `configs/datasets/dsifn_cd.yaml`

Important DSIFN note: some masks are encoded as `0/1`. The generated compatibility views convert those masks to exact `0/255` PNG data for loaders that use `ToTensor()` and then cast labels to integer classes.

### WildFire-S2

**Download:** Local sibling dataset project, documented in `../WildFire-S2/DATASET_CARD.md`.

Expected structure:

```text
$DATA_ROOT/WildFireS2/
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── label/
β”œβ”€β”€ val/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── label/
└── test/
    β”œβ”€β”€ A/
    β”œβ”€β”€ B/
    └── label/
```

Prepare list files:

```bash
python setup.py --dataset wildfire_s2
```

Config: `configs/datasets/wildfire_s2.yaml`

### SYSU-CD

**Download:** [SYSU-CD repository](https://github.com/liumency/SYSU-CD)

Expected structure:

```text
$DATA_ROOT/SYSU-CD-folders/
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── Mask/
β”œβ”€β”€ val/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── Mask/
└── test/
    β”œβ”€β”€ A/
    β”œβ”€β”€ B/
    └── Mask/
```

Prepare list files:

```bash
python setup.py --dataset sysu_cd
```

Config: `configs/datasets/sysu_cd.yaml`

### KATE-CD-256

**Download:** Local prepared dataset; no official source URL was found in the audited repo files.

Expected structure:

```text
$DATA_ROOT/KATE-CD-256/
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── label/
β”œβ”€β”€ val/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── label/
└── test/
    β”œβ”€β”€ A/
    β”œβ”€β”€ B/
    └── label/
```

Prepare list files:

```bash
python setup.py --dataset kate_cd
```

Config: `configs/datasets/kate_cd.yaml`

### Custom-CD

**Download:** User supplied.

Expected structure:

```text
$DATA_ROOT/Custom-CD/
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── Mask/
β”œβ”€β”€ val/
β”‚   β”œβ”€β”€ A/
β”‚   β”œβ”€β”€ B/
β”‚   └── Mask/
└── test/
    β”œβ”€β”€ A/
    β”œβ”€β”€ B/
    └── Mask/
```

Prepare list files:

```bash
python setup.py --dataset custom_cd
```

Config: `configs/datasets/custom_cd.yaml`

## Training

All registered models share the same outer interface through `run_training.py`.

### Train a single model on a single dataset

```bash
python run_training.py --model bifa --dataset levir_cd
```

### Train a single model on all datasets

```bash
python run_training.py --model changemamba --dataset all
```

### Train all models on a single dataset

```bash
python run_training.py --model all --dataset levir_cd
```

### Full benchmark sweep

```bash
python run_training.py --model all --dataset all
```

Already-completed runs are skipped when `results/{model}/{dataset}/metrics_test.json` exists. To retry anyway:

```bash
python run_training.py --model bifa --dataset levir_cd --force
```

Resume interrupted training:

```bash
python run_training.py --model bifa --dataset levir_cd --resume
```

Run command-construction checks without training:

```bash
python run_training.py --model all --dataset dsifn_cd --dry-run
```

Run a single wrapper smoke test:

```bash
python train/train_bifa.py --dataset levir_cd --smoke-test
```

### Available models

Original and legacy integrated models:

```text
bifa
bit_cd
cdmamba
change3d
changeformer
dsifn
ifnet
rsm_cd
schanger
siam_nestedunet
stanet
```

Newly added external or direct adapters:

```text
fc_ef
fc_siam_conc
fc_siam_diff
changemamba
elgcnet
changer
hanet
cgnet
dsamnet
tinycd
```

Available datasets:

```text
custom_cd
dsifn_cd
kate_cd
levir_cd
levir_cd_test_as_val
sysu_cd
whu_cd
wildfire_s2
```

### Training outputs

Each completed run is expected to save under:

```text
results/
└── bifa/
    └── levir_cd/
        β”œβ”€β”€ checkpoints/
        β”‚   β”œβ”€β”€ best_model.pth
        β”‚   └── latest.pth
        β”œβ”€β”€ logs/
        β”‚   β”œβ”€β”€ train_stdout.log
        β”‚   β”œβ”€β”€ train_stderr.log
        β”‚   β”œβ”€β”€ eval_stdout.log
        β”‚   └── eval_stderr.log
        β”œβ”€β”€ predictions/
        β”‚   β”œβ”€β”€ test/
        β”‚   └── test_prob/
        β”œβ”€β”€ visuals/
        β”‚   └── selected_20/
        β”œβ”€β”€ metrics_val.json
        └── metrics_test.json
```

The master launcher appends run status to `results/training_log.jsonl`. After every run attempt, `utils.results_writer.append_to_comparison_table()` regenerates `results/comparison_table.csv`.

For qualitative comparison, the evaluator writes one deterministic sample manifest per dataset:

```text
results/qualitative_samples/<dataset>/sample_manifest.json
```

The same selected test samples are then reused for every model on that dataset. Binary predictions use exact `0` and `255` PNG values.

### Dataset-specific notes

| Model | Dataset | Note |
|---|---|---|
| `tinycd` | `wildfire_s2` | Skipped automatically by `run_training.py`; current exclusion is explicit in `DATASET_EXCLUSIONS`. |
| `changemamba` | all | Requires VMamba weights and the MMSeg/OpenMMLab stack. |
| `changer` | all | Runs through Open-CD and requires the MMSeg/OpenMMLab stack. |
| `dsifn` / `ifnet` | `dsifn_cd` | Uses VGG-16 family loaders; DSIFN masks need careful binary scaling. |
| `rsm_cd` | all | Marked unresolved because the upstream training path has prior initialization/runtime issues. |

## Evaluation

### Evaluate a trained checkpoint

```bash
python evaluate.py --model bifa --dataset levir_cd
```

The central evaluator uses `utils/model_adapters.py` for verified in-process PyTorch model construction, checkpoint loading, forward calls, and output normalization. Current smoke-tested adapters are:

```text
bit_cd
cgnet
changeformer
dsamnet
elgcnet
fc_ef
fc_siam_conc
fc_siam_diff
hanet
siam_nestedunet
stanet
tinycd
```

For these adapters, evaluation loads `checkpoints/best_model.pth`, computes split-level metrics, saves all test predictions, writes selected qualitative panels, records timing/profiling fields, writes `metrics_test.json`, and regenerates the aggregate comparison table.

For remaining subprocess/upstream wrappers, central evaluation fails explicitly until a real architecture construction and checkpoint-loading adapter is added. It does not evaluate dummy models, random initialized models, or guessed output formats.

### Explicit checkpoint path

```bash
python evaluate.py --model bifa --dataset levir_cd --checkpoint results/bifa/levir_cd/checkpoints/best_model.pth
```

### Regenerate comparison table

```bash
python evaluate.py --model all --dataset all --dry-run
```

### Metrics computed

For binary change detection, metrics are intended for the positive changed class.

| Metric | Description |
|--------|-------------|
| F1 | Harmonic mean of precision and recall |
| IoU | Intersection over Union / Jaccard index |
| mIoU | Mean IoU over unchanged/background and changed classes |
| OA | Overall accuracy across both classes |
| Precision | `TP / (TP + FP)` |
| Recall | `TP / (TP + FN)` |
| Kappa | Cohen's kappa coefficient |
| BF1 | Boundary F1 with configurable tolerance, default 2 pixels |
| TP / FP / TN / FN | Accumulated confusion counts over the full split |

The implementation lives in `utils/metrics.py`. The evaluator also records measured parameter counts, FLOPs when `thop` or `fvcore` is installed, FPS, PyTorch peak GPU memory, and NVML GPU utilization when `pynvml` is installed. Missing profiler dependencies are recorded with explicit error fields; values are not guessed.

`metrics_test.json` includes the model, dataset, split, checkpoint path, threshold, confusion counts, F1, IoU, mIoU, precision, recall, OA, kappa, BF1, parameter counts, FLOPs fields, FPS fields, GPU profiling fields, test sample count, prediction and visual directories, timestamp, and status.

## Pre-trained Weights

Backbone weights are downloaded or cache-warmed by `python setup.py` and by `utils/weight_downloader.py`.

### Backbone weights

| Model(s) | Backbone | Source | Auto-Downloaded | Size |
|----------|----------|--------|-----------------|------|
| ChangeMamba-T | VMamba-Tiny | [Zenodo 14037770](https://zenodo.org/records/14037770) | yes | ~86 MB |
| ChangeMamba-S | VMamba-Small | [Zenodo 14037770](https://zenodo.org/records/14037770) | yes | ~178 MB |
| ChangeMamba-B | VMamba-Base | [Zenodo 14037770](https://zenodo.org/records/14037770) | yes | ~391 MB |
| TinyCD | EfficientNet-B4 | timm | yes | ~75 MB |
| ChangeFormer, ELGC-Net | MiT variants | timm | yes | 15-82 MB |
| BIT_CD, STANet, Changer | ResNet-18 | torchvision | yes | ~45 MB |
| DSAMNet, HANet, CGNet | ResNet-50 / ResNet family | torchvision | yes | ~98 MB |
| DSIFN / IFNet | VGG-16 | torchvision | yes | ~528 MB |

Pre-download all managed weights:

```bash
python utils/weight_downloader.py --prefetch-all
```

List managed VMamba weights:

```bash
python utils/weight_downloader.py --list
```

### Trained checkpoints

All completed test-run checkpoints and direct download links are listed in [Results and released checkpoints](#results-and-released-checkpoints). Local training still writes checkpoints under `results/{model}/{dataset}/checkpoints/`.

## Repository Structure

```text
CD-Models/
β”œβ”€β”€ configs/
β”‚   β”œβ”€β”€ datasets/                  # one YAML per dataset
β”‚   β”‚   β”œβ”€β”€ custom_cd.yaml
β”‚   β”‚   β”œβ”€β”€ dsifn_cd.yaml
β”‚   β”‚   β”œβ”€β”€ kate_cd.yaml
β”‚   β”‚   β”œβ”€β”€ levir_cd.yaml
β”‚   β”‚   β”œβ”€β”€ levir_cd_test_as_val.yaml
β”‚   β”‚   β”œβ”€β”€ sysu_cd.yaml
β”‚   β”‚   β”œβ”€β”€ whu_cd.yaml
β”‚   β”‚   └── wildfire_s2.yaml
β”‚   └── models/                    # model hyperparameters and registry
β”‚       β”œβ”€β”€ bifa.yaml
β”‚       β”œβ”€β”€ bit_cd.yaml
β”‚       β”œβ”€β”€ cdmamba.yaml
β”‚       β”œβ”€β”€ cgnet.yaml
β”‚       β”œβ”€β”€ change3d.yaml
β”‚       β”œβ”€β”€ changeformer.yaml
β”‚       β”œβ”€β”€ changemamba.yaml
β”‚       β”œβ”€β”€ changer.yaml
β”‚       β”œβ”€β”€ dsamnet.yaml
β”‚       β”œβ”€β”€ dsifn.yaml
β”‚       β”œβ”€β”€ elgcnet.yaml
β”‚       β”œβ”€β”€ fc_ef.yaml
β”‚       β”œβ”€β”€ fc_siam_conc.yaml
β”‚       β”œβ”€β”€ fc_siam_diff.yaml
β”‚       β”œβ”€β”€ hanet.yaml
β”‚       β”œβ”€β”€ ifnet.yaml
β”‚       β”œβ”€β”€ registry.yaml
β”‚       β”œβ”€β”€ rsm_cd.yaml
β”‚       β”œβ”€β”€ schanger.yaml
β”‚       β”œβ”€β”€ siam_nestedunet.yaml
β”‚       β”œβ”€β”€ stanet.yaml
β”‚       └── tinycd.yaml
β”œβ”€β”€ datasets/
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── cd_dataset.py              # shared dataset validation/loader
β”œβ”€β”€ train/
β”‚   β”œβ”€β”€ fc_adapter.py              # direct FC-EF / FC-Siam trainer
β”‚   β”œβ”€β”€ train_bifa.py
β”‚   β”œβ”€β”€ train_bit_cd.py
β”‚   β”œβ”€β”€ train_cdmamba.py
β”‚   β”œβ”€β”€ train_cgnet.py
β”‚   β”œβ”€β”€ train_change3d.py
β”‚   β”œβ”€β”€ train_changeformer.py
β”‚   β”œβ”€β”€ train_changemamba.py
β”‚   β”œβ”€β”€ train_changer.py
β”‚   β”œβ”€β”€ train_dsamnet.py
β”‚   β”œβ”€β”€ train_dsifn.py
β”‚   β”œβ”€β”€ train_elgcnet.py
β”‚   β”œβ”€β”€ train_fc_variants.py
β”‚   β”œβ”€β”€ train_hanet.py
β”‚   β”œβ”€β”€ train_ifnet.py
β”‚   β”œβ”€β”€ train_rsm_cd.py
β”‚   β”œβ”€β”€ train_schanger.py
β”‚   β”œβ”€β”€ train_siam_nestedunet.py
β”‚   β”œβ”€β”€ train_stanet.py
β”‚   β”œβ”€β”€ train_tinycd.py
β”‚   └── wrapper_common.py           # shared wrapper logic and generated views
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ config.py                   # generic YAML/JSON loading and merge helpers
β”‚   β”œβ”€β”€ config_loader.py            # dataset/model config expansion and validation
β”‚   β”œβ”€β”€ dataset_list_generator.py   # create list/train.txt, list/val.txt, list/test.txt
β”‚   β”œβ”€β”€ env_checker.py              # import checks for required packages
β”‚   β”œβ”€β”€ legacy_config_writer.py     # generated JSON/list views for legacy trainers
β”‚   β”œβ”€β”€ metrics.py                  # binary CD metrics
β”‚   β”œβ”€β”€ results.py                  # JSON/CSV helpers
β”‚   β”œβ”€β”€ results_writer.py           # metrics_test.json and comparison CSV writer
β”‚   └── weight_downloader.py        # Zenodo, timm, torchvision weight management
β”œβ”€β”€ model_repos/                    # cloned external repositories
β”‚   β”œβ”€β”€ CGNet-CD/
β”‚   β”œβ”€β”€ ChangeMamba/
β”‚   β”œβ”€β”€ DSAMNet/
β”‚   β”œβ”€β”€ HANet-CD/
β”‚   β”œβ”€β”€ TinyCD/
β”‚   β”œβ”€β”€ Tiny_model_4_CD/
β”‚   β”œβ”€β”€ elgcnet/
β”‚   β”œβ”€β”€ fully_convolutional_change_detection/
β”‚   └── open-cd/
β”œβ”€β”€ results/
β”‚   β”œβ”€β”€ comparison_table.csv
β”‚   β”œβ”€β”€ download_log.jsonl
β”‚   └── training_log.jsonl
β”œβ”€β”€ generated_configs/              # generated model-specific config files
β”œβ”€β”€ generated_dataset_views/        # generated compatibility views for upstream repos
β”œβ”€β”€ BIT_CD/                         # original model repository copy
β”œβ”€β”€ BiFA/
β”œβ”€β”€ CDMamba/
β”œβ”€β”€ Change3D/
β”œβ”€β”€ ChangeFormer/
β”œβ”€β”€ IFNet/
β”œβ”€β”€ RSM-CD/
β”œβ”€β”€ SChanger/
β”œβ”€β”€ Siam-NestedUNet/
β”œβ”€β”€ STANet/
β”œβ”€β”€ evaluate.py
β”œβ”€β”€ run_training.py
β”œβ”€β”€ setup.py
└── TRAINING_GUIDE.md
```

## Known Issues

| Model | Issue | Status | Workaround |
|-------|-------|--------|------------|
| `rsm_cd` | Upstream RS-Mamba training path has prior initialization/runtime issues. | ❌ Unresolved | Run explicitly only after auditing the upstream environment; skip in broad sweeps if needed. |
| `changemamba` | Requires VMamba kernels and OpenMMLab stack. | ⚠️ Separate install needed | Install MMSeg stack in Installation section and run `setup.py` for VMamba weights. |
| `changer` | Requires Open-CD / mmengine / mmcv / mmsegmentation. | ⚠️ Separate install needed | Install MMSeg stack in Installation section. |
| `tinycd` | RGB-only model path; explicitly excluded for `wildfire_s2`. | ⚠️ By design | Use RGB datasets or edit dataset config only when the data is actually RGB. |
| `evaluate.py` | Central checkpoint loading is adapter-based and currently smoke-tested for `bit_cd`, `cgnet`, `changeformer`, `dsamnet`, `elgcnet`, FC variants, `hanet`, `siam_nestedunet`, `stanet`, and `tinycd`. Remaining custom/OpenMMLab models still need verified adapters. | πŸ”„ In Progress | Add a real in-process model construction/checkpoint adapter or call a verified upstream evaluator and convert its outputs. |
| `dsifn_cd` masks | Raw DSIFN masks may be `0/1`, which some upstream loaders can scale to all zeros. | βœ… Fixed in generated views | Regenerate views by launching training or running dataset preparation. |
| `SChanger` repo URL | Official clone URL was not confirmed from audited files. | πŸ”„ In Progress | `setup.py` skips automatic clone for this entry and prints a warning. |
| root license | No root `LICENSE` file was found during audit. | πŸ”„ Documentation gap | Check upstream model licenses before redistribution. |

## Adding a New Model

1. Clone the upstream repository into `model_repos/<name>`.
2. Create `configs/models/<name>.yaml` with `name`, epochs, optimizer, LR, scheduler, loss, backbone, pretrained weights, and image size.
3. Write `train/train_<name>.py`.
4. Reuse `train/wrapper_common.py` if the model is a subprocess adapter.
5. Use `datasets/cd_dataset.py` directly if the model can train in the unified process.
6. Register the model in `configs/models/registry.yaml`.
7. Add pretrained weight handling to `utils/weight_downloader.py` or `setup.py` when needed.
8. Run `python run_training.py --model <name> --dataset levir_cd --dry-run`.
9. Run the wrapper smoke-test using the real script path, for example `python train/train_bifa.py --dataset levir_cd --smoke-test`.
10. Run a short real training pass on one dataset before adding the model to a full sweep.
11. Ensure final metrics are saved as `results/<model>/<dataset>/metrics_test.json`.
12. Regenerate `results/comparison_table.csv`.

## Citation

If you use this benchmark suite in your research, please cite the individual model papers. Key references:

<details>
<summary>BibTeX references</summary>

```bibtex
@article{chen2021bit,
  title={Remote Sensing Image Change Detection with Transformers},
  author={Chen, Hao and Qi, Zipeng and Shi, Zhenwei},
  journal={IEEE Transactions on Geoscience and Remote Sensing},
  year={2021}
}

@article{zhang2020dsifn,
  title={A deeply supervised image fusion network for change detection in high resolution bi-temporal remote sensing images},
  author={Zhang, Chenxiao and Yue, Peng and Tapete, Deodato and Jiang, Linlin and Shangguan, Bo and Huang, Liangpei and Liu, Guoxiang},
  journal={ISPRS Journal of Photogrammetry and Remote Sensing},
  year={2020}
}

@article{bandara2022changeformer,
  title={A Transformer-Based Siamese Network for Change Detection},
  author={Bandara, Wele Gedara Chaminda and Patel, Vishal M.},
  journal={IGARSS},
  year={2022}
}

@article{zhou2025schanger,
  title={SChanger: Change Detection from a Semantic Change and Spatial Consistency Perspective},
  author={Zhou, Ziyu and Hu, Keyan and Fang, Yutian and Rui, Xiaoping},
  journal={IEEE JSTARS},
  year={2025}
}
```

</details>

## Acknowledgements

We thank the authors of all included models for their open-source implementations. This benchmark builds on:

- [Open-CD](https://github.com/likyoo/open-cd) for Changer and the Open-CD toolbox.
- [VMamba](https://github.com/MzeroMiko/VMamba) for the VMamba backbone family.
- [timm](https://github.com/huggingface/pytorch-image-models) for pretrained backbone weights.
- University of Peradeniya for computational resources.


### Setup Commands
`python setup.py`
Runs environment checks, clones repos, fetches weights, and prepares dataset lists.
`python setup.py --status`
Prints status without changes.
`python setup.py --skip-weights`
Skips weight downloads.
`python setup.py --env-check-only`
Checks packages only.
`python setup.py --dataset levir_cd`
Prepares list files for one dataset config.

### Training Commands
`python run_training.py --model bifa --dataset levir_cd`
Trains one model on one dataset.
`python run_training.py --model all --dataset levir_cd`
Runs every registered model on one dataset.
`python run_training.py --model bifa --dataset all`
Runs one model across all configured datasets with available roots.
`python run_training.py --model all --dataset all`
Runs the full configured sweep.
`python run_training.py --model all --dataset dsifn_cd --dry-run`
Checks launch commands without training.

### Evaluation Commands
`python evaluate.py --model bifa --dataset levir_cd`
Attempts central evaluation for a trained checkpoint.
`python evaluate.py --model all --dataset all --dry-run`
Checks evaluation config resolution.
`python utils/weight_downloader.py --prefetch-all`
Fetches managed pretrained weights.
`python utils/weight_downloader.py --list`
Lists managed VMamba weight files.


## Audit Appendix: Environment Snapshot

The local `Mamba` environment used during audit reported:

```text
torch 2.6.0+cu124
torchvision 0.21.0+cu124
numpy 2.1.2
PIL 12.2.0
cv2 4.13.0
yaml 6.0.2
tqdm 4.68.1
timm 0.4.12
einops 0.8.1
sklearn 1.6.1
```

`timm 0.4.12` does not expose every modern MiT alias. The weight downloader treats missing `mit_b0` and `mit_b1` aliases as optional warmup warnings unless the model explicitly requires them.