Skip to content

This is the final project for NCTU Applied CV Course Fall 2020

License

Notifications You must be signed in to change notification settings

farhantandia/Applied-CV-Zero-DCE-master

 
 

Repository files navigation

Realtime Improvement and Real Time Demo for DSLR Camera : Zero-Reference Deep Curve Estimation for Low-Light Image Enhancement

Final Project for Applied Computer Vision 2020 (Fall 2020) in National Chiao Tung University
Best Demo Award in Applied Computer Vision 2020 (Fall 2020)

Final Demo Reviewer

Min-Chun Hu - Multimedia Information System Lab - National Tsing Hua University
Yi-Ping Chao - Chang Gung University
Norman Wu - Garmin Corporation

Lecturer

Wen-Huang Cheng - AIMM Lab - NCTU

Our Team

Farhan Tandia
Ivan Surya Hutomo
Martin Dominikus

Highlight

We improve previous paper by implement it for real-time demo in DSLR camera and also add color correction and denoising to make the result is more suitable for real implementation. We continue the code from previous works:

  • Find more about Zero-DCE click here
  • Original Zero-DCE Repository click here
  • Paper CVPR-2020 Zero-DCE Paper click here

Abstract

Zero-DCE is a novel method to do light enhancement in an image. We could obtain do light enhancement in image while keep maintain the detail and preserves quality of the image. Enhancement may also recover the object detection or recognition in the low-light area. Zero-DCE does not require any paired or unpaired data in the training process as in existing CNN-Based because It using non-reference loss functions. It is said that Zero-DCE supersedes State-of-the-Arts. It is capable of processing images in real-time (about 500 FPS for images of size 640x480x3 on GPU) hence we would to do real implementation of Zero-DCE, in this case implement it using DSLR camera and some input images and videos.

Goals and Proposed Method


  • Previous Zero-DCE not really has correct color, we aim to do color correction for Zero-DCE.
  • If the input image already has some noise, Zero-DCE result will also has some noise, hence we would to improve the result by doing denoising at the output.
  • We add second part of SICE dataset and also our own dataset then retrain previous Zero-DCE model to get improvement in the result.

    All of improvement above is to make sure that we could use Zero-DCE for real-purpose, hence we also combine our demo with DSLR camera using NodeRED, you could see our proposed method below:


Our Result

Real Time Inference using DSLR Camera:

Images

  • ED = Extended Dataset (With our dataset + SICE Dataset part 2)
  • CC = Color Correction (Click here for more detail)
  • D = Denoise (Click here for more detail)
Original Images ZeroDCE ZeroDCE+ED+CC+D (Ours)








Videos

How to Run

You could run the program by following steps::

Clone the repository:

git clone https://github.com/alexivaner/Applied-CV-Zero-DCE-master/

Download the and Dataset:

  • Download dataset here
    Our dataset is originally taken from SICE DATASET, if you want to know more, you can click here
    We also take our own dataset, We add around 190 Photos, with 38 Different Scenes inside NCTU Campus. Photos are taken using Nikon D5300 and Fujifilm XT-100
  • After download the dataset, extract the "data" inside dataset to Zero-DCE-master/Zero-DCE_code dolder, so the structure of folder will be like this:
└── Zerp-DCE-master
    ├── Zero-DCE_code
    │   ├── data
    │   ├── snapshots
    │   ├── ...
    ├── Tools
    │   ├── Crop Image.ipynb
    ├── ....

Install Environment using Conda

We already provide environment file in this repository to make sure the installation is easy:

  • Go to Zero-DCE-master folder:
    cd Zero-DCE-master
  • Make sure you have anaconda in your pc
  • Run this command to install environment using conda:
    conda env create -f Zero-DECE-master.yml

Inference and Evaluate

Webcam

  • Go to Zero-DCE_code folder:
    cd Zero-DCE_code
  • Run lowlight_test_webcam.py:
    python lowlight_test_webcam.py

Testing Image/VIdeo

  • Go to Zero-DCE_code folder:
    cd Zero-DCE_code
  • Do not forget to edit the path in line 180 of lowlight_test_file.py
  • Run lowlight_test_file.py:
    python llowlight_test_file.py

Testing using DSLR Camera

If you want to inference using DSLR Camera, make sure you install the requirement below:

  • Node-RED (click here for installation)
  • gPhoto2 Library (click here for installation)

After Node-RED Installed:

  • Run node-red-start in the terminal
  • Visit http://127.0.0.1:1880/ in your browser
  • Click hamburger menu in the top-right corner, then go to manage palette, click palette, click install
  • Find and Install Node-RED dashboard and blynk

After everything is ready, you need to set httpstatic in Node-RED so our Node-RED can access our folder:

  • Change configuration in setting.js, for me the command will be like this:
    sudo nano /home/ivan/.node-red/settings.js, change "ivan" with your username
  • Uncomment httpStatic and replace wtih path for "images" folder in our repos, for example:
    // When httpAdminRoot is used to move the UI to a different root path, the // following property can be used to identify a directory of static content // that should be served at http://localhost:1880/. httpStatic: '/media/ivan/Ivan/Final Applied CV/Zero-DCE-master/images'
  • Save the setting ctrl+x, press y, and press enter if you are using nano.
  • Restart Node-RED by run node-red-stop then node-red-start

After set httpStatic, its time to import the flow:

  • Visit http://127.0.0.1:1880/ in your browser
  • Click hamburger menu in the top-right corner, then click import
  • Click Select file to import, choose nodered_flow 14 Januari 2021.json, then click import
  • Click Deploy in the right corner of NodeRED

Now you should already see the interface of NodeRED-Dashboard with your browser:

  • Visit http://127.0.0.1:1880/ui in your browser and you should see some interfaces
  • Visit http://127.0.0.1:1880/ in your browser
  • You need to make sure all the path in 'capture camera','enhance image','watch for pic', and every 'timestamp' already refer to your correct path. Do not forget to change python path based on your anaconda environment path.
  • Do not forget to click 'Deploy' if you change something.

After everything already setup:

  • Connect your DSLR Camera with USB Cable
  • Visit http://127.0.0.1:1880/ui in your browser and you should see some interfaces
  • Click 'Capture camera' and see if your camera already give some respond.

Training Zero-DCE

  • Go to Zero-DCE_code folder:
    cd Zero-DCE_code
  • Do not forget to edit the path from lowlight_train.py
  • Run lowlight_train.py:
    python lowlight_train

Full Proposal

Please download our full proposal here:
Full Proposal

Full Final Explanation Report

Please download our full final report here:
Full Report

Disclaimer

Please cite us as authors, our GitHub, and Original's Zero DCE repository if you plan to use this as your next research or any paper.

Reference

Guo, Chunle, et al. "Zero-Reference Deep Curve Estimation for Low-Light Image Enhancement." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2020.

Zer-DCE Github Page - https://li-chongyi.github.io/Proj_Zero-DCE.html
Color Balance - https://web.stanford.edu/~sujason/ColorBalancing/simplestcb.html
OpenCV Denoise - https://docs.opencv.org/3.4/d5/d69/tutorial_py_non_local_means.html

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 84.6%
  • Python 15.4%