clvrai / acgan-pytorch Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
excuse me, I don't see input labels in the generator? Did anyone notice that?
UserWarning: Using a target size (torch.Size([1])) that is different to the input size (torch.Size([16])) is deprecated. Please ensure they have the same size.
"Please ensure they have the same size.".format(target.size(), input.size()))
Traceback (most recent call last):
File "main.py", line 188, in
dis_errD_real = dis_criterion(dis_output, dis_label)
File "/home/.../envs/python36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 325, in call
result = self.forward(*input, **kwargs)
File "/home/.../envs/python36/lib/python3.6/site-packages/torch/nn/modules/loss.py", line 372, in forward
size_average=self.size_average)
File "/home/.../envs/python36/lib/python3.6/site-packages/torch/nn/functional.py", line 1171, in binary_cross_entropy
"!= input nelement ({})".format(target.nelement(), input.nelement()))
ValueError: Target and input must have the same number of elements. target nelement (1) != input nelement (16)
I have a custom dataset with multiple labels per image.
This means my "label" is a vector with 1 or 0 in multiple locations.
How can I augment ACGAN to classify multiple labels?
Can you please provide guidance on how to train this model with a different data set that is not in the format of cifar or mnist?
Thank you,
First of all, I would like to thank you for sharing your implementation on github. After running my experiment on cifar-10 and computing the inception score, I discovered that the inception score computed is different from score reported on the original paper.
I get an inception score of 5 for 100 iterations, 5.03 for 200 iterations. 5.24 for 500 iteration. My inception score is calculated using the following tensorflow script.
https://github.com/dashayushman/TAC-GAN/blob/master/inception_score.py
The reported number for ACGAN paper is 8.25.
The inception score calculation is correct because I can get the same score (11.24), for all 50,000 training images. (as mentioned in Improved Techniques for Training GANs https://arxiv.org/pdf/1606.03498.pdf)
Can you shed some light as why the results differ so much? (5~ vs 8~)
When training GENERATOR
Line 224
aux_errG = aux_criterion(aux_output, aux_label)
aux_label- has random values from lines 204 and 197.
Shouldn't the 'aux_label' have ground truth values because we are training the generator????
Hi
Thanks for publishing the code in Pytorch ! I have a few questions however.
[1] for the loss associated with the auxilliary classifier fc you are using NLL Loss
but the last layer is Softmax
layer. Shouldn't it be LogSoftmax
instead of Softmax
?
[2] I am wondering why is the noise in line 201
generated using the class_one_hot vector representation ? Cannot we use simply the noise as generated in Line 196
? Did you find any improvements with that specific noise generation ?
Also instead of randomly generating label
as in Line 197
can't we use the label
that have been sampled from the data loader i.e., Line 177
[3] Also based on the figure given in the main page (the last figure to the right), it is shown that class information i.e., C_class
is given to both the latent variable z
and before the discriminator D
(on X_real
and X_fake
) in the training stage. However in the code, it seems to be missing. Can you please clarify why is that?
Please refer to this
https://github.com/znxlwm/pytorch-generative-model-collections/blob/master/ACGAN.py
Thank you in advance for the wonderful code.
The current code uses softmax for auxiliary prediction and during training uses NLL Loss. But according to here it seems that the right last layer to go with NLL is LogSoftmax instead?
About accuracy ,what's the best score about the cifar10?
Would it be possible to provide a run script for training on ImageNet, similar to the one you provided for CIFAR:
python main.py --outf=/your/output/file/name --niter=500 --batchSize=100 --cuda --dataset=cifar10 --imageSize=32 --dataroot=/data/path/to/cifar10 --gpu=0
I assume this should be okay, but I didn't want to guess any of the params (lr, niter, ngf, ndf etc.) either.
python main.py --outf=/your/output/file/name --niter=500 --batchSize=100 --cuda --dataset=imagenet --imageSize=128 --dataroot=/data/path/to/imagenet --num_classes=1000 --nz=1100 --gpu=0
What worked best in your experiments?
should read # Transposed Convolution 6
not # Transposed Convolution 5
From the following line:
aux_label.data.resize_(batch_size).copy_(label)
I am getting the following error:
RuntimeError: expand(torch.FloatTensor{[1, 1]}, size=[1]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
For a custom dataset. The dataset is using TensorDataset
from PyTorch, and is supplying a 1D tensor, but for some reason it fails as [1, 1].
The way I create the dataset:
...
tensor_y = torch.stack([torch.Tensor(i) for i in y]) # i is a 1D vector
return data.TensorDataset(tensor_x, tensor_y)
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.