Train and evaluate RGB SR models, multispectral fusion networks, and OpenSR metrics. https://arxiv.org/abs/2506.11764
# ❶ Create a virtual environment (optional but recommended) Python version used 3.11.4
python -m venv .venv
source .venv/bin/activate # Windows: venv\Scripts\activate
# ❷ Install all Python dependencies
pip install -r requirements.txt
To directly download and test our pretrained checkpoints, skip diretly to Step 2a.
Dataset | What to download | Destination |
---|---|---|
NAIP Synthetic | *.tif tiles from https://huggingface.co/datasets/isp-uv-es/SEN2NAIP/tree/main/synthetic | load/naip/synthetic_naip/ |
WorldStrat | *.tif files from https://worldstrat.github.io/ | load/WorldStrat_raw/ |
Make sure only TIFF files are placed in the folders above.
python 1_train_sr.py --config configs/blindsrsnf_aniso_naip_degraded_harm_large.yaml
python 1_train_sr.py --config configs/blindsrsnf_aniso_naip_degraded_not_harm_large.yaml
python 1_train_sr.py --config configs/blindsrsnf_aniso_worldstrat_degraded_harmfac_10000_large.yaml
Each run will create a Lightning log directory such as logs/blindsrsnf_aniso_naip_degraded_harm_large/
.
python download_opensr_test.py
It will use lr_files_list.txt to dump all low and high resolution images.
python 0_prepare_open_sr_test_data.py
The following checkpoints are available:
- WorldStrat SR
- NAIP-no-harm SR (No Harmonization)
- NAIP-harm SR (with harmonization) Checkpoints are stored at https://huggingface.co/NorskRegnesentralSTI/DiffFuSR. Download them using:
git lfs install
git clone https://huggingface.co/NorskRegnesentralSTI/DiffFuSR && mv DiffFuSR/logs logs
python 2_test_rgb_for_opensr_metric.py
--checkpoint
flag can be changed to test all three models. WorldStrat SR, NAIP-no-harm SR (No Harmonization) and NAIP-harm SR (with harmonization).
SR outputs are saved under the corresponding logs/.../sr/
directory.
it will produce folder diffsr in logs folder which will be used in next step.
python 3_preprocess_for_opensrtest.py
Change the path_diffsr appropriately. This script will create the open sr metrics for the three SR evaluation tables (TABLE I to TABLE III). We follow open-SR test documentation to correctly set all experiment setting. These can be changed as required.
e.g. path_diffsr = "logs/blindsrsnf_aniso_worldstrat_degraded_harmfac_10000_large/version_7/results/worldstrat/diffsr"
python 4_opensr.py
The script writes a CSV file with OpenSR metrics. Open it in and process in Excel to obtain averages and variance across all test images.
Train Fusion Model, by using data from Norwegian computing Center project FM4CS. The data is not released yet but the list of tiles used in included. The list of tiles used is in the text file. The data has not been released but any Sentinel-2 data can be used to train this as long as you have very large tiles available for sampling.
Input tiles: list is in list_fusion_train.txt
.
Run:
python 5_train_fusion.py
The model checkpoints are saved in logs/GSD/
.
Test using pretrained model using and the comlete super-resolutiona nd fusion pipeline. Select the correct flag desired. Either use Gram Schmidt or Neural Network for fusion. For neural network a pre-trained weight are required. Also chose the super-resolution model to be used.
Downloads weight for fusion module must be in logs/GSD/
.
python 6_test_multispectral_SR_fuse.py
to bechmark the whole SR + fusion pipeline. This will generate the Last table in the paper. TABLE IV
python 7_benchmark_DiffFuSR.py
The script prints all metrics
load/
├─ naip/synthetic_naip/ # NAIP synthetic TIFFs
├─ WorldStrat_raw/ # WorldStrat raw TIFFs
└─ opensrtest/100/
├─ lr/ # auto-generated
└─ hr/ # auto-generated
logs/
├─ blindsrsnf_aniso_naip_degraded_harm_large/
│ └─ version_1/checkpoints/last.ckpt
├─ blindsrsnf_aniso_naip_degraded_not_harm_large/
│ └─ version_0/checkpoints/last.ckpt
├─ blindsrsnf_aniso_worldstrat_degraded_harmfac_10000_large/
│ └─ version_7/checkpoints/last.ckpt
└─ GSD/ # Fusion model
└─ best.ckpt
If you use this pipeline, please cite our paper and also the works which this is based on.
Thanks to following sources for code inspiration.
https://github.com/hanlinwu/BlindSRSNF
https://github.com/ESAOpenSR/opensr-test
https://github.com/esaOpenSR/opensr-degradation/