shadowwalk commited on
Commit
7951b69
·
verified ·
1 Parent(s): 2878e2b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +319 -3
README.md CHANGED
@@ -1,3 +1,319 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SFR-Net
2
+
3
+ <p align="center">
4
+ <a href="https://arxiv.org/abs/2605.25737"><img src="https://img.shields.io/badge/arXiv-2605.25737-b31b1b.svg" alt="arXiv"></a>
5
+ <a href="https://huggingface.co/shadowwalk/SFR-Net"><img src="https://img.shields.io/badge/Hugging%20Face-Weights-FFD21E.svg" alt="Hugging Face weights"></a>
6
+ </p>
7
+
8
+
9
+ <p align="center">
10
+ English | <a href="README_zh-CN.md">简体中文</a>
11
+ </p>
12
+
13
+
14
+ <p align="center">
15
+ <img src="pics/SFR-Net-cover.png" alt="SFR-Net cover" width="100%">
16
+ </p>
17
+
18
+
19
+ <p align="center">
20
+ <strong>Learning Scale-Frustum Representations for Ultra-Wide Area Remote Sensing Image Segmentation</strong>
21
+ </p>
22
+
23
+
24
+ <p align="center">
25
+ <a href="https://arxiv.org/abs/2605.25737">Paper</a> |
26
+ <a href="https://huggingface.co/shadowwalk/SFR-Net">Weights</a>
27
+ </p>
28
+
29
+
30
+ ## Overview 🧭
31
+
32
+ SFR-Net is designed for semantic segmentation of ultra-wide area (UWA) remote sensing images, where both the pixel count and geographical coverage are extremely large. It constructs aligned local, short-range, and long-range observations around the same Projection Reference Point (PRP), resizes them to a unified input size, and distinguishes them with learnable scale embeddings. A Cascaded Cross-Scale Fusion (CCSF) module then injects contextual information into the local representation progressively, preserving fine details while improving long-range semantic continuity.
33
+
34
+ <p align="center">
35
+ <img src="pics/sfrnet-framework.png" alt="Overall framework of SFR-Net" width="100%">
36
+ </p>
37
+
38
+
39
+ ## News 📰
40
+
41
+ - **2026-08-26:** We updated the codebase, fixed known bugs, improved the inference, testing, and visualization scripts, and released trained weights for GID, FBPS, and Inria Aerial.
42
+ - **2026-07-11:** We received the first-round review decision from IEEE Transactions on Geoscience and Remote Sensing (IEEE TGRS), and the manuscript was invited for major revision.
43
+ - **2026-05-25:** Our paper, [“SFR-Net: Learning Scale-Frustum Representations for Ultra-Wide Area Remote Sensing Image Segmentation”](https://arxiv.org/abs/2605.25737), was released on arXiv.
44
+ - **2026-05-20:** Our paper, “SFR-Net: Learning Scale-Frustum Representations for Ultra-Wide Area Remote Sensing Image Segmentation,” was submitted to IEEE TGRS.
45
+ - **2026-05-11:** We released the initial code version with training and testing scripts and pretrained weights.
46
+
47
+ ## Highlights ✨
48
+
49
+ - We formulate ultra-wide area remote sensing image segmentation as a task that jointly considers large pixel counts, extremely wide geographical coverage, significantly varying object scales, and long-range semantic continuity.
50
+ - Scale-Frustum Representations unify local, short-range, and long-range observations around the same PRP. The released GID/FBPS configs use distances `[1, 3, 14]`, while the Inria Aerial config uses `[1, 3, 10]`.
51
+ - Learnable scale embeddings explicitly identify resized observations from different spatial ranges.
52
+ - The CCSF module progressively introduces nearby and broader contextual cues into detailed local features.
53
+ - SFR-Net achieves state-of-the-art results on the UWA GID and FBPS benchmarks. The SFR representation can also improve the accuracy and convergence speed of generic segmentation networks.
54
+
55
+ ## Performance 📊
56
+
57
+ The following table is taken from the paper. SFR-Net reaches `74.67%` mIoU on GID and `77.24%` mIoU on FBPS in the paper setting.
58
+
59
+ <p align="center">
60
+ <img src="pics/sfrnet-performance.png" alt="Quantitative comparison on GID and FBPS" width="100%">
61
+ </p>
62
+
63
+
64
+ ## Repository Layout 🗂️
65
+
66
+ ```text
67
+ SFR-Net/
68
+ ├── configs/
69
+ │ ├── _base_/
70
+ │ │ ├── datasets/
71
+ │ │ ├── schedules/
72
+ │ │ └── default_runtime.py
73
+ │ ├── gid/sfrnet_swinl_320k_gid.py
74
+ │ ├── fbps/sfrnet_swinl_320k_fbps.py
75
+ │ └── inria_aerial/sfrnet_swinl_320k_inria_aerial.py
76
+ ├── mmseg/
77
+ │ ├── datasets/transforms/sfr_loading.py
78
+ │ ├── datasets/uwa_dataset.py
79
+ │ ├── models/backbones/sfr_net.py
80
+ │ └── models/necks/ccsf_neck.py
81
+ ├── tools/
82
+ │ ├── train.py
83
+ │ ├── test.py
84
+ │ ├── sfr_inference.py
85
+ │ ├── get_res_iou.py
86
+ │ └── visualizer.py
87
+ ├── pics/
88
+ ├── pretrain/
89
+ ├── weights/
90
+ ├── README.md
91
+ └── README_zh-CN.md
92
+ ```
93
+
94
+ The release keeps the default SFR-Net pathway and the GID, FBPS, and Inria Aerial configurations. Multi-distance ablations and other experimental-only modules are intentionally excluded.
95
+
96
+ ## Weights 🔑
97
+
98
+ All pretrained backbones and released SFR-Net checkpoints are hosted in the [SFR-Net Hugging Face repository](https://huggingface.co/shadowwalk/SFR-Net).
99
+
100
+ ### Available files
101
+
102
+ | Type | File | Expected location |
103
+ | ----------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
104
+ | ResNet-18 ImageNet pretraining | [`resnet18_v1c-b5776b93.pth`](https://huggingface.co/shadowwalk/SFR-Net/blob/main/pretrain/resnet18_v1c-b5776b93.pth) | `pretrain/resnet18_v1c-b5776b93.pth` |
105
+ | Swin-Large ImageNet-22K pretraining | [`swin_large_patch4_window12_384_22k_20220412-6580f57d.pth`](https://huggingface.co/shadowwalk/SFR-Net/blob/main/pretrain/swin_large_patch4_window12_384_22k_20220412-6580f57d.pth) | `pretrain/swin_large_patch4_window12_384_22k_20220412-6580f57d.pth` |
106
+ | GID checkpoint | [`iter_320000_gid.pth`](https://huggingface.co/shadowwalk/SFR-Net/blob/main/weights/iter_320000_gid.pth) | `weights/iter_320000_gid.pth` |
107
+ | FBPS checkpoint | [`iter_320000_fbps.pth`](https://huggingface.co/shadowwalk/SFR-Net/blob/main/weights/iter_320000_fbps.pth) | `weights/iter_320000_fbps.pth` |
108
+ | Inria Aerial checkpoint | [`iter_320000_inria.pth`](https://huggingface.co/shadowwalk/SFR-Net/blob/main/weights/iter_320000_inria.pth) | `weights/iter_320000_inria.pth` |
109
+
110
+ You can download the files with the Hugging Face CLI:
111
+
112
+ ```bash
113
+ pip install -U huggingface_hub
114
+ hf download shadowwalk/SFR-Net --local-dir downloads/SFR-Net
115
+ cp -r downloads/SFR-Net/pretrain/. pretrain/
116
+ cp -r downloads/SFR-Net/weights/. weights/
117
+ ```
118
+
119
+ ### Released checkpoint results
120
+
121
+ | Dataset | OA (%) | mIoU (%) | mF1 (%) | Checkpoint |
122
+ | ------------ | -----: | -------: | ------: | ------------------------------- |
123
+ | GID | 86.82 | 74.46 | 85.73 | `weights/iter_320000_gid.pth` |
124
+ | FBPS | 93.50 | 77.86 | 66.72 | `weights/iter_320000_fbps.pth` |
125
+ | Inria Aerial | 96.91 | 83.96* | 91.28* | `weights/iter_320000_inria.pth` |
126
+
127
+ `*` For Inria Aerial, IoU and F1 are reported for the building class only. The released checkpoints were trained with random seed `42`; their results therefore differ slightly from the values reported in the paper.
128
+
129
+ The backbone paths are currently defined in `mmseg/models/backbones/sfr_net.py`. No code change is required if the two pretrained files are kept under `pretrain/` and commands are executed from the repository root.
130
+
131
+ ## Installation 🛠️
132
+
133
+ Create an environment with a PyTorch/CUDA combination suitable for your GPU, then install SFR-Net from the repository root:
134
+
135
+ ```bash
136
+ conda create -n sfrnet python=3.10 -y
137
+ conda activate sfrnet
138
+
139
+ # Install PyTorch first according to https://pytorch.org/get-started/locally/
140
+ pip install -U openmim
141
+ mim install mmengine "mmcv>=2.0.0"
142
+ pip install -r requirements.txt
143
+ pip install -v -e .
144
+ pip install mxnet
145
+ ```
146
+
147
+ `mxnet` is used by `tools/sfr_inference.py` to read the original ultra-wide images.
148
+
149
+ ## Data Preparation 🗃️
150
+
151
+ Official dataset pages:
152
+
153
+ | Dataset | Website |
154
+ | ------------ | ------------------------------------------------------------ |
155
+ | GID | [Gaofen Image Dataset](https://x-ytong.github.io/project/GID) |
156
+ | FBPS | [Five-Billion-Pixels](https://x-ytong.github.io/project/Five-Billion-Pixels.html) |
157
+ | Inria Aerial | [Inria Aerial Image Labeling Dataset](https://project.inria.fr/aerialimagelabeling/) |
158
+
159
+ Organize the datasets as follows:
160
+
161
+ ```text
162
+ SFR-Net/
163
+ └── data/
164
+ ├── GID/
165
+ │ ├── Image_train/
166
+ │ ├── Image_test/
167
+ │ ├── annos_train_5l/
168
+ │ ├── annos_test_5l/
169
+ │ ├── annos_train_24l/
170
+ │ └── annos_test_24l/
171
+ └── inria_aerial/
172
+ ├── images/
173
+ │ ├── train/
174
+ │ ├── val/
175
+ │ └── test/
176
+ └── Label/
177
+ ├── train/
178
+ ├── val/
179
+ └── test/
180
+ ```
181
+
182
+ GID and FBPS use the same GF-2 images but different label folders. GID uses the 5-category annotations and produces 6 class indices including background; FBPS uses the 24-category annotations and produces 25 class indices including background. Inria Aerial uses two class indices: background and building.
183
+
184
+ The released configs still contain the original local absolute paths. Before training or validation, update these three files:
185
+
186
+ ```python
187
+ # configs/_base_/datasets/gid.py
188
+ data_root = 'data/GID'
189
+
190
+ # configs/_base_/datasets/fbps.py
191
+ data_root = 'data/GID'
192
+
193
+ # configs/_base_/datasets/inria_aerial.py
194
+ data_root = 'data/inria_aerial'
195
+ ```
196
+
197
+ Alternatively, keep the datasets elsewhere and set each `data_root` to the corresponding absolute path. The folder names below `data_root` must still match the structure shown above.
198
+
199
+ ## Training 🏋️
200
+
201
+ Before training:
202
+
203
+ 1. Set `data_root` in the appropriate file under `configs/_base_/datasets/` as described in Data Preparation.
204
+ 2. Check `batch_size` and `num_workers` in the selected experiment config. The released configs use batch size `4` and override `num_workers` to `64`; reduce them if your GPU memory or CPU resources are limited.
205
+ 3. Keep the two backbone checkpoints under `pretrain/`, or update `depth2ckpt` in `mmseg/models/backbones/sfr_net.py` if you use different locations.
206
+
207
+ Train with random seed `42` (the default in `configs/_base_/default_runtime.py` and `tools/train.py`):
208
+
209
+ ```bash
210
+ python tools/train.py configs/gid/sfrnet_swinl_320k_gid.py \
211
+ --work-dir work_dirs/gid
212
+
213
+ python tools/train.py configs/fbps/sfrnet_swinl_320k_fbps.py \
214
+ --work-dir work_dirs/fbps
215
+
216
+ python tools/train.py configs/inria_aerial/sfrnet_swinl_320k_inria_aerial.py \
217
+ --work-dir work_dirs/inria_aerial
218
+ ```
219
+
220
+ Add `--amp` to enable automatic mixed precision. Use `--resume` with the same `--work-dir` to continue from its latest checkpoint.
221
+
222
+ ## Inference 🛰️
223
+
224
+ `tools/sfr_inference.py` contains original-machine defaults in the `DATASETS` dictionary, including `/mnt/dataset/zhongchuyu/...`. Either replace the `src` entries with `data/GID/Image_test` and `data/inria_aerial/images/test`, or pass `--src` explicitly as shown below. Command-line values take precedence over those defaults.
225
+
226
+ ```bash
227
+ python tools/sfr_inference.py \
228
+ --dataset gid \
229
+ --src data/GID/Image_test \
230
+ --dst work_dirs/gid_predictions \
231
+ --config configs/gid/sfrnet_swinl_320k_gid.py \
232
+ --ckpt weights/iter_320000_gid.pth \
233
+ --stride 128
234
+
235
+ python tools/sfr_inference.py \
236
+ --dataset fbps \
237
+ --src data/GID/Image_test \
238
+ --dst work_dirs/fbps_predictions \
239
+ --config configs/fbps/sfrnet_swinl_320k_fbps.py \
240
+ --ckpt weights/iter_320000_fbps.pth \
241
+ --stride 128
242
+
243
+ python tools/sfr_inference.py \
244
+ --dataset inria_aerial \
245
+ --src data/inria_aerial/images/test \
246
+ --dst work_dirs/inria_aerial_predictions \
247
+ --config configs/inria_aerial/sfrnet_swinl_320k_inria_aerial.py \
248
+ --ckpt weights/iter_320000_inria.pth \
249
+ --stride 128
250
+ ```
251
+
252
+ The default `--load-type random` builds the complete scale-frustum representation. Predictions are saved as single-channel class-index PNG masks.
253
+
254
+ ## Metrics and Visualization 🎨
255
+
256
+ ### Metrics
257
+
258
+ `tools/get_res_iou.py` currently stores the original ground-truth paths in its `DATASETS` dictionary and does not provide a `--gt` argument. Update that dictionary before evaluation:
259
+
260
+ ```python
261
+ DATASETS = {
262
+ 'gid': ('data/GID/annos_test_5l', 6),
263
+ 'fbps': ('data/GID/annos_test_24l', 25),
264
+ 'inria_aerial': ('data/inria_aerial/Label/test', 2),
265
+ }
266
+ ```
267
+
268
+ Then compute the metrics:
269
+
270
+ ```bash
271
+ python tools/get_res_iou.py --dataset gid \
272
+ --pred work_dirs/gid_predictions
273
+
274
+ python tools/get_res_iou.py --dataset fbps \
275
+ --pred work_dirs/fbps_predictions
276
+
277
+ python tools/get_res_iou.py --dataset inria_aerial \
278
+ --pred work_dirs/inria_aerial_predictions
279
+ ```
280
+
281
+ ### Visualization
282
+
283
+ `tools/visualizer.py` has no fixed dataset path; provide the input and output directories on the command line. Its `PALETTES` dictionary contains the GID, FBPS, and Inria Aerial color maps and only needs modification if your class-index convention changes.
284
+
285
+ ```bash
286
+ python tools/visualizer.py --dataset gid \
287
+ --src work_dirs/gid_predictions \
288
+ --dst work_dirs/gid_visualizations
289
+
290
+ python tools/visualizer.py --dataset fbps \
291
+ --src work_dirs/fbps_predictions \
292
+ --dst work_dirs/fbps_visualizations
293
+
294
+ python tools/visualizer.py --dataset inria_aerial \
295
+ --src work_dirs/inria_aerial_predictions \
296
+ --dst work_dirs/inria_aerial_visualizations
297
+ ```
298
+
299
+ ## Contact ✉️
300
+
301
+ If you find this work useful, please cite our [paper](https://arxiv.org/abs/2605.25737):
302
+
303
+ ```bibtex
304
+ @article{zhong2026sfr,
305
+ title={SFR-Net: Learning Scale-Frustum Representations for Ultra-Wide Area Remote Sensing Image Segmentation},
306
+ author={Zhong, Chuyu and Chen, Keyan and Yang, Qinzhe and Chen, Bowen and Zou, Zhengxia and Shi, Zhenwei},
307
+ journal={arXiv preprint arXiv:2605.25737},
308
+ year={2026}
309
+ }
310
+ ```
311
+
312
+ Questions and bug reports are welcome at **buaazcy@buaa.edu.cn**.
313
+
314
+ If you find this repository helpful, please give it a star. Finally, here is Phoebe. You are not allowed to bully her.
315
+
316
+ <p align="left">
317
+ <img src="pics/phoebe.png" width="300" alt="Phoebe">
318
+ </p>
319
+