Skip to content

dronefreak/clearview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

47 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐ŸŒง๏ธ ClearView: Neural Image Deraining

๐Ÿ Python 3.8+ ๐Ÿ”ฅ PyTorch 2.0+ โš–๏ธ License: Apache 2.0 ๐Ÿค— Demo

Fast, deployement-ready static image deraining model for autonomous driving, surveillance, and photo restoration.
30.9 PSNR / 0.914 SSIM on Rain1400 โ€ข ~15ms inference (RTX 4070) โ€ข L1 loss + vanilla UNet = best results


๐Ÿš€ Quick Start

Try Online

๐Ÿ‘‰ Live Demo on HuggingFace

Install & Run Locally

git clone https://github.com/dronefreak/clearview.git
cd clearview
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt && pip install -e .

Inference

clearview-infer --image rainy.jpg --weights clearview-unet.pth --output clean.jpg

Train

clearview-train \
  --data-dir /path/to/Rain1400 \
  --model unet --loss l1 --optimizer adamw --lr 1e-4 \
  --batch-size 24 --epochs 200 --dataset-type rain1400

๐Ÿ“Š Performance

Model PSNR SSIM Params Speed
UNet (L1) 30.91 0.914 7.8M ~15ms
Attention UNet 30.04 0.910 8.9M ~20ms

โœ… Key insight: L1 loss alone outperforms complex multi-loss combos.
โš ๏ธ Limitations: Trained on synthetic rain; slight texture smoothing.

Input vs Output โ†’
Derained


๐Ÿ—๏ธ Architecture Highlights

  • Backbone: Vanilla UNet (4 encoder/decoder blocks + skip connections)
  • Output: Sigmoid-bounded to [0,1]
  • Loss: Pixel-wise L1 (loss = L1(pred, target))
  • Why not attention? No measurable gainโ€”adds latency and params.

๐Ÿ“ฆ Pretrained Model

Download from Hugging Face:

from huggingface_hub import hf_hub_download
weights = hf_hub_download("dronefreak/clearview-unet", "clearview-unet.pth")

๐Ÿ”— Model Card


๐Ÿ“š Supported Datasets

  • Rain1400 (recommended): 12.6K train / 1.4K test
  • Rain100H/L: Heavy/light rain variants
  • Custom: Organize as train/{rainy_image,ground_truth}

๐Ÿ› ๏ธ Advanced Usage

  • Video: Frame-by-frame processing via scripts/video_demo.py (no temporal consistency yet)
  • Metrics: clearview-eval reports PSNR, SSIM, MAE, MSE
  • Training Tips:
    • Use mixed precision + gradient clipping
    • Early stopping (patience=50)
    • Avoid multi-component losses

๐Ÿ”ฎ Roadmap

  • Temporal consistency for video
  • Real-world rain dataset
  • Mobile deployment (ONNX/TensorRT)
  • Snow/fog/haze removal

๐Ÿค Contribute

PRs welcome! See CONTRIBUTING.md.
Need help? Open an Issue.


๐Ÿ“– Citation

@software{saksena2025clearview,
  author = {Saksena, Saumya Kumaar},
  title = {ClearView: Practical Image Deraining with PyTorch},
  year = {2025},
  url = {https://github.com/dronefreak/clearview}
}

License: Apache 2.0
Author: Saumya Kumaar Saksena (@dronefreak)