Package: pancollection
"PanCollection" for Remote Sensing Pansharpening (Make Available onPyPI:tada:)English|简体中文This repository is the official PyTorch implementation of “基于卷积神经网络的遥感图像全色锐化进展综述及相关数据集发布” (paper,homepage).Release the PanCollection of the pan-sharpening training-test dataset of related satellites (such as WorldView-3, QuickBird, GaoFen2, WorldView-2 satellites);Release the Python code based on the unified Pytorch framework , which is convenient for later scholars;Release a unified Pansharpening traditional-deep learning method (including MATLAB test software package), which is convenient for later scholars to conduct fair tests.Make available onPyPI.Added Colab Demo.See therepofor more detailed descriptions.See thePanCollection Paperfor early results.RecommendationsWe recommend users to use the code-toolboxDLPan-Toolbox+ the datasetPanCollectionfor fair training and testing!Datasets (Reduced and Full)SatelliteValueCommentWorldView-32047Training; Testing; GeneralizationQuickBird2047Training; TestingGaoFen-21023Training; TestingWorldView-22047Training; Testing; GeneralizationRequirementsPython3.7+, Pytorch>=1.9.0NVIDIA GPU + CUDANote: Our project is based on MMCV, but you needn't to install it currently.Quick Start🤗 To get started with PanCollection benchmark (training, inference, etc.), we recommend readingGoogle Colab!importpancollectionaspancfg=pan.TaskDispatcher.new(task='pansharpening',mode='entrypoint',arch='FusionNet',dataset_name="gf2",use_resume=False,dataset={'train':'gf2','test':'test_gf2_multiExm1.h5'})print(pan.TaskDispatcher._task)pan.trainer.main(cfg,pan.build_model,pan.getDataSession)Quick Start for DeveloperStep0.set your Python environment.git clonehttps://github.com/XiaoXiao-Woo/PanCollectionThen,python setup.py developorpip install -i pancollectionhttps://pypi.org/simpleStep1.Download datasets (WorldView-3, QuickBird, GaoFen2, WorldView2) from thehomepage. Put it with the following format.Verify the dataset path inPanCollection/UDL/Basis/option.py, or you can print the output ofrun_pansharpening.py, then setcfg.data_dirto your dataset path.|-$ROOT/Datasets
├── pansharpening
│   ├── training_data
│   │   ├── train_wv3.h5
│   │   ├── ...
│   ├── validation_data
│   │   │   ├── valid_wv3.h5
│   │   │   ├── ...
│   ├── test_data
│   │   ├── WV3
│   │   │   ├── test_wv3_multiExm.h5
│   │   │   ├── ...Step2.OpenPanCollection/UDL/pansharpening,  run the following code:python run_pansharpening.pystep3.How to train/validate the code.A training example：run_pansharpening.pywhere arch='BDPN', and configs/option_bdpn.py has:cfg.eval= False,cfg.workflow= [('train', 50), ('valid', 1)],cfg.dataset= {'train': 'wv3', 'valid': 'wv3_multiExm.h5'}A test example:run_test_pansharpening.pycfg.eval= True orcfg.workflow= [('test', 1)]Step4.How to customize your model.def run_demo():
    import os 
    os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
    os.environ["CUDA_VISIBLE_DEVICES"] = "0"

    from <your_model_file> import build
    from pancollection.configs.configs import TaskDispatcher
    from udl_vis.AutoDL.trainer import main
    from pancollection.common.builder import build_model, getDataSession
    import option_<your_model_file> # please refer to https://github.com/XiaoXiao-Woo/PanCollection/blob/main/pancollection/configs/option_fusionnet.py


    cfg = TaskDispatcher.new(task='hisr', mode='entrypoint', arch='FCFormer', **data_path,
                             workflow=[('train', 10), ('valid', 1), ('test', 1)], resume_from="", experimental_desc="LN")
                            #  **data_path)
                            #  , data_dir="/Data/Datasets/hisr")
    print(TaskDispatcher._task.keys())

    main(cfg, build_model, getDataSession)

if __name__ == '__main__':
    run_demo()Step5.How to customize the code.One model is divided into three parts:Record hyperparameter configurations in folder ofPanCollection/UDL/pansharpening/configs/option_<modelName>.py. For example, you can load pretrained model by settingmodel_path= "your_model_path" orcfg.resume_from= "your_model_path".Set model, loss, optimizer, scheduler in folder ofPanCollection/UDL/pansharpening/models/<modelName>_main.py.Write a new model in folder ofPanCollection/UDL/pansharpening/models/<modelName>/model_<modelName>.py.Note that when you add a new model into PanCollection, you need to updatePanCollection/UDL/pansharpening/models/__init__.pyand add option_.py.Othersif you want to add customized datasets, you need to update:PanCollection/UDL/AutoDL/__init__.py.
PanCollection/UDL/pansharpening/common/psdata.py.if you want to add customized tasks, you need to update:1.Put model_<newModelName> and <newModelName>_main in PanCollection/UDL/<taskName>/models.
2.Create a new folder of PanCollection/UDL/<taskName>/configs to put option_<newModelName>.
3.Update PanCollection/UDL/AutoDL/__init__.
4.Add a class in PanCollection/UDL/Basis/python_sub_class.py, like this:
class PanSharpeningModel(ModelDispatcher, name='pansharpening'):if you want to add customized training settings, such as saving model, recording logs, and so on. you need to update:PanCollection/UDL/mmcv/mmcv/runner/hooksNote that: Don't put model/dataset/task-related files into the folder of AutoDL.if you want to know more details of runner about how to train/test inPanCollection/UDL/AutoDL/trainer.py, please see PanCollection/UDL/mmcv/mmcv/runner/epoch_based_runner.pyPlanningshugging face 🤗Integrated intoHuggingface Spaces 🤗usingGradio. Try out the web demo:Hugging Face SpacesSupport more modelsMake theLeaderboardfor model results.ContributionWe appreciate all contributions to improving PanCollection. Looking forward to your contribution to PanCollection.CitationPlease cite this project if you use datasets or the toolbox in your research.@misc{PanCollection,
    author = {Xiao Wu, Liang-Jian Deng and Ran Ran},
    title = {"PanCollection" for Remote Sensing Pansharpening},
    url = {https://github.com/XiaoXiao-Woo/PanCollection/},
    year = {2022},
}@ARTICLE{dengjig2022,
	author={邓良剑，冉燃，吴潇，张添敬},
	journal={中国图象图形学报},
	title={遥感图像全色锐化的卷积神经网络方法研究进展},
 	year={2022},
  	volume={},
  	number={9},
  	pages={},
  	doi={10.11834/jig.220540}
   }@ARTICLE{deng2022grsm,
author={L.-J. Deng, G. Vivone, M. E. Paoletti, G. Scarpa, J. He, Y. Zhang, J. Chanussot, and A. Plaza},
booktitle={IEEE Geoscience and Remote Sensing Magazine},
title={Machine Learning in Pansharpening: A Benchmark, from Shallow to Deep Networks},
year={2022},
pages={2-38},
doi={10.1109/MGRS.2020.3019315}
}AcknowledgementMMCV: OpenMMLab foundational library for computer vision.License & CopyrightThis project is open sourced under GNU General Public License v3.0.