Code Monkey home page Code Monkey logo

mioir's Introduction

Towards Effective Multiple-in-One Image Restoration: A Sequential and Prompt Learning Strategy

  

Authors: Xiangtao Kong, Chao Dong and Lei Zhang

Abstract

While single task image restoration (IR) has achieved significant successes, it remains a challenging issue to train a single model which can tackle multiple IR tasks. In this work, we investigate in-depth the multiple-in-one (MiO) IR problem, which comprises seven popular IR tasks. We point out that MiO IR faces two pivotal challenges: the optimization of diverse objectives and the adaptation to multiple tasks. To tackle these challenges, we present two simple yet effective strategies. The first strategy, referred to as sequential learning, attempts to address how to optimize the diverse objectives, which guides the network to incrementally learn individual IR tasks in a sequential manner rather than mixing them together. The second strategy, i.e., prompt learning, attempts to address how to adapt to the different IR tasks, which assists the network to understand the specific task and improves the generalization ability. By evaluating on 19 test sets, we demonstrate that the sequential and prompt learning strategies can significantly enhance the MiO performance of commonly used CNN and Transformer backbones. Our experiments also reveal that the two strategies can supplement each other to learn better degradation representations and enhance the model robustness. It is expected that our proposed MiO IR formulation and strategies could facilitate the research on how to train IR models with higher generalization capabilities.

⭐ If MiOIR is helpful to your images or projects, please help star this repo. Thanks! 🤗

🔎 Overview framework

Demo Image

📌 Quantitative Results

Demo Image

More results of Restormer, Uformer and PromptIR (including the single task models) can be found in paper.

📷 Visual Results

Demo Image

Demo Image

⚙️ Dependencies and Installation

## git clone this repository
git clone https://github.com/Xiangtaokong/MiOIR.git
cd MiOIR

# create an environment with python >= 3.8
conda create -n MiOIR python=3.8
conda activate MiOIR
conda install -r requirements.txt 

OR refer to the environment of BasicSR

🚀 Test

Setp 1 Download the pre-trained models

One Drive

Baidu Drive. Key: yxuw

We provide 27 pre-trained models (including SRResNet, SwinIR, Restormer, Uformer and PromptIR) that appear in the paper.

Setp 2 Download the testsets

One Drive

Baidu Drive. Key: yxuw

Please download MiO_test.zip and unzip it to MiOIR/data.

Setp 3 Edit the test yml file

Edit the yml files in MiOIR/options/test that you need.

Please modify the path of your model and data.

Setp 4 Run the command

cd MiOIR
CUDA_VISIBLE_DEVICES=0 python basicsr/test.py --launcher none -opt MiOIR/options/test/xxxx.yml

The results will be put in MiO/results.

⭐ Train

Step1: Download the training data

One Drive

Baidu Drive. Key: yxuw

Download all the data (including sr, blur, noise, jpeg, rain, haze, dark, GT .zip), intotal 120G for dowmload.

OR only download GT.zip and depth.zip, then generate the rest data by MiOIR/data_script/add_MiO_train_degradation.py, intotal 16G for dowmload.

Step2: Data prepare

Use data_script/gen_sub.py to crop the data to 300x300, modify some path and make sure save them with floder name of xxx_sub300.

Use data_script/gen_meta.py to generate training meta file, modify some path and the order of the sequential learning (_S) you want.

Step3: Edit the train yml file

Edit the yml files in MiOIR/options/train that you need.Please modify the path of your model and data.

Note that:

Because the sequential learning (_S) need a series of yml files, please edit mixed learning (_M) first and then use options/gen_train.py to generate the yml files.

Step4: Run the command

cd MiOIR
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 --master_port=4176 basicsr/train.py -opt xxxxxx.yml

Note to modify the GPU card index and number --nproc_per_node= GPU number (correspond to it in yml).

If you use options/gen_train.py to generate yml files, it will also generate a .sh script in MiOIR/run_sh.

You could train Sequential Learning models through the script conveniently.

❤️ Acknowledgments

This project is based on BasicSR.

📧 Contact

If you have any questions, please feel free to contact: [email protected]

🎓Citations

If our code helps your research or work, please consider citing our paper. The following are BibTeX references:

@article{kong2024towards,
  title={Towards Effective Multiple-in-One Image Restoration: A Sequential and Prompt Learning Strategy},
  author={Kong, Xiangtao and Dong, Chao and Zhang, Lei},
  journal={arXiv preprint arXiv:2401.03379},
  year={2024}
}

🎫 License

This project is released under the Apache 2.0 license.

statistics

visitors

mioir's People

Contributors

xiangtaokong avatar

Stargazers

greywarden avatar  avatar  avatar Sugar Exterminator avatar Chen Zhao  avatar Jingbo Lin avatar  avatar Tang avatar House_Lee avatar Jifeng Wang avatar Oguzhan Mete Ozturk avatar  avatar universe avatar Keyeh avatar Hsüan hua avatar wgp avatar  avatar AlphaMeow(ฅ'ω'ฅ)~ avatar zhuyinghao avatar Bin Chen avatar  avatar Zhen Shen avatar Jhin avatar Zhicun Yin avatar BinRen avatar Jeff Carpenter avatar Nick Chen avatar XyChen avatar  avatar Zhiwen Yang avatar Daxing avatar  avatar  avatar Shiwei Wang avatar Xu Zhang avatar Minjie Chen avatar  avatar Kang Liao avatar LxDamon avatar  avatar Breeze. avatar ZYuhong avatar jiang xingbo avatar Chengyu Fang avatar opteroncx avatar Yunlong Lin avatar  avatar Di Wang avatar ZZSS avatar happy avatar Hang Guo avatar Yuandong Pu avatar  avatar  avatar Lingchen Sun avatar Rongyuan Wu avatar Yabin Zhang avatar Yuxiang Wei avatar  avatar

Watchers

刘国友 avatar  avatar  avatar  avatar

mioir's Issues

about the restormer-ep arch

According to the paper, it is stated that the prompt features would be injected solely into the encoder part of the U-Net-like structure. However, upon inspecting the restormer_ep code, it is observed that the prompt features are being injected into the decoder part instead. Why is that? Does injecting into the decoder part bring higher performance?

Request for Single-Task Pre-Trained Weights

image

It is really a wonderful work!

I noticed that the results in Table A.1 of the supplementary materials include the results of 7 single tasks. I am wondering if you could share the pre-training weights of the single-task model.

Considering there is a new benchmark on DF2K dataset with multiple degradation tasks, it would be of great help to my research and enable me to further analyze and study with these pre-trained weights.

If it is possible, I would be very grateful if you could provide the pre-training weights.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.