Coder Social home page Coder Social logo

chenyuntc / pytorch-gan Goto Github PK

View Code? Open in Web Editor NEW
188.0 6.0 74.0 2.05 MB

A minimal implementaion (less than 150 lines of code with visualization) of DCGAN/WGAN in PyTorch with jupyter notebooks

License: MIT License

Jupyter Notebook 100.00%
gan wgan

pytorch-gan's Introduction

pytorch-GAN

A minimal implementaion of DCGAN/WGAN in PyTorch with jupyter notebooks. This is the first program I write in PyTorch when I was learning PyTorch.

NOTE, I've rewriten it to make it even simpler

pytorch-gan's People

Contributors

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

pytorch-gan's Issues

error occur: shape error

Hi, thank you for making easy notebook for WGAN. I am trying to use your WGAN.

However, I got this error message

RuntimeError: Mismatch in shape: grad_output[0] has a shape of torch.Size([1]) and output[0] has a shape of torch.Size([32, 1, 1, 1]).

I just cloned your code, and run.

Do you know how can I fix this error?

how to test the Cirfar10

Good work! I have also learned GAN based on pytorch. The Cifar10 datasets has ten classes. Before using GAN, i trained Cifar10 using the following code:
for i, data in enumerate(trainloader, 0):
inputs, labels = data
inputs, labels = Variable(inputs.cuda()), Variable(labels.cuda())
optimizer.zero_grad()
outputs = net(inputs)
loss = criterion(outputs, labels)
the labels ranges from 0 to 9. and test the network, we can using these code:
for i, data in enumerate(testloader, 0):
images, labels = data
images = Variable(images.cuda())
labels = labels.cuda()
outputs = net(images)
_, predicted = torch.max(outputs.data, 1)
total += labels.size(0)
predicted = predicted.cuda()
correct += (predicted == labels).sum()
However, With using the GAN network trained for Cifar10, the loss = criterion(outputs, labels) has changed to criterion(outputs, real_data) or criterion(outputs, fake_data) , the ten classifications has become two classifications. So how can i correctly predicted an image belonging to which class using the Gan network?
Thanks a lot.

modal collapse

Hello, I would like to ask whether the results are normal when you train with mnist data set?I tried training with this dataset, and it was normal until about a dozen epochs, but then all of a sudden there was a modal collapse, and the generator produced a very strange picture.

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.