Retinexformer

Retinexformer: One-stage Retinex-based Transformer for Low-light Image Enhancement
ICCV 2023

Yuanhao Cai, Hao Bian, Jing Lin, Haoqian Wang, Radu Timofte, and Yulun Zhang

Paper β€’ ηŸ₯乎解读 β€’ Code and project documentation β€’ ICCV proceedings

Model description

Retinexformer enhances low-light images using a one-stage Retinex-based framework. It estimates illumination to brighten the input and restores image corruptions associated with low-light capture and amplification. An Illumination-Guided Transformer uses illumination features to guide interactions between regions with different lighting conditions.

This repository distributes PyTorch checkpoints for multiple datasets, together with NTIRE 2024 low-light enhancement checkpoints. Use the implementation and matching configuration from the linked GitHub repository.

NTIRE awards

NTIRE award certificate from the project repository NTIRE 2024 award certificate

Visual examples

Low-light enhancement examples

More qualitative comparisons, full-resolution examples, and interactive comparisons are available in the project README.

Available checkpoints

Checkpoint Architecture Dataset / setting Configuration in the code repository
LOL_v1.pth Retinexformer LOL-v1 Options/RetinexFormer_LOL_v1.yml
LOL_v2_real.pth Retinexformer LOL-v2-real Options/RetinexFormer_LOL_v2_real.yml
LOL_v2_synthetic.pth Retinexformer LOL-v2-synthetic Options/RetinexFormer_LOL_v2_synthetic.yml
SID.pth Retinexformer SID Options/RetinexFormer_SID.yml
SMID.pth Retinexformer SMID Options/RetinexFormer_SMID.yml
SDSD_indoor.pth Retinexformer SDSD-indoor Options/RetinexFormer_SDSD_indoor.yml
SDSD_outdoor.pth Retinexformer SDSD-outdoor Options/RetinexFormer_SDSD_outdoor.yml
FiveK.pth Retinexformer MIT-Adobe FiveK Options/RetinexFormer_FiveK.yml
NTIRE.pth Retinexformer NTIRE 2024 Options/RetinexFormer_NTIRE.yml
MST_Plus_Plus_NTIRE/MST_Plus_Plus_4x1800.pth MST++ NTIRE 2024, 4-GPU training Options/MST_Plus_Plus_NTIRE_4x1800.yml
MST_Plus_Plus_NTIRE/MST_Plus_Plus_8x1150.pth MST++ NTIRE 2024, 8-GPU training Options/MST_Plus_Plus_NTIRE_8x1150.yml

The two MST++ checkpoints require the MST++ architecture and their matching configurations; they cannot be loaded into Retinexformer. See the MST++ project for architecture background.

Getting started

1. Install the project

git clone https://github.com/caiyuanhao1998/Retinexformer.git
cd Retinexformer

Follow the project's environment setup to install PyTorch, dependencies, and the bundled BasicSR implementation. The project recommends PyTorch 1.11 for reproducing the ICCV 2023 results and PyTorch 2 for the NTIRE 2024 setting. The provided testing script uses CUDA.

2. Download model weights

Run from the Retinexformer code repository root:

pip install -U huggingface_hub
hf download CaiYuanhao/Retinexformer --include "*.pth" --local-dir pretrained_weights

To download only a specific checkpoint:

hf download CaiYuanhao/Retinexformer LOL_v1.pth --local-dir pretrained_weights

Retinexformer weights are saved directly in pretrained_weights/; MST++ weights are saved in pretrained_weights/MST_Plus_Plus_NTIRE/.

3. Evaluate on LOL-v1

Prepare the dataset using the project's dataset instructions, then run from the code repository root:

python Enhancement/test_from_dataset.py \
  --opt Options/RetinexFormer_LOL_v1.yml \
  --weights pretrained_weights/LOL_v1.pth \
  --dataset LOL_v1

This command assumes the dataset layout documented by the project. It is a dataset evaluation command, not a command for an arbitrary folder of photographs. For other datasets, select the corresponding checkpoint, YAML configuration, and dataset argument from the testing documentation.

Add --self_ensemble to enable the project's self-ensemble testing strategy. The testing implementation also provides an adaptive split-and-test strategy for high-resolution inputs.

Citation

@InProceedings{Cai_2023_ICCV,
    author    = {Cai, Yuanhao and Bian, Hao and Lin, Jing and Wang, Haoqian and Timofte, Radu and Zhang, Yulun},
    title     = {Retinexformer: One-stage Retinex-based Transformer for Low-light Image Enhancement},
    booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
    month     = {October},
    year      = {2023},
    pages     = {12504-12513}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Papers for CaiYuanhao/Retinexformer