MCPcopy Create free account
hub / github.com/FZU-N/URWKV

github.com/FZU-N/URWKV @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
347 symbols 838 edges 44 files ⚖ Apache-2.0 18 documented · 5% ● updated 2mo ago★ 3810 open issues

Browse by type

⨍ Functions 288◇ Types & classes 59
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

URWKV: Unified RWKV Model with Multi-state Perspective for Low-light Image Restoration

📢 This paper has been accepted to CVPR 2025! 🎉

Main Paper | Supplementary Materials | Poster

Weights and Results

All released resources are collected in the following Baidu Pan archives:

  • Results: Download (extraction code: kn23).

  • In addition, results of the comparison method BiFormer are available on Baidu Pan (extraction code: ssfh).

  • Weights: Download (extraction code: 5ady)

  • Datasets: Download (extraction code: 2x5i)

Quick overview of URWKV's performance across benchmark datasets:

Metric LOL-v1 LOL-v2-real LOL-v2-sync SID SMID SDSD-indoor SDSD-outdoor MIT-Adobe FiveK LOL-blur
PSNR 24.27 23.11 26.36 23.11 29.44 31.24 29.99 26.08 27.27
SSIM 0.856 0.874 0.944 0.673 0.826 0.911 0.887 0.936 0.890

⚠️ Missing weights: The pretrained weights for SMID and MIT-Adobe FiveK were accidentally overwritten and are currently unavailable. You can retrain these models using the provided configurations. We will update this section if the weights are recovered or retrained.

Abstract

Existing low-light image enhancement (LLIE) and joint LLIE and deblurring (LLIE-deblur) models have made strides in addressing predefined degradations, yet they are often constrained by dynamically coupled degradations. To address these challenges, we introduce a Unified Receptance Weighted Key Value (URWKV) model with multi-state perspective, enabling flexible and effective degradation restoration for low-light images. Specifically, we customize the core URWKV block to perceive and analyze complex degradations by leveraging multiple intra- and inter-stage states. First, inspired by the pupil mechanism in the human visual system, we propose Luminance-adaptive Normalization (LAN) that adjusts normalization parameters based on rich inter-stage states, allowing for adaptive, scene-aware luminance modulation. Second, we aggregate multiple intra-stage states through exponential moving average approach, effectively capturing subtle variations while mitigating information loss inherent in the single-state mechanism. To reduce the degradation effects commonly associated with conventional skip connections, we propose the State-aware Selective Fusion (SSF) module, which dynamically aligns and integrates multi-state features across encoder stages, selectively fusing contextual information. In comparison to state-of-the-art models, our URWKV model achieves superior performance on various benchmarks, while requiring significantly fewer parameters and computational resources.

Overview

Main Results

Consistent with BiFormer, results are measured using measure_pair.py. It should be noted that all metrics in our method are computed in the sRGB space, and no GT Mean-related techniques are applied.

To ensure fairness, if a comparison method does not provide pretrained weights, we retrain it using the recommended settings provided by the authors. Otherwise, we use the officially released pretrained weights for evaluation. All results are evaluated using a unified script, measure_pair.py. In this paper, the following methods were retrained: SNR-Net, FourLLIE, UHDFour, LLFormer, Retinexformer, BiFormer, RetinexMamba, LEDNet, PDHAT, MIRNet, Restormer, and MambaIR.

Environment Setup

1. Create and Activate a Conda Environment

conda create --name URWKV python=3.9
conda activate URWKV 

2. Install PyTorch and Dependencies

Install PyTorch with CUDA 11.3 support:

conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3 -c pytorch

Install cuDNN:

conda install cudnn

3. Install Python Dependencies

pip install pyyaml yacs tqdm colorama pandas natsort  
pip install matplotlib tensorboardX 
pip install cython thop prefetch_generator 
pip install opencv-python scikit-image  
pip install timm einops mmcls 
pip install pytorch_msssim IQA_pytorch pyiqa lpips
pip install numpy==1.26.4

4. Install MMCV

pip install -U openmim
mim install mmcv==1.7.1

⚠️ Note: If you encounter an error related to Ninja while compiling C++ extensions (e.g., Ninja is required to load C++ extensions), install Ninja with: sudo apt-get install ninja-build

🔧 Training Notes

  • Training stability: Instability observed in some training runs may be related to the CUDA environment or version compatibility. The cause has not yet been confirmed, and this issue remains under investigation.

  • Hyperparameter tuning: Since we haven't done extensive hyperparameter tuning, you are encouraged to explore better configurations to potentially improve performance.

Citation

If you find this work useful for your research, please cite:

@inproceedings{xu2025urwkv,
  title={URWKV: Unified RWKV Model with Multi-state Perspective for Low-light Image Restoration},
  author={Xu, Rui and Niu, Yuzhen and Li, Yuezhou and Xu, Huangbiao and Liu, Wenxi and Chen, Yuzhong},
  booktitle={Proceedings of the Computer Vision and Pattern Recognition Conference},
  pages={21267--21276},
  year={2025}
}

License

This repository is released under the Apache 2.0 license as found in the LICENSE file.

Acknowledgement

URWKV is built with reference to the code of the following projects: RWKV, Vision-RWKV, and BiFormer. Thanks for their awesome work!

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 185
Function 103
Class 59

Languages

Python99%
C++1%

Modules by API surface

custom_utils/visdom.py61 symbols
model/modules/urwkv.py29 symbols
custom_utils/lr_scheduler.py23 symbols
custom_utils/losses.py20 symbols
model/loss.py19 symbols
tools/measure.py16 symbols
custom_utils/data_loaders/lol.py15 symbols
custom_utils/image_utils.py12 symbols
model/modules/SSF.py11 symbols
custom_utils/metrics/niqe.py11 symbols
custom_utils/model_utils.py9 symbols
custom_utils/data_loaders/mit5k.py8 symbols

For agents

$ claude mcp add URWKV \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page