-
Notifications
You must be signed in to change notification settings - Fork 11
Array reshape error #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I converted the mask images from 32 bit to 8 bit. Then, the code runs successfully. |
Dear @Shailendra-IISc Sir, |
I used Paint.NET software to save the mask image as 8-bit type. Please make sure that the background is black and the mask is white. |
In addition to that, while training(the Wasserstein GAN) are you experiencing negative loss corresponding to the Discriminator? |
@Shailendra-IISc : Yes, the masks should be single-channel black&white images (i.e., 8 bit). I should probably add this to the documentation, or just change the code so that it binarizes the masks before attempting to use them for training the WGAN. I am glad it works now for you. @pramethg: Yes, a negative loss in a Wasserstein GAN with Gradient Penalty is "normal". You can find more detailed information about this loss in general (i.e., the idea behind it, how it is calculated, and how it can be interpreted e.g. for detecting overfitting) in Reference 22 of our paper (Gulrajani, I., Ahmed, F., Arjovsky, M., Dumoulin, V. & Courville, A. in Advances in Neural Information Processing Systems 30 Vol. 30 Advances in Neural Information Processing Systems (eds I. Guyon et al.) (Neural Information Processing Systems (Nips), 2017), or the "corresponding" paper of the same authors on arxiv https://arxiv.org/pdf/1704.00028.pdf ), and you can also see how exactly the loss is implmented by looking at the source code of the WassersteinGAN.py file. |
Hello sir/Ma`am,
Thank you for sharing the important code for scientific research.
I have 21 images with size 1280 x 960 pixels and 13 sample masks with size 64 x 64 pixels. I installed all the dependencies as specified in the 'requirements.txt' file. However, when I run the most recent program, I got the following error message:
File “WassersteinGAN.py”, line 207, in init
self.train_images = (self.train_images.reshape((self.train_images.shape[0], 64, 64, 1)).astype(“float32”) – 127.5)/127.5
ValueError: cannot reshape array of size 851968 into shape (52,64,64,1)
Please let me know if I can fix the above error.
Regards,
Shailendra Kumar Verma
The text was updated successfully, but these errors were encountered: