https://github.com/W-Jilly/frequency-compensated-diffusion-model-pytorch
https://github.com/W-Jilly/frequency-compensated-diffusion-model-pytorch
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/W-Jilly/frequency-compensated-diffusion-model-pytorch
- Owner: W-Jilly
- Created: 2023-09-22T03:54:29.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T11:27:50.000Z (over 1 year ago)
- Last Synced: 2024-08-01T18:31:19.402Z (over 1 year ago)
- Language: Python
- Size: 3.42 MB
- Stars: 27
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-diffusion-categorized - [Code
README
Frequency Compensated Diffusion Model for Real-scene Dehazing
This is an official implementation of **Frequency Compensated Diffusion Model for Real-scene Dehazing** by **Pytorch**.

## News
- 2025.03 We release a more powerful dehazing diffusion model [ProHaze](https://github.com/TianwenZhou/ProDehaze) based on SD-2.1.
## Getting started
### Installation
* This repo is a modification on the [**SR3 Repo**](https://github.com/Janspiry/Image-Super-Resolution-via-Iterative-Refinement ).
* Install third-party libraries.
```python
pip install -r requirement.txt
```
### Data Prepare
Download train/eval data from the following links:
Training: [*RESIDE*](https://sites.google.com/view/reside-dehaze-datasets/reside-v0)
Testing:
[*I-Haze*](https://data.vision.ee.ethz.ch/cvl/ntire18//i-haze/#:~:text=To%20overcome%20this%20issue%20we%20introduce%20I-HAZE%2C%20a,real%20haze%20produced%20by%20a%20professional%20haze%20machine.) /
[*O-Haze*](https://data.vision.ee.ethz.ch/cvl/ntire18/o-haze/) /
[*Dense-Haze*](https://arxiv.org/abs/1904.02904#:~:text=To%20address%20this%20limitation%2C%20we%20introduce%20Dense-Haze%20-,introducing%20real%20haze%2C%20generated%20by%20professional%20haze%20machines.) /
[*Nh-Haze*](https://data.vision.ee.ethz.ch/cvl/ntire20/nh-haze/) /
[*RTTS*](https://sites.google.com/view/reside-dehaze-datasets/reside-standard?authuser=0)
```python
mkdir dataset
```
Re-organize the train/val images in the following file structure:
```shell
#Training data file structure
dataset/RESIDE/
├── HR # ground-truth clear images.
├── HR_hazy_src # hazy images.
└── HR_depth # depth images (Generated by MonoDepth (github.com/OniroAI/MonoDepth-PyTorch)).
#Testing data (e.g. DenseHaze) file structure
dataset/{name}/
├── HR # ground-truth images.
└── HR_hazy # hazy images.
```
then make sure the correct data paths ("dataroot") in config/framework_da.json.
## Pretrained Model
We prepared the pretrained model at:
| Type | Weights |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Generator | [OneDrive](https://1drv.ms/u/s!AsqtTP8eWS-penA8AqrU8c_I4jU) |
## Evaluation
Download the test set (e.g O-Haze). Simply put the test images in "dataroot" and set the correct path in config/framework_da.json about "dataroot";
Download the pretrained model and set the correct path in config/framework_da.json about "resume_state":
```json
"path": {
"log": "logs",
"tb_logger": "tb_logger",
"results": "results",
"checkpoint": "checkpoint",
"resume_state": "./ddpm_fcb_230221_121802"
}
"val": {
"name": "dehaze_val",
"mode": "LRHR",
"dataroot": "dataset/O-HAZE-PROCESS",
...
}
```
```python
# infer
python infer.py -c [config file]
```
The default config file is config/framework_da.json. The outputs images are located at /data/diffusion/results. One can change output path in core/logger.py.
### Train
Prepare train dataset and set the correct paths in config/framework_da.json about "datasets";
If training from scratch, make sure "resume_state" is null in config/framework_da.json.
```python
# infer
python train.py -c [config file]
```
## Results
Quantitative comparison on real-world hazy data (RTTS). Bold and underline indicate the best and the second-best, respectively.
## Todo
- [x] Upload configs and pretrained models
- [x] Upload evaluation scripts
- [x] Upload train scripts