Skip to content

Size issue from running custom dataset #25

@evdelph

Description

@evdelph

Hello,
I followed the instructions for uploading a custom dataset. However, I get this error:

$ python main.py --dataset ships --gan_type GAN --epoch 50 --batch_size 64
---------- Networks architecture -------------
generator(
(fc): Sequential(
(0): Linear(in_features=62, out_features=1024, bias=True)
(1): BatchNorm1d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU()
(3): Linear(in_features=1024, out_features=6272, bias=True)
(4): BatchNorm1d(6272, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(5): ReLU()
)
(deconv): Sequential(
(0): ConvTranspose2d(128, 64, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
(1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU()
(3): ConvTranspose2d(64, 3, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
(4): Tanh()
)
)
Total number of parameters: 6642243
discriminator(
(conv): Sequential(
(0): Conv2d(3, 64, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
(1): LeakyReLU(negative_slope=0.2)
(2): Conv2d(64, 128, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
(3): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(4): LeakyReLU(negative_slope=0.2)
)
(fc): Sequential(
(0): Linear(in_features=6272, out_features=1024, bias=True)
(1): BatchNorm1d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): LeakyReLU(negative_slope=0.2)
(3): Linear(in_features=1024, out_features=1, bias=True)
(4): Sigmoid()
)
)
Total number of parameters: 6561217

training start!!
Traceback (most recent call last):
File "main.py", line 111, in
main()
File "main.py", line 103, in main
gan.train()
File "C:\Users\evdelph\Desktop\NEEC\test\pytorch-generative-model-collections\GAN.py", line 144, in train
D_real = self.D(x_)
File "C:\Users\evdelph\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "C:\Users\evdelph\Desktop\NEEC\test\pytorch-generative-model-collections\GAN.py", line 67, in forward
x = x.view(-1, 128 * (self.input_size // 4) * (self.input_size // 4))
RuntimeError: shape '[-1, 6272]' is invalid for input of size 3276800

I am not sure how to fix this error. I am trying to generate images of ships for a school project.

Any insight would be great. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions