jerofad / deep-photo-enhancer

the Pytorch implementation of Deep Photo Enhancer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Pytorch Implementation of Deep Photo Enhancer

This project is based on the thesis《Deep Photo Enhancer: Unpaired Learning for Image Enhancement from Photographs with GANs》。

The author's project address is:nothinglo/Deep-Photo-Enhancer

My code is based on hyerania\Deep-Learning-Project

中文文档说明请看这里

Requirements

  • Python 3.6
  • CUDA 10.0
  • To install requirements: pip install -r requirements.txt

Prerequisites

Data

Expert-C on MIT-Adobe FiveK dataset

Folders

  1. All hyperparameters are in libs\constant.py
  2. There are some folders need to be created:
    1. images_LR:Used to store datasets
      1. Expert-C
      2. input
      3. In each of the above two folders, the following three new folders need to be created:
        1. Testing
        2. Training1
        3. Training2
    2. models:Used to store all the training generated files:
      1. gt_images
      2. input_images
      3. pretrain_checkpoint
      4. pretrain_images
      5. test_images
      6. train_checkpoint
      7. train_images
      8. train_test_images
      9. In each of the above folders, the following two new folders need to be created:
        1. 1Way
        2. 2Way
      10. log: used to store all logs and the result of data visualization
        1. pretrain: store all charts of pretrain
        2. train: store all charts of train

Training

  1. If you don't have a pretrain module, the first thing you need to do is running "1WayGAN_PreTrain.py": python 1WayGAN_PreTrain.py

  2. The last generated \models\pretrain_checkpoint\gan1_pretrain_xxx_xxx.pth should be placed in the root directory, like "gan1_pretrain_100_113.pth" in my repository.

  3. Next you need to change the line 15 in “1WayGAN_Train.py” or the same line in “2WayGAN_Train.py”.

  4. To train the model, please run this command:

    # Only if you want to use 1 way Gan
    python 1WayGAN_Train.py
    # Only if you want to use 2 way Gan
    python 2WayGAN_Train.py

Evaluation

For now, the evaluation and training are simultaneous. So there is no need to run anything.

To evaluate my module, I use PSNR in “XWayGAN_Train.py”

Results

<style type="text/css"> .tg {border-collapse:collapse;border-spacing:0;} .tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;} .tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;} .tg .tg-18eh{font-weight:bold;border-color:#000000;text-align:center;vertical-align:middle} .tg .tg-wp8o{border-color:#000000;text-align:center;vertical-align:top} .tg .tg-xwyw{border-color:#000000;text-align:center;vertical-align:middle} .tg .tg-mqa1{font-weight:bold;border-color:#000000;text-align:center;vertical-align:top} </style>
1Way GAN 2Way GAN BATCH_SIZE NUM_EPOCHS_PRETRAIN NUM_EPOCHS_TRAIN Discriminator Loss Generator Loss PSNR Time
Pretrain 1 \ \ \ \ 3H55M
2 \ \ \ \ 8H45M
3 \ \ \ \ 9H25M
Train 1 2H45M
2 5H38M
3 4H45M

Problem

  1. There may be a problem in computing the value of PSNR or not. It needs to be proved.
  2. The compute functions in libs\compute.py are wrong, which cause the discriminator loss cannot converge and the output is awful.

License

This repo is released under the MIT License

Contributor

For now, This repo is maintained by Zhiwei Li.

Welcome to join me to maintain it together.

About

the Pytorch implementation of Deep Photo Enhancer

License:MIT License


Languages

Language:Python 100.0%