ClearView: Image Deraining with NAFNet Large (Mixed-Domain)
The largest NAFNet [8] (nonlinear activation free network) variant, trained on a blended synthetic + real-world rain set, selecting checkpoints against a blended real-world validation metric rather than a single benchmark, for a model that holds up across domains instead of maxing out one dataset's quirks. Not a mirror of someone else's checkpoint, see Citation.
Quickstart
Requires the ClearView library:
pip install git+https://github.com/dronefreak/clearview.git
from clearview.api import DerainingModel
from huggingface_hub import hf_hub_download
weights = hf_hub_download(repo_id="dronefreak/clearview-derain-nafnet-large", filename="clearview-derain-nafnet-large.pth")
model = DerainingModel.from_pretrained("nafnet_large", weights=weights)
clean = model.process("rainy_image.png", output_path="derained.png")
Training Data
5 sources combined via ClearView's --mix-config (recipe), oversampling the real-world sources 2x:
| Source | Type | Weight | Pairs |
|---|---|---|---|
| Rain13K [1] | Synthetic | 1.0 | 13,711 |
| DDN-Data / Rain1400 [4] | Synthetic | 1.0 | 12,600 |
| SPA-Data [5] | Real-world | 2.0 | 6,385 |
| RealRain-1k-H [6] | Real-world | 2.0 | 784 |
| RealRain-1k-L [6] | Real-world | 2.0 | 784 |
~62% synthetic / ~38% real by effective sampling weight (before oversampling: ~77%/23% by raw pair count).
Checkpoint selection uses a separate blended validation set (recipe): SPA-Data val (capped to 150 of 1,000 pairs so it can't dominate), RealRain-1k-H/L validation (112 each), and Rain100L (100) as a synthetic sanity anchor.
Detailed Test-Set Metrics
Full per-dataset breakdown across all 6 tracked metrics, computed on each source's own held-out test/eval split (not the blended validation set used for checkpoint selection during training).
| Test Set | Domain | PSNR | SSIM | MAE | MSE | Rain Removal Rate | NIQE |
|---|---|---|---|---|---|---|---|
| Rain100L [2] | Synthetic | 34.59 | 0.961 | 0.0109 | 0.00047 | 0.498 | 9.64 |
| Rain100H [2] | Synthetic | 27.65 | 0.856 | 0.0293 | 0.00227 | 0.750 | 10.95 |
| Test100 [3] | Synthetic | 27.71 | 0.865 | 0.0376 | 0.00307 | 0.509 | 9.96 |
| Test1200 [3] | Synthetic | 31.37 | 0.898 | 0.0219 | 0.00109 | 0.492 | 7.40 |
| Test2800 [4] | Synthetic | 31.75 | 0.924 | 0.0191 | 0.00075 | 0.470 | 795.14 |
| DDN-Data [4] | Synthetic | 31.90 | 0.927 | 0.0189 | 0.00075 | 0.459 | 991.81 |
| SPA-Data [5] | Real-world | 41.99 | 0.986 | 0.0047 | 0.00025 | 0.558 | 6.30 |
| RealRain-1k-H [6] | Real-world | 39.34 | 0.982 | 0.0085 | 0.00039 | 0.806 | 4.29 |
| RealRain-1k-L [6] | Real-world | 41.17 | 0.987 | 0.0067 | 0.00023 | 0.755 | 4.51 |
| AllWeather (rain+fog) [7] | Cross-domain (stress) | 13.53 | 0.576 | 0.1924 | 0.05688 | 0.126 | 231.98 |
Metric definitions:
- PSNR (Peak Signal-to-Noise Ratio, dB): pixel-level fidelity between the restored output and ground truth. Higher is better. The standard image-restoration metric, but insensitive to structural/perceptual quality on its own.
- SSIM (Structural Similarity Index, 0-1): perceptual similarity based on luminance, contrast, and structure. Higher is better, tracks human-perceived quality more closely than PSNR.
- MAE (Mean Absolute Error, normalized [0,1] pixel space): average per-pixel absolute intensity difference. Lower is better, less sensitive to outlier pixels than MSE.
- MSE (Mean Squared Error, normalized [0,1] pixel space): average per-pixel squared intensity difference, the term PSNR is derived from. Lower is better, penalizes large errors more heavily than MAE.
- Rain Removal Rate: ClearView-specific metric. Compares the Sobel-gradient ("high-frequency") residual energy of the output vs. ground truth against that of the input vs. ground truth:
1 - (residual after) / (residual before).1.0means perfect rain removal,0.0means no change, negative means the model added more high-frequency error than it removed (e.g. hallucinated detail or over-sharpening). Higher is better. - NIQE (Natural Image Quality Evaluator): no-reference perceptual quality score. Its pristine reference statistics are refit per test set from that set's own clean images, so NIQE values are only comparable within the same row, not across rows, a NIQE of 800 on one dataset and 10 on another does not mean one output is 80x worse, the reference scale itself differs per dataset. Lower is better within a given row.
ClearView Model Comparison
How this model compares to the rest of the ClearView model zoo (PSNR / SSIM), same test sets and evaluation protocol for every model.
| Test Set | Domain | Restormer | UNet (Vanilla) | NAFNet (Small) | NAFNet (Mid) | NAFNet (Large) | ResNet34-UNet | Histoformer |
|---|---|---|---|---|---|---|---|---|
| Rain100L [2] | Synthetic | 35.04 / 0.962 | 30.96 / 0.932 | 30.20 / 0.922 | 34.14 / 0.957 | 34.59 / 0.961 | 29.00 / 0.894 | 25.83 / 0.836 |
| Rain100H [2] | Synthetic | 27.87 / 0.856 | 26.41 / 0.823 | 25.02 / 0.763 | 27.72 / 0.849 | 27.65 / 0.856 | 24.67 / 0.774 | 12.22 / 0.364 |
| Test100 [3] | Synthetic | 27.34 / 0.869 | 24.91 / 0.836 | 25.26 / 0.820 | 27.96 / 0.873 | 27.71 / 0.865 | 26.38 / 0.839 | 22.01 / 0.684 |
| Test1200 [3] | Synthetic | 31.38 / 0.897 | 29.08 / 0.868 | 30.43 / 0.874 | 31.28 / 0.898 | 31.37 / 0.898 | 28.19 / 0.852 | 24.20 / 0.727 |
| Test2800 [4] | Synthetic | 31.78 / 0.924 | 30.61 / 0.909 | 30.58 / 0.906 | 31.66 / 0.923 | 31.75 / 0.924 | 28.31 / 0.875 | 24.71 / 0.785 |
| DDN-Data [4] | Synthetic | 31.97 / 0.928 | 30.67 / 0.912 | 30.83 / 0.910 | 31.84 / 0.926 | 31.90 / 0.927 | 28.47 / 0.879 | 25.04 / 0.784 |
| SPA-Data [5] | Real-world | 42.53 / 0.986 | 39.01 / 0.980 | 37.13 / 0.973 | 41.77 / 0.986 | 41.99 / 0.986 | 36.97 / 0.971 | 32.18 / 0.929 |
| RealRain-1k-H [6] | Real-world | 38.68 / 0.982 | 35.98 / 0.971 | 34.33 / 0.957 | 38.68 / 0.980 | 39.34 / 0.982 | 35.21 / 0.969 | 21.86 / 0.761 |
| RealRain-1k-L [6] | Real-world | 40.90 / 0.987 | 38.04 / 0.980 | 36.59 / 0.970 | 40.64 / 0.986 | 41.17 / 0.987 | 36.88 / 0.977 | 25.47 / 0.867 |
| AllWeather (rain+fog) [7] | Cross-domain (stress) | 13.67 / 0.583 | 13.66 / 0.570 | 13.59 / 0.574 | 13.64 / 0.579 | 13.53 / 0.576 | 13.54 / 0.558 | 30.75 / 0.923 |
All ClearView models trained under the identical mixed-domain recipe, only batch size/accumulation steps vary per architecture size. Histoformer is included as an external, inference-only reference point (original authors' checkpoint, not trained under this recipe), its strong AllWeather (rain+fog) score and comparatively weak scores on the rain-only test sets reflect that it was trained on a rain+fog+snow mix, while ClearView's current mix is rain-only.
Use Cases
Good for: dashcam/surveillance footage, photo restoration, real-world rain (not just synthetic-style streaks), use cases where the largest available capacity in the NAFNet family is worth the extra compute.
Limitations: no temporal consistency for video (processes frames independently); AllWeather rain+fog is an explicit out-of-scope stress test, fog was not in the training mix and this model is not expected to handle it; largest and slowest NAFNet variant here, needs a GPU with meaningfully more VRAM than the smaller variants.
Training
clearview-train --model nafnet_large --mix-config configs/mix/rain_mixed_synthetic_real.yaml --mix-sampler \
--val-mix-config configs/mix/rain_mixed_val.yaml --loss custom --loss-config '{"charbonnier": {"weight": 1.0}}' \
--crop-size 256 --batch-size 16 --accumulation-steps 1 --epochs 100 --mixed-precision --ema --compile \
--output-dir ./runs/rain_mixed_nafnet_large
Training Curves
Citation
@software{saksena2025clearview,
author = {Saksena, Saumya Kumaar},
title = {ClearView: Practical Image Deraining},
year = {2025},
url = {https://github.com/dronefreak/clearview}
}
Architecture and datasets this model builds on:
References
- Fu et al. and others, Rain13K composite (Rain800/Rain100H/L/Rain14000/Rain12), standard MPRNet/Restormer training set.
- Yang et al., Deep Joint Rain Detection and Removal from a Single Image, CVPR 2017 (Rain100H/L).
- Zhang & Patel / Zhang, Sindagi & Patel (Test100 / Test1200).
- Fu et al., Removing Rain from Single Images via a Deep Detail Network, CVPR 2017 (DDN-Data / Rain1400 / Test2800).
- Wang et al., Spatial Attentive Single-Image Deraining with a High Quality Real Rain Dataset, CVPR 2019 (SPA-Data).
- Li et al., RealRain-1k, arXiv:2206.05514, 2022.
- Li et al., Heavy Rain Image Restoration, CVPR 2019 (AllWeather rain+fog / Outdoor-Rain).
- Chen, Chu, Zhang & Sun, Simple Baselines for Image Restoration, ECCV 2022, arXiv:2204.04676 (this model's architecture).
Full bibtex for each: main repo README.
Model Card Authors / Contact
Saumya Kumaar Saksena, GitHub Issues
- Downloads last month
- -