A Lightweight Low-Light Image Enhancement Network via Channel Prior and Gamma Correction

July 20, 2025 · View on GitHub

This is the implementation of CPGA-Net based on Pytorch.
Journal Paper (Accept, IJPRAI) A Lightweight Low-Light Image Enhancement Network via Channel Prior and Gamma Correction
Conference Paper (IEEE ICCE-TW) Exposure Correction in Driving Scenes Using the Atmospheric Scattering Model

News

  • 2025/07/21 Accepted by International Journal of Pattern Recognition and Artificial Intelligence (IJRAI)
  • 2024/02/29 Preprint released
  • 2023/11/17 Upload repository

Preparation

  1. clone the project
  2. install Pytorch
  3. execute the following instruction:
// python=3.8
pip install -r requirements.txt
  1. make sure these modules have been successfully installed

Structure

Details

Usage

Data Preparation

Prepare your data, split it into Low-Light images and Normal Light images, both image folder should be paired and the same pair of images should be have the same name. It should be almost the same as original listing way.

Train

The training of CPGA-DGF (DGF) with knowledge distillation is not available in current version.

python train.py  \
    "--epochs" 10" , \
    "--net_name" YOUR_NETNAME" , \
    "--lr" 1e-4",

    "--num_workers" 2" , \
    "--batch_size" 16" , \
    "--val_batch_size" 1" , \

    "--model_dir" ,"./models" , \
    "--log_dir" ./logs", \
    "--sample_output_folder" ./samples/", \

    "--ori_data_path" LOL_TRAIN_HIGH", \
    "--haze_data_path" LOL_TRAIN_LOW", \
    "--val_ori_data_path" LOL_TEST_HIGH" , \
    "--val_haze_data_path" LOL_TEST_LOW" , \
    "--dataset_type" LOL-v1", \

    "--ckpt" weights/enhance_color-llie-ResCBAM_g.pkl" 

    "--efficient" //DGF version

Demo

python demo_enhanced.py \
     "--net_name" YOUR_NETNAME" , \

    "--val_ori_data_path" LOL_TEST_HIGH" , \
    "--val_haze_data_path" LOL_TEST_LOW" , \
    "--dataset_type" LOL-v1", \
    
    "--num_workers" 1" , \ 
    "--val_batch_size" 1" , \ 

    "--ckpt" weights/enhance_color-llie-ResCBAM_g.pkl" 

    "--efficient" //DGF version

Demo Video

python demo_enhanced_video.py \

    "--output_name" OUTPUT_PATH", \
    "--video_dir" VIDEO_PATH_or_IMAGE_SEQ_DIR" , \
    "--num_workers" 0" , \
    "--val_batch_size" 1", \

    "--ckpt" weights/enhance_color-llie-ResCBAM_g.pkl" 

Evaluation

python evaluation.py \
    "--dirA" DIR_A", \
    "--dirB" DIR_B"

Dataset Selection

For LOLv2

    "--ori_data_path" LOLv2_PATH", \
    "--haze_data_path" LOLv2_PATH", \
    "--val_ori_data_path" LOLv2_PATH", \
    "--val_haze_data_path" LOLv2_PATH", \
    
    "--dataset_type" LOL-v2-real", //"LOL-v2-real" or "LOL-v2-Syn"

For Exposure Error Dataset (Training)

    "--ori_data_path" TRAIN_GT_IMAGES", \
    "--haze_data_path" TRAIN_INPUT_IMAGES", \
    "--val_ori_data_path" VAL_GT_IMAGES", \
    "--val_haze_data_path" VAL_INPUT_IMAGES", \
    
    "--dataset_type" expe",

For Exposure Error Dataset (Demo)

    "--val_ori_data_path" INPUT_IMAGES_PATH", \
    "--val_haze_data_path" INPUT_IMAGES_PATH", \
    
    "--dataset_type" LOL-v1",

For Unpaired Dataset (DEMO: LIME, MEF, DICM, NPE, VV)

    "--val_ori_data_path" Unpaired_PATH" , \
    "--val_haze_data_path" Unpaired_PATH" , \
    
    "--dataset_type" LOL-v1",

For your custom images dir (Demo)

    "--val_ori_data_path" /mnt/d/datasets/exposure error/testing/INPUT_IMAGES",\
    "--val_haze_data_path" /mnt/d/datasets/exposure error/testing/INPUT_IMAGES",\
    
    "--dataset_type" LOL-v1",

Weights

The weights provided are not optimal solutions mentioned in the paper. Only for testing. CPGA-Net

weights/enhance_color-llie-ResCBAM_g-LOLv1.pkl
weights/enhance_color-llie-ResCBAM_g-vggloss-LOLv2.pkl

CPGA-Net (DGF)

weights/enhance_color-llie-ResCBAM_g-8-DGF.pkl

Results

The metrics were calculated by The evaluation code from HWMNet
Flops were calculated by fvcore Flops and Inference time per image were using a input with 600×400×3 random generated tensor for testing with GPU Nvidia GeForce 3090

LOL-Test(15 pics)

PSNR (dB)SSIMLPIPSFlops(G)Params(M)Inference Speed
CPGA-Net20.940.7480.2606.03240.025428.256
CPGA-Net (DGF)20.310.7010.2911.09700.01846.090

LIME/NPE/MEF/DICM/VV (using NIQE)

MEFLIMENPEVVDICMAvg
CPGA-Net3.86983.70683.54762.26412.69343.216
CPGA-Net (DGF)3.82723.8343.49752.23363.03613.286

Exposure Error (avg)

PSNR (dB)SSIMLPIPSPI
CPGA-Net19.900.8090.1842.428

EdgeAI

CPGA-Net for EdgeAI (Jetson Nano)
CPGA-Net for EdgeAI (neural compute stick 2)

Acknowledge

Lots of code were borrowed from pytorch version of AOD-Net
Evaluation code was borrowed from HWMNet
The efficient version is based on FastGuidedFilter.

@article{doi:10.1142/S0218001425540138,
author = {Weng, Shyang-En and Miaou, Shaou-Gang and Christanto, Ricky},
title = {A Lightweight Low-Light Image Enhancement Network via Channel Prior and Gamma Correction},
journal = {International Journal of Pattern Recognition and Artificial Intelligence},
volume = {0},
number = {ja},
pages = {null},
year = {0},
doi = {10.1142/S0218001425540138},
URL = {https://doi.org/10.1142/S0218001425540138},
eprint = { https://doi.org/10.1142/S0218001425540138}
}

@article{weng2024lightweight,
  title={A Lightweight Low-Light Image Enhancement Network via Channel Prior and Gamma Correction},
  author={Weng, Shyang-En and Miaou, Shaou-Gang and Christanto, Ricky},
  journal={arXiv preprint arXiv:2402.18147},
  year={2024}
}
@inproceedings{weng2024exposure,
  title={Exposure Correction in Driving Scenes Using the Atmospheric Scattering Model},
  author={Weng, Shyang-En and Miaou, Shaou-Gang and Christanto, Ricky and Hsu, Chang-Pin},
  booktitle={2024 International Conference on Consumer Electronics-Taiwan (ICCE-Taiwan)},
  pages={493--494},
  year={2024},
  organization={IEEE}
}