26
26
class BRIGHTDFC2025 (NonGeoDataset ):
27
27
"""BRIGHT DFC2025 dataset.
28
28
29
- The `BRIGHT <https://github.com/ChenHongruixuan/BRIGHT>`__ dataset consists of bi-temporal high-resolution multimodal images for
29
+ The `BRIGHT <https://github.com/ChenHongruixuan/BRIGHT>`__ dataset consists of bi-temporal
30
+ high-resolution multimodal images for
30
31
building damage assessment. The dataset is part of the 2025 IEEE GRSS Data Fusion Contest.
31
32
The pre-disaster images are optical images and the post-disaster images are SAR images, and
32
33
targets were manually annotated. The dataset is split into train, val, and test splits, but
@@ -64,7 +65,7 @@ class BRIGHTDFC2025(NonGeoDataset):
64
65
65
66
md5 = '2c435bb50345d425390eff59a92134ac'
66
67
67
- url = 'https://huggingface.co/datasets/Kullervo/BRIGHT /resolve/50901f05db4acbd141e7c96d719d8317910498fb/dfc25_track2_trainval .zip'
68
+ url = 'https://huggingface.co/datasets/torchgeo/bright /resolve/d19972f5e682ad684dcde35529a6afad4c719f1b/dfc25_track2_trainval_with_split .zip'
68
69
69
70
data_dir = 'dfc25_track2_trainval'
70
71
@@ -126,17 +127,18 @@ def __getitem__(self, index: int) -> dict[str, Tensor]:
126
127
index: index to return
127
128
128
129
Returns:
129
- data and target at that index
130
+ data and target at that index, pre and post image
131
+ are returned under separate image keys
130
132
"""
131
133
idx_paths = self .sample_paths [index ]
132
134
133
- pre_image = self ._load_image (idx_paths ['pre_image ' ]).float ()
134
- post_image = self ._load_image (idx_paths ['post_image ' ]).float ()
135
+ image_pre = self ._load_image (idx_paths ['image_pre ' ]).float ()
136
+ image_post = self ._load_image (idx_paths ['image_post ' ]).float ()
135
137
# https://github.com/ChenHongruixuan/BRIGHT/blob/11b1ffafa4d30d2df2081189b56864b0de4e3ed7/dfc25_benchmark/dataset/make_data_loader.py#L101
136
138
# post image is stacked to also have 3 channels
137
- post_image = repeat (post_image , 'c h w -> (repeat c) h w' , repeat = 3 )
139
+ image_post = repeat (image_post , 'c h w -> (repeat c) h w' , repeat = 3 )
138
140
139
- sample = {'pre_image ' : pre_image , 'post_image ' : post_image }
141
+ sample = {'image_pre ' : image_pre , 'image_post ' : image_post }
140
142
141
143
if 'target' in idx_paths and self .split != 'test' :
142
144
target = self ._load_image (idx_paths ['target' ]).long ()
@@ -151,7 +153,7 @@ def _get_paths(self) -> list[dict[str, str]]:
151
153
"""Get paths to the dataset files based on specified splits.
152
154
153
155
Returns:
154
- a list of dictionaries containing paths to the pre,post and target images
156
+ a list of dictionaries containing paths to the pre, post, and target images
155
157
"""
156
158
split_file = self .split_files [self .split ]
157
159
@@ -166,14 +168,14 @@ def _get_paths(self) -> list[dict[str, str]]:
166
168
167
169
sample_paths = [
168
170
{
169
- 'pre_image ' : os .path .join (
171
+ 'image_pre ' : os .path .join (
170
172
self .root ,
171
173
self .data_dir ,
172
174
dir_split_name ,
173
175
'pre-event' ,
174
176
f'{ sample_id .strip ()} _pre_disaster.tif' ,
175
177
),
176
- 'post_image ' : os .path .join (
178
+ 'image_post ' : os .path .join (
177
179
self .root ,
178
180
self .data_dir ,
179
181
dir_split_name ,
@@ -290,10 +292,10 @@ def plot(
290
292
291
293
fig , axs = plt .subplots (nrows = 1 , ncols = ncols , figsize = (15 , 5 ))
292
294
293
- axs [0 ].imshow (sample ['pre_image ' ].permute (1 , 2 , 0 ) / 255.0 )
295
+ axs [0 ].imshow (sample ['image_pre ' ].permute (1 , 2 , 0 ) / 255.0 )
294
296
axs [0 ].axis ('off' )
295
297
296
- axs [1 ].imshow (sample ['post_image ' ].permute (1 , 2 , 0 ) / 255.0 )
298
+ axs [1 ].imshow (sample ['image_post ' ].permute (1 , 2 , 0 ) / 255.0 )
297
299
axs [1 ].axis ('off' )
298
300
299
301
cmap = colors .ListedColormap (self .colormap )
0 commit comments