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
A minimal implementaion (less than 150 lines of code with visualization) of DCGAN/WGAN in PyTorch with jupyter notebooks
License: MIT License
the 'xrange' is in 'for epoch in xrange(opt.max_epoch):' is wrong.
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?
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.