Code Monkey home page Code Monkey logo

tandon-a / cyclegan_ssim Goto Github PK

View Code? Open in Web Editor NEW
77.0 3.0 8.0 11.92 MB

Comparing different similarity functions for reconstruction of image on CycleGAN. (https://tandon-a.github.io/CycleGAN_ssim/) Training cycleGAN with different loss functions to improve visual quality of produced images

License: MIT License

Python 100.00%
tensorflow generative-adversarial-network gan cyclegan image-generation computer-vision image-manipulation computer-graphics deep-learning ssim-loss perceptual-losses perceptual-similarity image-to-image-translation image-translation

cyclegan_ssim's Introduction

CycleGAN_ssim

This project is an extension of the project Image Editing using GAN.

Implemented and trained Cycle Consistent Generative Adversarial Network (CycleGAN) as described in the paper with different loss functions, specifically SSIM loss, L1 loss, L2 loss and their combinations, to produce images of better visual quality.

CycleGAN model

Project Working

Fig 1: CycleGAN working

For the CycleGAN implementation with L1 Loss refer to here. For the official CycleGAN implementation read here.

Prerequisites

Usage

To train the model:

> python train_cycleGAN_loss.py --data_path monet2photo --input_fname_pattern .jpg --model_dir cycleGAN_model --loss_type l1
  • data_path: Path to directory having trainA and trainB folders (Folders with these specific names (trainA, trainB) having domainA and domainB training images respectively)
  • input_fname_pattern: Glob pattern of training images (file type of images such as .jpg or .png)
  • model_dir: Directory name to save checkpoints
  • loss_type: Loss type with which cycleGAN model is trained. (Available Options -- l1, l2, ssim, ssim_l1, ssim_l2_a, ssim_l2_b, l1_l2, ssim_l1l2_a, ssim_l1l2_b)

To test the model:

> python test_cycleGAN_loss.py --testA_image A01.jpg --testB_image B01.jpg --model_dir cycleGAN_model --loss_type l1
  • testA_image: TestA Image Path
  • testB_image: TestB Image Path
  • model_dir: Path to directory having checkpoint file
  • loss_type: Loss type with which cycleGAN model is tested.

Results

Trained CycleGAN model on Monet-Photo Database.

Comparison

CycleGAN SSIM Compare

Fig 2: Sample video showing comparison between CycleGAN with different SSIM loss settings

Photo to Monet Paintings

Input Image L1 Image SSIM Image SSIM + L1 SSIM + L2(a) SSIM + L2(b) SSIM + L1 + L2(b)

Monet to Photo Paintings

Input Image L1 Image SSIM Image SSIM + L1 SSIM + L2(a) SSIM + L2(b) SSIM + L1 + L2(b)

License

This project is licensed under the MIT License - see the LICENSE file for details

Author

Abhishek Tandon/ @Tandon-A

cyclegan_ssim's People

Contributors

tandon-a avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cyclegan_ssim's Issues

Input image shape

Hello,

I trying to use your model,
just want to clarify, what should the shape of input image
it should be (128,128,3) or (128,128)

Regards,

Run

Hey @Tandon-A,

Thanks for sharing your code. I am wondering how can I run your code because in the repo you written for executing the code I need to run train_cycleGAN.py but there is not any such python file in the repo.

Also, when I tried to run train_cycleGAN_loss.py file I got this error:

imgA = get_image_new(trainA[countA],shape[0],shape[1])
IndexError:list index out of range

It would be great if you guide me to execute your code.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.