ElmanGhazaei commited on
Commit
5f0ea9c
Β·
verified Β·
1 Parent(s): b59f460

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +261 -12
README.md CHANGED
@@ -39,32 +39,281 @@
39
  ---
40
 
41
 
42
- ## Datasets
43
- We used [LEVIR-CD+](https://www.kaggle.com/datasets/mdrifaturrahman33/levir-cd-change-detection), [SYSU-CD](https://github.com/liumency/SYSU-CD), and [WHU-CD](http://gpcv.whu.edu.cn/data/building_dataset.html) as the main datasets, while [CDD](http://gpcv.whu.edu.cn/data/building_dataset.html) and [OSCD](https://www.kaggle.com/datasets/soumikrakshit/onera-satellite-change-detection-dataset) were included in the ablation study to demonstrate the robustness of our model under different conditions.
44
 
 
 
 
 
 
 
45
 
46
- **Qualitative Analysis:**
47
 
48
 
 
49
 
 
50
 
 
 
 
 
51
 
52
- <p align="center">
53
- <img width="1379" height="357" alt="Screenshot from 2025-11-03 16-38-52" src="https://github.com/user-attachments/assets/c63690af-fd07-40af-b991-2b5b33ff53af" />
54
- </p>
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  ---
57
- # Results
58
 
59
- ![Screenshot from 2025-04-13 14-51-16](https://github.com/user-attachments/assets/36f7487a-c08b-4205-9c05-e9b909ef0c89)
60
 
 
61
 
 
 
 
 
 
 
62
 
63
- # Complexity
64
 
65
- <div align="center">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
- ![Screenshot from 2025-04-13 14-56-37](https://github.com/user-attachments/assets/b4b50828-fdd0-4b31-a4c2-e802ec43b404)
68
 
69
- </div>
70
 
 
39
  ---
40
 
41
 
42
+ ## πŸ“¦ Requirements
43
+ ```bash
44
 
45
+ pip install torch torchvision torchaudio
46
+ pip install pillow
47
+ pip install numpy scipy pandas
48
+ pip install matplotlib seaborn
49
+ pip install einops
50
+ pip install torchinfo
51
 
52
+ ```
53
 
54
 
55
+ ---
56
 
57
+ ## πŸ“ Dataset Preparation
58
 
59
+ This project supports three main change detection datasets:
60
+ - **LEVIR-CD+** - [Download](https://www.kaggle.com/datasets/mdrifaturrahman33/levir-cd-change-detection)
61
+ - **SYSU-CD** - [Download](https://github.com/liumency/SYSU-CD)
62
+ - **WHU-CD** - [Download](http://gpcv.whu.edu.cn/data/building_dataset.html)
63
 
64
+ ---
 
 
65
 
66
+ ### Dataset Structure
67
+
68
+ #### For LEVIR-CD:
69
+ ```
70
+ your_dataset/
71
+ β”œβ”€β”€ train/
72
+ β”‚ β”œβ”€β”€ A/ # Pre-change images
73
+ β”‚ β”œβ”€β”€ B/ # Post-change images
74
+ β”‚ └── label/ # Ground truth masks
75
+ β”œβ”€β”€ test/
76
+ β”‚ β”œβ”€β”€ A/
77
+ β”‚ β”œβ”€β”€ B/
78
+ β”‚ └── label/
79
+ └── val/
80
+ β”œβ”€β”€ A/
81
+ β”œβ”€β”€ B/
82
+ └── label/
83
+ ```
84
+
85
+
86
+ #### For SYSU-CD:
87
+ ```
88
+ your_dataset/
89
+ β”œβ”€β”€ train/
90
+ β”‚ β”œβ”€β”€ time1/ # Pre-change images
91
+ β”‚ β”œβ”€β”€ time2/ # Post-change images
92
+ β”‚ └── label/ # Ground truth masks
93
+ β”œβ”€β”€ test/
94
+ β”‚ β”œβ”€β”€ time1/
95
+ β”‚ β”œβ”€β”€ time2/
96
+ β”‚ └── label/
97
+ └── val/
98
+ β”œβ”€β”€ time1/
99
+ β”œβ”€β”€ time2/
100
+ └── label/
101
+ ```
102
+
103
+ #### For WHU-CD:
104
+ ```
105
+ WHU-CD/
106
+ β”œβ”€β”€ A/ # Pre-change images
107
+ β”œβ”€β”€ B/ # Post-change images
108
+ β”œβ”€β”€ label/ # Ground truth masks
109
+ β”œβ”€β”€ train_list.txt # List of training samples
110
+ β”œβ”€β”€ test_list.txt # List of test samples
111
+ └── val_list.txt # List of validation samples
112
+ ```
113
+
114
+ The text files should contain image names (one per line):
115
+ ```
116
+ image_001.png
117
+ image_002.png
118
+ image_003.png
119
+ ...
120
+ ```
121
+ ---
122
+
123
+ ## πŸš‚ Training
124
+
125
+ ### LEVIR-CD Dataset
126
+ ```bash
127
+ python main.py \
128
+ --dataset levir \
129
+ --train_path /path/to/LEVIR-CD/train \
130
+ --test_path /path/to/LEVIR-CD/test \
131
+ --val_path /path/to/LEVIR-CD/val \
132
+ --batch_size 64 \
133
+ --epochs 50 \
134
+ --lr 0.001
135
+ ```
136
+
137
+ ### SYSU-CD Dataset
138
+ ```bash
139
+ python main.py \
140
+ --dataset sysu \
141
+ --train_path /path/to/SYSU-CD/train \
142
+ --test_path /path/to/SYSU-CD/test \
143
+ --val_path /path/to/SYSU-CD/val \
144
+ --batch_size 32 \
145
+ --epochs 100 \
146
+ --lr 0.0001
147
+ ```
148
+
149
+ ### WHU-CD Dataset
150
+ ```bash
151
+ python main.py \
152
+ --dataset whu \
153
+ --train_path /path/to/WHU-CD \
154
+ --train_txt /path/to/train_list.txt \
155
+ --test_txt /path/to/test_list.txt \
156
+ --val_txt /path/to/val_list.txt \
157
+ --batch_size 64 \
158
+ --epochs 50
159
+ ```
160
  ---
 
161
 
162
+ ## βš™οΈ Arguments
163
 
164
+ ### Required Arguments
165
 
166
+ | Argument | Description | Example |
167
+ |----------|-------------|---------|
168
+ | `--dataset` | Dataset type: `levir`, `sysu`, or `whu` | `--dataset levir` |
169
+ | `--train_path` | Path to training data | `--train_path /data/train` |
170
+ | `--test_path` | Path to test data (not for WHU) | `--test_path /data/test` |
171
+ | `--val_path` | Path to validation data (not for WHU) | `--val_path /data/val` |
172
 
173
+ ### WHU-CD Specific Arguments
174
 
175
+ | Argument | Description | Example |
176
+ |----------|-------------|---------|
177
+ | `--train_txt` | Training sample list file | `--train_txt train_list.txt` |
178
+ | `--test_txt` | Test sample list file | `--test_txt test_list.txt` |
179
+ | `--val_txt` | Validation sample list file | `--val_txt val_list.txt` |
180
+
181
+ ### Optional Arguments
182
+
183
+ | Argument | Default | Description |
184
+ |----------|---------|-------------|
185
+ | `--batch_size` | 64 | Batch size for training |
186
+ | `--epochs` | 50 | Number of training epochs |
187
+ | `--lr` | 0.001 | Learning rate |
188
+ | `--step_size` | 10 | Learning rate scheduler step size |
189
+ | `--save_dir` | ./checkpoints | Directory to save model checkpoints |
190
+ | `--model_name` | best_model.pth | Filename for saved model |
191
+ | `--seed` | 42 | Random seed for reproducibility |
192
+ | `--num_workers` | 4 | Number of data loading workers |
193
+
194
+ ---
195
+
196
+ ## πŸ”§ Advanced Usage Examples
197
+
198
+ ### Custom Save Directory and Model Name
199
+ ```bash
200
+ python main.py \
201
+ --dataset levir \
202
+ --train_path /data/LEVIR-CD/train \
203
+ --test_path /data/LEVIR-CD/test \
204
+ --val_path /data/LEVIR-CD/val \
205
+ --save_dir ./experiments/levir_exp1 \
206
+ --model_name levir_model.pth \
207
+ --epochs 100
208
+ ```
209
+
210
+ ### Different Learning Rate Schedule
211
+ ```bash
212
+ python main.py \
213
+ --dataset sysu \
214
+ --train_path /data/SYSU-CD/train \
215
+ --test_path /data/SYSU-CD/test \
216
+ --val_path /data/SYSU-CD/val \
217
+ --lr 0.0005 \
218
+ --step_size 20 \
219
+ --epochs 150
220
+ ```
221
+
222
+ ### Smaller Batch Size (for limited GPU memory)
223
+ ```bash
224
+ python main.py \
225
+ --dataset levir \
226
+ --train_path /data/train \
227
+ --test_path /data/test \
228
+ --val_path /data/val \
229
+ --batch_size 16 \
230
+ --num_workers 2
231
+ ```
232
+
233
+ ---
234
+
235
+ ## πŸ“€ Output
236
+
237
+ During training, the script will:
238
+ - Display training loss for each batch
239
+ - Show validation metrics (IoU, confusion matrix) after each epoch
240
+ - Save the best model based on validation IoU
241
+ - Display learning rate and epoch time
242
+
243
+ ### Model Checkpoint
244
+
245
+ The best model is automatically saved to:
246
+ ```
247
+ {save_dir}/{model_name}
248
+ ```
249
+
250
+ Default: `./checkpoints/best_model.pth`
251
+
252
+ ---
253
+
254
+ ## πŸ” Troubleshooting
255
+
256
+ ### Paths with Spaces
257
+
258
+ If your paths contain spaces, wrap them in quotes:
259
+ ```bash
260
+ python main.py \
261
+ --dataset levir \
262
+ --train_path "/path/with spaces/train" \
263
+ --test_path "/path/with spaces/test" \
264
+ --val_path "/path/with spaces/val"
265
+ ```
266
+
267
+ ### CUDA Out of Memory
268
+
269
+ Reduce batch size:
270
+ ```bash
271
+ python main.py --dataset levir ... --batch_size 16
272
+ ```
273
+
274
+ ### Missing WHU Text Files
275
+
276
+ For WHU dataset, ensure all three text files are provided:
277
+ ```bash
278
+ python main.py \
279
+ --dataset whu \
280
+ --train_path /data/WHU-CD \
281
+ --train_txt train_list.txt \
282
+ --test_txt test_list.txt \
283
+ --val_txt val_list.txt
284
+ ```
285
+
286
+ ---
287
+
288
+ ## πŸ’‘ Getting Help
289
+
290
+ View all available arguments:
291
+ ```bash
292
+ python main.py --help
293
+ ```
294
+
295
+ ---
296
+
297
+ ## πŸ“§ Contact
298
+
299
+ If you have any questions, please contact Elman Ghazaei at elman.ghazaei@sabanciuniv.edu
300
+
301
+ ---
302
+
303
+ ## Qualitative Analysis:
304
+
305
+
306
+
307
+
308
+
309
+ <p align="center">
310
+ <img width="1379" height="357" alt="Screenshot from 2025-11-03 16-38-52" src="https://github.com/user-attachments/assets/c63690af-fd07-40af-b991-2b5b33ff53af" />
311
+ </p>
312
+
313
+ ---
314
+ # Results
315
+
316
+ <img width="1365" height="780" alt="Screenshot from 2025-11-03 18-02-18" src="https://github.com/user-attachments/assets/2dabac8d-9ab5-467d-9dbe-6aa5266b2e5f" />
317
 
 
318
 
 
319