Skip to content

Latest commit

 

History

42 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NanoDCE

Introducing the smallest variant of ZeroDCE family - NanoDCE with only 161 parameters that achieves similar results of ZeroDCE and ZeroDCE++

This project is about using Knowledge Distillation method to compress the already small low light enhancement model ZeroDCE++ to an even smaller version resulting in 98.5% (65.6x) smaller than ZeroDCE++ and 99.8% (493.3x) smaller than ZeroDCE while retaining similar results.

    ZeroDCE   - 79416 params
    ZeroDCE++ - 10561 params

    NanoDCE   - 161 params (Proposed)

Knowledge Distillation Training Method- visit here

Architectural Changes

The student retains Zero-DCE++'s core (curve estimation via iterative LE maps) but compresses aggressively:

Filter Channels: Reduced from 32 to 4. Convolutional Layers: From 7 (Zero-DCE++) to 3 (each Depthwise + Pointwise as one logical conv). Curve Iterations: From 8 to 4, trading some dynamic range for efficiency. Implication: Preserves U-Net-like skip connections but trims depth, relying on KD to recover lost capacity.

This yields ~161 params in the trained student model.

Inference times

This script will provide an approximate inference results but not an accurate one.

    python inference.py 

Sample Output

Check the sample output here

Live Video Performance

As for the live video performance, the latency for each frame is calculated and displayed.

To check live video performance, run

            #for student model
    python live_webcam.py --model_path=snapshots_student_enhanced_kd/Student_Epoch100.pth  --enable_detection

            #for teacher model
    python live_webcam.py --model_type=teacher --model_path=snapshots_Zero_DCE++/Epoch99-pre.pth  --enable_detection

Note: YOLO detection is optional

  • Performance (without using YOLO detection)

        Student  |  Teacher
        -------- | ---------
        6.1-7 ms | 35-45 ms
    

    Note: Live webcam performance may vary for each system, Here the system configs were,

    • CPU - Ryzen 7 4800H
    • GPU - RTX 3050

Refer model.py and model_student.py for Changes

Prerequisites

  • Pytorch - with cuda
  • opencv
  • PIL
  • numpy

Training

Instead of using the same 2002 samples provided in the original model's training data, an additional amount of another 4089 samples were added to original training data from various datasets such as LIME, DICM, LOL-v1, LOL-v2 ,LSRW (both huawei and nikon) and LoLI-street to avoid overfitting.

Training data -> Gdrive Before training create folder structure like below in the training directory.

            /data-
               |-train_data
               |-test_data

To train the student model, use

    python train_student_kd.py

Testing

To test the student model, use

    python lowlight_test.py --test_data=<> --student_model_path=<> --teacher_model_path=<>

Model size comparison

Refer Param_check.ipynb

FPGA Implementation

Refer FPGA-ZeroDCE_Extension

Results

Results for both test images and videos were uploaded in this GDrive

Contact

Mail -> ashokraja1910@gmail.com

About

Knowledge distilled version of ZeroDCE_extension - Zero Reference low light image enhancement model

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages