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
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.
This script will provide an approximate inference results but not an accurate one.
python inference.py
Check the sample output here
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 msNote: 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
- Pytorch - with cuda
- opencv
- PIL
- numpy
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
To test the student model, use
python lowlight_test.py --test_data=<> --student_model_path=<> --teacher_model_path=<>
Refer Param_check.ipynb
Refer FPGA-ZeroDCE_Extension
Results for both test images and videos were uploaded in this GDrive
Mail -> ashokraja1910@gmail.com