[CVPR 2025] Learning Hazing to Dehazing: Towards Realistic Haze Generation for Real-World Image Dehazing 🔗
This repository presents the implementation of the paper
Learning Hazing to Dehazing: Towards Realistic Haze Generation for Real-World Image Dehazing
Ruiyi Wang, Yushuo Zheng, Zicheng Zhang, Chunyi Li, Shuaicheng Liu, Guangtao Zhai, Xiaohong Liu
The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2025
We present a novel hazing-dehazing pipeline consisting of a Realistic Hazy Image Generation framework (HazeGen) and a Diffusion-based Dehazing framework (DiffDehaze).
Clone the repository (requires git):
git clone https://github.com/ruiyi-w/Learning-Hazing-to-Dehazing.git
cd Learning-Hazing-to-DehazingUsing Conda. After the installation, create the environment and install dependencies into it:
conda create -n env_name python=3.10
conda activate env_name
pip install -r requirements.txtKeep the environment activated before running the inference script. Activate the environment again after restarting the terminal session.
Place your images in the inputs/ directory. To set a different source directory, you can edit configuration files in configs/inference/.
Download pre-trained models and place them to folder weights/, but you can always edit configuration files in configs/inference/.
| Model Name | Description | Link |
|---|---|---|
| v2-1_512-ema-pruned.ckpt | Pretrained Stable Diffusion v2.1 from stabilityai, providing generative priors | download |
| stage1.pt | IRControlNet trained for HazeGen | download |
| stage2.pt | IRControlNet trained for DiffDehaze | download |
To perform dehazing with standard spaced sampler, please run
python inference_stage2.py --config configs/inference/stage2.yamlBy default, results will be saved to outputs/. Enjoy!
To perform dehazing with AccSamp sampler, please run
python inference_accsamp.py --config configs/inference/stage2_accsamp.yamlTo generate realisitic hazy images with HazeGen, please run
python inference_stage1.py --config configs/inference/stage1.yamlTo use a different hyperparameter settings, e.g., .yaml configuration file.
-
Training data preparation.
- The training of HazeGen requires real-world hazy data from the URHI split of RESIDE dataset and the synthetic hazy data from RIDCP.
- To train DiffDehaze, you need to generate realistic hazy data from HazeGen based on clean images, e.g., the clean images from the OTS split of RESIDE dataset, using the inference script above.
-
Accelerate configuration. The training is supported by the huggingface Accelerate library. Before running training scripts, create and save a configuration file to help Accelerate correctly set up training based on your setup by running
accelerate config- Fill in the training configuration files in
configs/train/with appropriate values, especially for the paths to the training data. Please find specific instructions there. - Start training! To train stage1 HazeGen model, run
accelerate launch train_stage1.py --config configs/train/stage1.yaml- To train stage2 DiffDehaze model, run
accelerate launch train_stage2.py --config configs/train/stage2.yamlA large part of the implementation is based on DiffBIR. We sincerely appreciate their wonderful work.
If you find our work useful, please consider cite our paper:
@misc{wang2025learninghazingdehazingrealistic,
title={Learning Hazing to Dehazing: Towards Realistic Haze Generation for Real-World Image Dehazing},
author={Ruiyi Wang and Yushuo Zheng and Zicheng Zhang and Chunyi Li and Shuaicheng Liu and Guangtao Zhai and Xiaohong Liu},
year={2025},
eprint={2503.19262},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2503.19262},
}This work is licensed under the Apache License, Version 2.0 (as defined in the LICENSE).
By downloading and using the code and models you agree to the terms in the LICENSE.

