🌙 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! 💡
conda create -n DP-Retinex python=3.8
conda activate DP-Retinex
🧊 Python 3.8 is recommended for compatibility.
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).
pip install -r requirements.txt
This includes packages like numpy
, opencv-python
, scikit-image
, tqdm
, etc.
python setup.py develop --no_cuda_ext
🔧 Use
--no_cuda_ext
to skip compiling CUDA ops (optional, for environments without NVCC or GPU).
DP-Retinex/
├── basicsr/ # Core image restoration framework (based on BasicSR)
├── Enhancement/ # Scripts for evaluation and inference (test_from_dataset.py, etc.)
├── Options/ # YAML configuration files for different datasets & experiments
├── pretrained_weights/ # (You should manually place downloaded model weights here)
├── data/ # (You should place LOLv1/LOLv2/SDSD datasets here)
├── requirements.txt # Python dependencies
├── setup.py # Package setup file for develop mode
└── README.md # You're here 😄
To evaluate our model, please download the LOLv1 and LOLv2 datasets from the following Google Drive link:
🔗 Download LOLv1 / LOLv2 Dataset (📁 Google Drive)
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 Google Drive folder:
🔗 Download Pretrained Weights (📁 Google Drive)
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.pth
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.pth
Real 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_real
Synthetic 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_syn
Indoor:
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_indoor
Outdoor:
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_outdoor
All 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.
- ❓ Missing NVCC? Try
--no_cuda_ext
as above. - 🧪 Test if PyTorch is installed with GPU:
import torch
print(torch.cuda.is_available())