Skip to content

gy65896/OneRestore

Repository files navigation

[ECCV 2024] OneRestore: A Universal Restoration Framework for Composite Degradation

ArXiv Web Hits


OneRestore: A Universal Restoration Framework for Composite Degradation
Yu Guo, Yuan Gao, Yuxu Lu, Huilin Zhu, Ryan Wen Liu* , Shengfeng He*
(† Co-first Author, * Corresponding Author)
European Conference on Computer Vision

Abstract: In real-world scenarios, image impairments often manifest as composite degradations, presenting a complex interplay of elements such as low light, haze, rain, and snow. Despite this reality, existing restoration methods typically target isolated degradation types, thereby falling short in environments where multiple degrading factors coexist. To bridge this gap, our study proposes a versatile imaging model that consolidates four physical corruption paradigms to accurately represent complex, composite degradation scenarios. In this context, we propose OneRestore, a novel transformer-based framework designed for adaptive, controllable scene restoration. The proposed framework leverages a unique cross-attention mechanism, merging degraded scene descriptors with image features, allowing for nuanced restoration. Our model allows versatile input scene descriptors, ranging from manual text embeddings to automatic extractions based on visual attributes. Our methodology is further enhanced through a composite degradation restoration loss, using extra degraded images as negative samples to fortify model constraints. Comparative results on synthetic and real-world datasets demonstrate OneRestore as a superior solution, significantly advancing the state-of-the-art in addressing complex, composite degradations.


News 🚀

  • 2024.07.20: New Website has been created.
  • 2024.07.10: Paper is released on ArXiv.
  • 2024.07.07: Code and Dataset are released.
  • 2024.07.02: OneRestore is accepted by ECCV2024.

Network Architecture

Quick Start

Install

  • python 3.7
  • cuda 11.7
# git clone this repository
git clone https://github.com/gy65896/OneRestore.git
cd OneRestore

# create new anaconda env
conda create -n onerestore python=3.7
conda activate onerestore 

# download ckpts
put embedder_model.tar and onerestore_cdd-11.tar in ckpts folder

# install pytorch (Take cuda 11.7 as an example to install torch 1.13)
pip install torch==1.13.0+cu117 torchvision==0.14.0+cu117 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117

# install other packages
pip install -r requirements.txt
pip install genism

Pretrained Models

Please download our pre-trained models and put them in ./ckpts.

Model Description
embedder_model.tar Text/Visual Embedder trained on our CDD-11.
onerestore_cdd-11.tar OneRestore trained on our CDD-11.
onerestore_real.tar OneRestore trained on our CDD-11 for Real Scenes.
onerestore_lol.tar OneRestore trained on LOL (low light enhancement benchmark).
onerestore_reside_ots.tar OneRestore trained on RESIDE-OTS (image dehazing benchmark).
onerestore_rain1200.tar OneRestore trained on Rain1200 (image deraining benchmark).
onerestore_snow100k.tar OneRestore trained on Snow100k-L (image desnowing benchmark).

Inference

We provide two samples in ./image for the quick inference:

python test.py --embedder-model-path ./ckpts/embedder_model.tar --restore-model-path ./ckpts/onerestore_cdd-11.tar --input ./image/ --output ./output/ --concat

You can also input the prompt to perform controllable restoration. For example:

python test.py --embedder-model-path ./ckpts/embedder_model.tar --restore-model-path ./ckpts/onerestore_cdd-11.tar --prompt low_haze --input ./image/ --output ./output/ --concat

Training

Prepare Dataset

We provide the download link of our Composite Degradation Dataset with 11 types of degradation (CDD-11).

Preparing the train and test datasets as follows:

./data/
|--train
|  |--clear
|  |  |--000001.png
|  |  |--000002.png
|  |--low
|  |--haze
|  |--rain
|  |--snow
|  |--low_haze
|  |--low_rain
|  |--low_snow
|  |--haze_rain
|  |--haze_snow
|  |--low_haze_rain
|  |--low_haze_snow
|--test

Train Model

  1. Train Text/Visual Embedder by
python train_Embedder.py --train-dir ./data/CDD-11_train --test-dir ./data/CDD-11_test --check-dir ./ckpts --batch 256 --num-workers 0 --epoch 200 --lr 1e-4 --lr-decay 50
  1. Remove the optimizer weights in the Embedder model file by
python remove_optim.py --type Embedder --input-file ./ckpts/embedder_model.tar --output-file ./ckpts/embedder_model.tar
  1. Generate the dataset.h5 file for training OneRestore by
python makedataset.py --train-path ./data/CDD-11_train --data-name dataset.h5 --patch-size 256 --stride 200
  1. Train OneRestore model by
python train_OneRestore.py --embedder-model-path ./ckpts/embedder_model.tar --save-model-path ./ckpts --train-input ./dataset.h5 --test-input ./data/CDD-11_test --output ./result/ --epoch 120 --bs 4 --lr 1e-4 --adjust-lr 30 --num-works 4
  1. Remove the optimizer weights in the OneRestore model file by
python remove_optim.py --type OneRestore --input-file ./ckpts/onerestore_model.tar --output-file ./ckpts/onerestore_model.tar

Performance

CDD-11

Real Scene

Controllability

Citation

@inproceedings{guo2024onerestore,
  title={OneRestore: A Universal Restoration Framework for Composite Degradation},
  author={Guo, Yu and Gao, Yuan and Lu, Yuxu and Liu, Ryan Wen and He, Shengfeng},
  booktitle={Proceedings of the European Conference on Computer Vision},
  year={2024}
}

If you have any questions, please get in touch with me ([email protected]).