Update README.md
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
tags:
|
| 4 |
- image-dehazing
|
| 5 |
- image-restoration
|
|
@@ -8,58 +8,226 @@ tags:
|
|
| 8 |
- low-level-vision
|
| 9 |
- pytorch
|
| 10 |
pipeline_tag: image-to-image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# ED-Former
|
| 14 |
|
| 15 |
<div align="center">
|
| 16 |
|
| 17 |
-
[](https://
|
| 18 |
[](https://github.com/2697166190a-beep/ED-Former)
|
| 19 |
-
[](https://opensource.org/licenses/Apache-2.0)
|
| 20 |
|
| 21 |
</div>
|
| 22 |
|
| 23 |
-
Official
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
-
-
|
| 30 |
-
- **Ultra Lightweight & Fast**: Only **0.866 M** parameters and **7.36 G MACs** (evaluated on 256×256 input size).
|
| 31 |
-
- **State-of-the-Art Performance**: Achieves **38.21 dB PSNR** on SOTS-Indoor and **39.61 dB PSNR** on RS-Haze.
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
| **SOTS-outdoor (RESIDE-OUT)** | **33.92** | **0.9827** | [Download](./) |
|
| 43 |
-
| **RS-Haze** | **39.61** | **0.9715** | [Download](./) |
|
| 44 |
-
| **O-HAZE (zero-shot)** | **15.78** | **0.7020** | [Download](./) |
|
| 45 |
|
| 46 |
-
##
|
| 47 |
-
- **Parameters (#Params)**: `0.866 M`
|
| 48 |
-
- **Computational Cost (#MACs)**: `7.36 G` (for $256 \times 256$ input)
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: other
|
| 3 |
tags:
|
| 4 |
- image-dehazing
|
| 5 |
- image-restoration
|
|
|
|
| 8 |
- low-level-vision
|
| 9 |
- pytorch
|
| 10 |
pipeline_tag: image-to-image
|
| 11 |
+
datasets:
|
| 12 |
+
- RESIDE
|
| 13 |
+
- RS-Haze
|
| 14 |
+
- O-HAZE
|
| 15 |
+
metrics:
|
| 16 |
+
- psnr
|
| 17 |
+
- ssim
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# ED-Former
|
| 21 |
|
| 22 |
<div align="center">
|
| 23 |
|
| 24 |
+
[](https://doi.org/10.1016/j.image.2026.117634)
|
| 25 |
[](https://github.com/2697166190a-beep/ED-Former)
|
|
|
|
| 26 |
|
| 27 |
</div>
|
| 28 |
|
| 29 |
+
Official PyTorch implementation of **“ED-Former: Efficient Dehazing Transformer with Attention-Adaptive Feed-Forward Network”**, published in *Signal Processing: Image Communication* (2026).
|
| 30 |
|
| 31 |
+
[[Paper](https://doi.org/10.1016/j.image.2026.117634)] [[ScienceDirect](https://www.sciencedirect.com/science/article/pii/S0923596526001578)]
|
| 32 |
|
| 33 |
+
> Jinrong Chen, Yulin He, Xin Wang, Zhongyuan Guo, Jingtong Chen, Zhe Rao, and Yi Xiang, “ED-Former: Efficient dehazing transformer with Attention-Adaptive Feed-Forward Network,” *Signal Processing: Image Communication*, vol. 148, article 117634, 2026.
|
| 34 |
|
| 35 |
+
ED-Former is an extremely lightweight Transformer for single-image dehazing. It combines a Frequency-aware Hierarchical Sampler (FHS), an Attention-Adaptive Feed-Forward Network (AAFFN), and Hierarchical Invariance Loss (HILoss) to preserve high-frequency details while keeping the model below one million parameters.
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
## Highlights
|
| 38 |
|
| 39 |
+
- **Extremely lightweight:** 0.866 M parameters and 7.36 G MACs for a 256 × 256 input.
|
| 40 |
+
- **Frequency-aware Hierarchical Sampler (FHS):** uses wavelet-based decomposition and reconstruction to reduce information loss during feature resizing.
|
| 41 |
+
- **Attention-Adaptive Feed-Forward Network (AAFFN):** dynamically refines detail-rich features through a lightweight attention gate.
|
| 42 |
+
- **Hierarchical Invariance Loss (HILoss):** uses cosine scheduling to shift the training objective from perceptual structure toward pixel-wise fidelity.
|
| 43 |
+
- **Real-time inference:** 75.2 FPS at 256 × 256 on a single NVIDIA RTX 4060 Ti, as reported in the paper.
|
| 44 |
|
| 45 |
+
## Network architecture
|
| 46 |
|
| 47 |
+
<p align="center">
|
| 48 |
+
<img src="https://raw.githubusercontent.com/2697166190a-beep/ED-Former/main/figs/figchart.jpg" alt="ED-Former architecture" width="100%">
|
| 49 |
+
</p>
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
+
## Quantitative comparison
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
<p align="center">
|
| 54 |
+
<img src="https://raw.githubusercontent.com/2697166190a-beep/ED-Former/main/figs/Quantitative%20Comparison.png" alt="Quantitative comparison on dehazing benchmarks" width="100%">
|
| 55 |
+
</p>
|
| 56 |
+
|
| 57 |
+
| Dataset | PSNR | SSIM |
|
| 58 |
+
|:--|--:|--:|
|
| 59 |
+
| SOTS-indoor (RESIDE-IN) | **38.21** | **0.9942** |
|
| 60 |
+
| SOTS-outdoor (RESIDE-OUT) | **33.92** | **0.9827** |
|
| 61 |
+
| RS-Haze | **39.61** | **0.9715** |
|
| 62 |
+
| O-HAZE (zero-shot) | **15.78** | **0.702** |
|
| 63 |
+
|
| 64 |
+
The model has 0.866 M parameters and requires 7.36 G MACs for a 256 × 256 input.
|
| 65 |
+
|
| 66 |
+
## Qualitative comparison
|
| 67 |
+
|
| 68 |
+
<p align="center">
|
| 69 |
+
<a href="https://raw.githubusercontent.com/2697166190a-beep/ED-Former/main/figs/Qualitative%20Comparison.png">
|
| 70 |
+
<img src="https://raw.githubusercontent.com/2697166190a-beep/ED-Former/main/figs/Qualitative%20Comparison.png" alt="Qualitative comparison with state-of-the-art dehazing methods" width="100%">
|
| 71 |
+
</a>
|
| 72 |
+
</p>
|
| 73 |
+
|
| 74 |
+
Qualitative comparisons with state-of-the-art dehazing methods on indoor, outdoor, and real-world hazy images.
|
| 75 |
+
|
| 76 |
+
## Results
|
| 77 |
|
| 78 |
+
The benchmark summaries are included directly in this repository:
|
| 79 |
|
| 80 |
+
| Benchmark | Metric file | Dehazed images |
|
| 81 |
+
|:--|:--|:--|
|
| 82 |
+
| SOTS-indoor | [`results/RESIDE-IN/ed-former/38.21 \| 0.9942.csv`](https://github.com/2697166190a-beep/ED-Former/blob/main/results/RESIDE-IN/ed-former/38.21%20%7C%200.9942.csv) | `results/RESIDE-IN/ed-former/imgs/` |
|
| 83 |
+
| SOTS-outdoor | [`results/RESIDE-OUT/ed-former/33.92 \| 0.9827.csv`](https://github.com/2697166190a-beep/ED-Former/blob/main/results/RESIDE-OUT/ed-former/33.92%20%7C%200.9827.csv) | `results/RESIDE-OUT/ed-former/imgs/` |
|
| 84 |
+
| RS-Haze | [`results/RSHaze/ed-former/39.61 \| 0.9715.csv`](https://github.com/2697166190a-beep/ED-Former/blob/main/results/RSHaze/ed-former/39.61%20%7C%200.9715.csv) | `results/RSHaze/ed-former/imgs/` |
|
| 85 |
+
|
| 86 |
+
To keep the Git repository lightweight, the complete per-image outputs for all three benchmarks are packaged as `ED-Former-complete-results.tar.gz` in the [latest GitHub Release](https://github.com/2697166190a-beep/ED-Former/releases/latest). After running `test.py`, newly generated dehazed images and per-image metrics are saved under `results/<DATASET>/ed-former/` using the same layout.
|
| 87 |
+
|
| 88 |
+
### Runtime and complexity
|
| 89 |
+
|
| 90 |
+
Runtime was measured in the paper on a single NVIDIA RTX 4060 Ti with a 256 × 256 input.
|
| 91 |
+
|
| 92 |
+
| Method | Latency (ms) ↓ | FPS ↑ | Params (M) ↓ | MACs (G) ↓ |
|
| 93 |
+
|:--|--:|--:|--:|--:|
|
| 94 |
+
| GridDehazeNet | 15.3 | 65.2 | 0.956 | 21.49 |
|
| 95 |
+
| MSBDN | 19.9 | 50.2 | 31.35 | 41.54 |
|
| 96 |
+
| FFA-Net | 93.5 | 10.7 | 4.456 | 287.8 |
|
| 97 |
+
| DehazeFormer-s | 18.7 | 53.5 | 1.283 | 13.13 |
|
| 98 |
+
| Dehamer | 19.0 | 52.7 | 132.4 | 48.93 |
|
| 99 |
+
| **ED-Former** | **13.3** | **75.2** | **0.866** | **7.36** |
|
| 100 |
+
|
| 101 |
+
### Generalization to real-world haze
|
| 102 |
+
|
| 103 |
+
For O-HAZE, the checkpoint trained on RESIDE-OUT is evaluated directly without fine-tuning. ED-Former obtains **15.78 dB PSNR** and **0.702 SSIM**, demonstrating transfer from synthetic training data to real-world haze.
|
| 104 |
+
|
| 105 |
+
## Installation
|
| 106 |
+
|
| 107 |
+
The code is written in Python 3.7 and requires PyTorch. A CUDA-enabled GPU is required by the current testing script.
|
| 108 |
|
| 109 |
```bash
|
|
|
|
| 110 |
git clone https://github.com/2697166190a-beep/ED-Former.git
|
| 111 |
cd ED-Former
|
| 112 |
|
| 113 |
+
conda create -n edformer python=3.7 -y
|
| 114 |
+
conda activate edformer
|
| 115 |
pip install -r requirements.txt
|
| 116 |
|
| 117 |
+
PyTorch and CUDA versions depend on the local driver/toolkit. Install a Python 3.7-compatible PyTorch build that matches your CUDA environment by following the official PyTorch installation guide, then install the remaining packages from requirements.txt. You can record the resolved environment for reproducibility with pip freeze > environment-lock.txt.
|
| 118 |
+
|
| 119 |
+
## Data preparation
|
| 120 |
+
Download the datasets from their official/project sources:
|
| 121 |
+
|
| 122 |
+
RESIDE (ITS, OTS, and SOTS)
|
| 123 |
+
|
| 124 |
+
RS-Haze (provided by the DehazeFormer project)
|
| 125 |
+
|
| 126 |
+
O-HAZE
|
| 127 |
+
|
| 128 |
+
Please follow the licenses and terms of the respective datasets. Arrange paired hazy and ground-truth images as follows. A hazy image and its ground truth must have the same filename.
|
| 129 |
+
|
| 130 |
+
code
|
| 131 |
+
Text
|
| 132 |
+
data/
|
| 133 |
+
├── RESIDE-IN/
|
| 134 |
+
│ ├── train/
|
| 135 |
+
│ │ ├── hazy/
|
| 136 |
+
│ │ └── GT/
|
| 137 |
+
│ └── test/
|
| 138 |
+
│ ├── hazy/
|
| 139 |
+
│ └── GT/
|
| 140 |
+
├── RESIDE-OUT/
|
| 141 |
+
│ ├── train/
|
| 142 |
+
│ │ ├── hazy/
|
| 143 |
+
│ │ └── GT/
|
| 144 |
+
│ └── test/
|
| 145 |
+
│ ├── hazy/
|
| 146 |
+
│ └── GT/
|
| 147 |
+
└── RSHaze/
|
| 148 |
+
├── train/
|
| 149 |
+
│ ├── hazy/
|
| 150 |
+
│ └── GT/
|
| 151 |
+
└── test/
|
| 152 |
+
├── hazy/
|
| 153 |
+
└── GT/
|
| 154 |
+
## Pretrained models
|
| 155 |
+
The pretrained checkpoints are available at:
|
| 156 |
+
|
| 157 |
+
Training set Checkpoint SHA-256
|
| 158 |
+
RESIDE-ITS saved_models/indoor/ed-former.pth 98681f33d71031c1ef5a1db74da54e4d0a09b2a2f7a31867ebfe9b963cd570e5
|
| 159 |
+
RESIDE-OTS saved_models/outdoor/ed-former.pth ea7d7e3988ec98daea7b23f216bca7597fa987675c4ac7df5c001116459aef3a
|
| 160 |
+
RS-Haze saved_models/rshaze/ed-former.pth 43c4abab6cf5405da3fd01a5fa1424c0976ed1765371f8924b1a200efc60c07e
|
| 161 |
+
Verify a downloaded checkpoint with sha256sum saved_models/<experiment>/ed-former.pth.
|
| 162 |
+
|
| 163 |
+
## Testing
|
| 164 |
+
Run the command for the desired benchmark:
|
| 165 |
+
|
| 166 |
+
Bash
|
| 167 |
+
# SOTS-indoor
|
| 168 |
+
python test.py --model ed-former --dataset RESIDE-IN --exp indoor
|
| 169 |
+
|
| 170 |
+
# SOTS-outdoor
|
| 171 |
+
python test.py --model ed-former --dataset RESIDE-OUT --exp outdoor
|
| 172 |
+
|
| 173 |
+
# RS-Haze
|
| 174 |
+
python test.py --model ed-former --dataset RSHaze --exp rshaze
|
| 175 |
+
Dehazed images and a CSV file containing per-image PSNR/SSIM values are written to results/<DATASET>/ed-former/.
|
| 176 |
+
|
| 177 |
+
## Training
|
| 178 |
+
The experiment settings are stored in configs/indoor/ed-former.json, configs/outdoor/ed-former.json, and configs/rshaze/ed-former.json.
|
| 179 |
+
|
| 180 |
+
The paper reports training with a single NVIDIA A800 GPU, an Intel Xeon E-2436 CPU, and 64 GB RAM. All experiments use 256 × 256 patches, batch size 32, AdamW, an initial learning rate of 4e-4, and cosine annealing.
|
| 181 |
+
|
| 182 |
+
## Experiment Training set Epochs L1 schedule (start → end)
|
| 183 |
+
indoor RESIDE-ITS 300 0.1 → 1.0
|
| 184 |
+
outdoor RESIDE-OTS 30 0.5 → 0.9
|
| 185 |
+
rshaze RS-Haze 150 0.1 → 1.0
|
| 186 |
+
Bash
|
| 187 |
+
# RESIDE indoor
|
| 188 |
+
python train.py --model ed-former --dataset RESIDE-IN --exp indoor \
|
| 189 |
+
--lambda_l1_start 0.1 --lambda_l1_end 1.0
|
| 190 |
+
|
| 191 |
+
# RESIDE outdoor
|
| 192 |
+
python train.py --model ed-former --dataset RESIDE-OUT --exp outdoor \
|
| 193 |
+
--lambda_l1_start 0.5 --lambda_l1_end 0.9
|
| 194 |
+
|
| 195 |
+
# RS-Haze
|
| 196 |
+
python train.py --model ed-former --dataset RSHaze --exp rshaze \
|
| 197 |
+
--lambda_l1_start 0.1 --lambda_l1_end 1.0
|
| 198 |
+
These commands are also collected in run.sh.
|
| 199 |
+
|
| 200 |
+
## Repository structure
|
| 201 |
+
|
| 202 |
+
Text
|
| 203 |
+
ED-Former/
|
| 204 |
+
├── configs/ # Training configurations
|
| 205 |
+
├── figs/ # Architecture and comparison figures
|
| 206 |
+
├── results/ # Benchmark metric CSV files
|
| 207 |
+
├── saved_models/ # Pretrained checkpoints
|
| 208 |
+
├── ED_Former.py # Network definition
|
| 209 |
+
├── HierarchicalInvarianceLoss.py
|
| 210 |
+
├── loader.py # Paired image data loader
|
| 211 |
+
├── train.py
|
| 212 |
+
├── test.py
|
| 213 |
+
├── run.sh # Example training/testing commands
|
| 214 |
+
└── requirements.txt
|
| 215 |
+
## Citation
|
| 216 |
+
If this work is useful for your research, please cite:
|
| 217 |
+
|
| 218 |
+
Bibtex
|
| 219 |
+
@article{chen2026edformer,
|
| 220 |
+
title = {ED-Former: Efficient dehazing transformer with Attention-Adaptive Feed-Forward Network},
|
| 221 |
+
author = {Chen, Jinrong and He, Yulin and Wang, Xin and Guo, Zhongyuan and Chen, Jingtong and Rao, Zhe and Xiang, Yi},
|
| 222 |
+
journal = {Signal Processing: Image Communication},
|
| 223 |
+
volume = {148},
|
| 224 |
+
pages = {117634},
|
| 225 |
+
year = {2026},
|
| 226 |
+
doi = {10.1016/j.image.2026.117634}
|
| 227 |
+
}
|
| 228 |
+
Acknowledgements
|
| 229 |
+
Parts of this codebase are based on the DehazeFormer implementation. We sincerely thank Yuda Song, Zhuqing He, Hui Qian, and Xin Du for making their work publicly available. We also thank the authors and maintainers of the public datasets and other open-source projects used in this work.
|
| 230 |
+
|
| 231 |
+
## Contact
|
| 232 |
+
For technical questions, please open a GitHub issue.
|
| 233 |
+
|