Skip to content

tanvirnwu/SpikeRain

Repository files navigation

SpikeRain: Towards Energy-Efficient Single Image Deraining with Spiking Neural Networks [Paper]

Md Tanvir Islam 1, Inzamamul Alam 2, Sambit Bakshi 3, Khan Muhammad 2, *, Javier Del Ser 4, Sangtae Ahn 1, *
| 1. Kyungpook National University, South Korea | 2. Sungkyunkwan University, South Korea | 3. National Institute of Technology, India | 4. University of the Basque Country, Spain || *Corresponding Authors |

SpikeRain Architecture

Repository Structure

assets/
  figures/                 # Figures used in the paper/README
  paper/                   # Accepted paper PDF
model/
  modules.py               # Core blocks: DSRB, MDSA, Temporal Fusion, ARFE
  spikerain.py             # SpikeRain model definition and factory
utils/                     # Utility helpers (metrics, model utils, etc.)
dataset_loader.py          # Training dataset loader
train.py                   # Training script
test.py                    # Inference/testing script
evaluation.py              # PSNR/SSIM/LPIPS evaluation
requirements.txt           # Python dependencies

Environment Setup

Conda

conda create -n spikerain python=3.8 -y
conda activate spikerain
pip install -r requirements.txt

Dataset Preparation

The repository expects paired rainy/clean images stored in per-dataset folders. A recommended layout is:

data/
  Rain200H/
    train/
      input/
      gt/
    test/
      input/
      gt/

Naming conventions:

  • Input images are the rainy observations in input/.
  • Ground-truth images are the clean targets in gt/.
  • Supported image formats include .png and .jpg.

Important: dataset_loader.py expects the clean folder to be named target/ for training and validation. You can either:

  • Rename gt/target/, or
  • Create a symlink target pointing to gt.

RW-Data: This dataset has no ground truth. The provided evaluation.py requires paired targets, so for RW-Data use qualitative inspection or external no-reference metrics.

Training

The training script already exposes arguments via argparse. Example:

python train.py \
  --train_dir ./data/Rain200H/train \
  --val_dir ./data/Rain200H/test \
  --model_save_dir ./checkpoints \
  --version M \
  --T 4

Common arguments:

  • --train_dir: path to training set root (contains input/ and target/).
  • --val_dir: path to validation/test set root (contains input/ and target/).
  • --model_save_dir: output checkpoint directory.
  • --version: model size variant (S, M, L).
  • --T: number of spiking timesteps.

Testing / Inference

python test.py \
  --weights ./checkpoints/SpikeRain_M/models/<session>/model_best.pth \
  --data_path ./data/Rain200H/test/input \
  --save_path ./results/Rain200H

Key arguments:

  • --data_path: directory containing input rainy images.
  • --save_path: output directory for restored images.
  • --model_version: model size variant (S, M, L).
  • --T: number of spiking timesteps.

Evaluation

python evaluation.py \
  --generated_images_path ./results/Rain200H \
  --target_path ./data/Rain200H/test/gt

evaluation.py computes PSNR, SSIM, and LPIPS. For datasets without ground truth (e.g., RW-Data), skip this script or use no-reference metrics.

Reproducibility

The training script sets random seeds for Python, NumPy, and PyTorch. It also enables torch.backends.cudnn.benchmark = True, which favors performance over strict determinism.

Citation

If you find our work useful in your research, please consider citing our paper and star ✨✨ this repository. Thank you!

@InProceedings{Islam_2026_WACV,
    author    = {Islam, Md Tanvir and Alam, Inzamamul and Bakshi, Sambit and Muhammad, Khan and Del Ser, Javier and Ahn, Sangtae},
    title     = {SpikeRain: Towards Energy-Efficient Single Image Deraining with Spiking Neural Networks},
    booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
    month     = {March},
    year      = {2026},
    pages     = {1094-1105}
}

Acknowledgement

We would like to thank the authors of ESDNet for introducing SNN-based deraining.

About

SpikeRain is a method for Single Image Deraining, published in WACV 2026. SpikeRain is developed based on Spiking Neural Network.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages