GithubHelp home page GithubHelp logo

arnab39 / cyclegan-pytorch Goto Github PK

View Code? Open in Web Editor NEW
115.0 5.0 40.0 1.04 MB

A clean and lucid implementation of cycleGAN using PyTorch

License: MIT License

Shell 2.83% Python 97.17%
pytorch-implementation cyclegan cyclegan-pytorch image-translation deep-learning generative-adversarial-network computer-vision

cyclegan-pytorch's Introduction

CycleGAN using PyTorch

CycleGAN is one of the most interesting works I have read. Although the idea behind cycleGAN looks quite intuitive after you read the paper: Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks, the official PyTorch implementation by junyanz is difficult to understand for beginners (The code is really well written but it's just that it has multiple things implemented together). As I am writing a simpler version of the code for some other work, I thought of making my version of cycleGAN public for those who are looking for an easier implementation of the paper.

All the credit goes to the authors of the paper. This code is inspired by the actual implementation by junyanz which can be found here.

Requirements

  • The code has been written in Python (3.5.2) and PyTorch (0.4.1)

How to run

  • To download datasets (eg. horse2zebra)
$ sh ./download_dataset.sh horse2zebra
  • To run training
$ python main.py --training True
  • To run testing
$ python main.py --testing True
  • Try tweaking the arguments to get best performance according to the dataset.

Results

  • For horse to zebra dataset. ( Real - Generated - Reconstructed)

cyclegan-pytorch's People

Contributors

arnab39 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  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  avatar  avatar

cyclegan-pytorch's Issues

About setting grad to false in train iteration.

In training, discriminator gradient is set to false while generator is updating.
But I tried with no discriminator lock, and it it seems the result was same.
I wonder the lock code needs in PyTorch?

OSError: [Errno 95] Operation not supported

Whenever i try to run it on colab it shows:
File "main.py", line 40, in main
create_link(args.dataset_dir)
File "/content/drive/My Drive/cycleGAN-PyTorch/utils.py", line 37, in create_link
os.path.join(dirs[key], 'Link'))

Operation not supported: '/content/drive/My Drive/cycleGAN-PyTorch/datasets/horse2zebra/trainA' -> '/content/drive/My Drive/cycleGAN-PyTorch/datasets/horse2zebra/ltrainA/Link'

what can i do?

Confusing naming

Hi, your code is very clean thanks!

But I think that naming can be confusing. At https://github.com/arnab39/cycleGAN-PyTorch/blob/master/model.py#L107 you named a_fake = self.Gab(b_real), the generator of a to b taking a b example should not generate the identity (a_idt)? In all examples I show, the followed nomenclature for generators is this Gxy, generator from x to y...

Assuming that, all generators naming are reversed. What do you think?

Need to add B-->A in testing?

Hello, great code.
I think you should add one more option to map from B to A in testing

a_test_data = dsets.ImageFolder(dataset_dirs['testA'], transform=transform)

Besides, we do not need to shuffle in testing.

    a_test_data = dsets.ImageFolder(dataset_dirs['testA'], transform=transform)
    b_test_data = dsets.ImageFolder(dataset_dirs['testB'], transform=transform)


    a_test_loader = torch.utils.data.DataLoader(a_test_data, batch_size=args.batch_size, shuffle=True, num_workers=4)
    b_test_loader = torch.utils.data.DataLoader(b_test_data, batch_size=args.batch_size, shuffle=True, num_workers=4)

You save my life~

Running on Google Colab, create_link error occurs.

I run main.py on Google Colab , and I got the message bellow.

File "/content/grive/My Drive/CycleGAN/cycleGAN-PyTorch/utils.py", line 37, in create_link os.path.join(dirs[key], 'Link')) OSError: [Errno 95] Operation not supported: '/content/grive/My Drive/CycleGAN/cycleGAN-PyTorch/datasets/horse2zebra/trainA' -> './datasets/horse2zebra/ltrainA/Link'

I think it's better to copy trainA to ltrainA without using the link.

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.