🌙 DP-Retinex: Dual-Prior Guided Low-Light Image Enhancement with YUV-Domain Reflectance-Illumination Decomposition
Welcome to DP-Retinex! This repository provides a powerful, Retinex-theory-inspired image enhancement model built with PyTorch 🧠. Whether you're working on night-time photography, autonomous vision, or general low-level vision tasks, this toolkit is made for you! 💡
欢迎使用 DP-Retinex!本仓库提供了一个基于 Retinex 理论的强大图像增强模型,使用 PyTorch 构建 🧠。无论你是在做夜间摄影、自动驾驶视觉还是通用底层视觉任务,这个工具包都适合你!💡
To evaluate our model, please download the LOLv1 and LOLv2 datasets from the following links:
为了评估我们的模型,请从以下链接下载 LOLv1 和 LOLv2 数据集:
🔗 Google Drive | 谷歌云盘: Download LOLv1 / LOLv2 Dataset
🔗 Baidu Netdisk | 百度网盘: https://pan.baidu.com/s/11VeVUmJKovOJsYqS3v2Tkw
提取码 | Extraction Code: 9vph
Please place the datasets under: | 请将数据集放置在以下目录:
data/LOLv1/
data/LOLv2/We provide several pretrained models trained on different benchmarks. You can download all weights from the following links:
我们提供了在不同基准数据集上训练的多个预训练模型。你可以从以下链接下载所有权重:
🔗 Google Drive | 谷歌云盘: Download Pretrained Weights
🔗 Baidu Netdisk | 百度网盘: https://pan.baidu.com/s/11VeVUmJKovOJsYqS3v2Tkw
提取码 | Extraction Code: 9vph
Please organize them as: | 请按以下方式组织权重文件:
pretrained_weights/
│
├── LOLv1_best_psnr_23.48_109000.pth
├── LOLv2_real_best_psnr_23.49_47000.pth
├── LOLv2_syn_bet_psnr_26.30_229000.pth
├── SDSD_indoor_best_psnr_30.70_45000.pth
└── SDSD_outdoor_best_psnr_29.57_60000.pthconda create -n DP-Retinex python=3.8
conda activate DP-Retinex🧊 Python 3.8 is recommended for compatibility. | 推荐使用 Python 3.8 以确保兼容性。
pip install torch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117🚀 This installs PyTorch with CUDA 11.7 support (for GPU acceleration). | 这将安装支持 CUDA 11.7 的 PyTorch(用于 GPU 加速)。
pip install -r requirements.txtThis includes packages like numpy, opencv-python, scikit-image, tqdm, etc.
这包括 numpy、opencv-python、scikit-image、tqdm 等软件包。
python setup.py develop --no_cuda_ext🔧 Use
--no_cuda_extto skip compiling CUDA ops (optional, for environments without NVCC or GPU). | 使用--no_cuda_ext跳过 CUDA 算子编译(可选,适用于没有 NVCC 或 GPU 的环境)。
DP-Retinex/
├── basicsr/ # Core image restoration framework (基于 BasicSR 的核心图像恢复框架)
├── Enhancement/ # Evaluation and inference scripts (评估和推理脚本)
├── Options/ # YAML configuration files (YAML 配置文件)
├── pretrained_weights/ # Place downloaded model weights here (下载的模型权重放置于此)
├── data/ # Place datasets here (数据集放置于此)
├── requirements.txt # Python dependencies (Python 依赖)
├── setup.py # Package setup file (包安装文件)
└── README.md # You're here 😄 (你在这里 😄)
Once your environment is set up and models are downloaded, you can quickly run inference using the following commands:
环境设置完成并下载模型后,你可以使用以下命令快速运行推理:
python3 Enhancement/test_from_dataset.py \
--opt Options/Retinex_Degradation_LOL_v1.yml \
--weights pretrained_weights/LOLv1_best_psnr_23.48_109000.pthReal subset | 真实子集:
python3 Enhancement/test_from_dataset.py \
--opt Options/Retinex_Degradation_LOL_v2_real.yml \
--weights pretrained_weights/LOLv2_real_best_psnr_23.49_47000.pth \
--dataset LOL_v2_realSynthetic subset | 合成子集:
python3 Enhancement/test_from_dataset.py \
--opt Options/Retinex_Degradation_LOL_v2_syn.yml \
--weights pretrained_weights/LOLv2_syn_bet_psnr_26.30_229000.pth \
--dataset LOL_v2_synIndoor | 室内:
python3 Enhancement/test_from_dataset.py \
--opt Options/Retinex_Degradation_SDSD_indoorv2.yml \
--weights pretrained_weights/SDSD_indoor_best_psnr_30.70_45000.pth \
--dataset SDSD_indoorOutdoor | 室外:
python3 Enhancement/test_from_dataset.py \
--opt Options/Retinex_Degradation_SDSD_outdoorv2.yml \
--weights pretrained_weights/SDSD_outdoor_best_psnr_29.57_60000.pth \
--dataset SDSD_outdoorAll outputs will be saved under: | 所有输出将保存在:
results/
└── [DatasetName]/
└── Enhanced/
├── image_0001.png
├── ...
Each configuration file (*.yml) controls test resolution, padding mode, input/output paths, and model hyperparameters.
每个配置文件(*.yml)控制测试分辨率、填充模式、输入/输出路径和模型超参数。
- ❓ Missing NVCC? | 缺少 NVCC? Try
--no_cuda_extas above. | 尝试使用上面的--no_cuda_ext。 - 🧪 Test if PyTorch is installed with GPU | 测试 PyTorch 是否支持 GPU:
import torch
print(torch.cuda.is_available())For questions or issues, please open an issue on GitHub or contact us via email.
如有问题,请在 GitHub 上提交 issue 或通过电子邮件联系我们。
If you find this work useful, please consider citing our paper:
如果你觉得这项工作有用,请考虑引用我们的论文:
@ARTICLE{11339941,
author={Zhao, Zhengkai and Gao, Longmi and Gao, Pan and Qin, Jie},
journal={IEEE Transactions on Circuits and Systems for Video Technology},
title={DP-Retinex: Dual-Prior Guided Low-Light Image Enhancement with YUV-Domain Reflectance-Illumination Decomposition},
year={2026},
volume={},
number={},
pages={1-1},
keywords={Image color analysis;Lighting;Image enhancement;Feature extraction;Transformers;Image restoration;Reflectivity;Nonlinear distortion;Diffusion models;Degradation;Low-Light Image Enhancement;Dual Priors;YUV Color Space;Diffusion-Transformer Hybrid},
doi={10.1109/TCSVT.2026.3651859}}
This project is licensed under the MIT License.
本项目采用 MIT 许可证。