Skip to content
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

RuntimeError: size mismatch , when using my own 512x512 dataset #17

Closed
lxj616 opened this issue Mar 8, 2018 · 2 comments
Closed

RuntimeError: size mismatch , when using my own 512x512 dataset #17

lxj616 opened this issue Mar 8, 2018 · 2 comments

Comments

@lxj616
Copy link

lxj616 commented Mar 8, 2018

python train.py --dataroot ./datasets/maps --name maps_bicyclegan --model bicycle_gan --display_id 0 --nThread 0 --loadSize 512 --fineSize 512 --display_winsize 512 --which_direction 'AtoB' --use_dropout --gpu_ids 0

model [BiCycleGANModel] was created
create web directory ./checkpoints/maps_bicyclegan/web...
Traceback (most recent call last):
  File "train.py", line 25, in <module>
    model.update_D(data)
  File "/workdir/BicycleGAN/models/bicycle_gan_model.py", line 120, in update_D
    self.forward()
  File "/workdir/BicycleGAN/models/bicycle_gan_model.py", line 43, in forward
    self.mu, self.logvar = self.netE.forward(self.real_B_encoded)
  File "/workdir/BicycleGAN/models/networks.py", line 697, in forward
    output = self.fc(conv_flat)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 325, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.py", line 67, in forward
    input = module(input)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 325, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/linear.py", line 55, in forward
    return F.linear(input, self.weight, self.bias)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/functional.py", line 835, in linear
    return torch.addmm(bias, input, weight.t())
RuntimeError: size mismatch at /pytorch/torch/lib/THC/generic/THCTensorMathBlas.cu:243

tested 256x256 works fine, but any other size would raise the exception above
I am not good enough to fix this on my own after hours ...

@junyanz
Copy link
Owner

junyanz commented Mar 17, 2018

The current Encoder network (E_ResNet) only supports 128x128 (--which_model_netE resnet_128) and 256x256 (--which_model_netE resnet_256). But you can simiply add one line after this line.

 elif which_model_netE == 'resnet_512':
        netE = E_ResNet(input_nc, output_nc, ndf, n_blocks=6, norm_layer=norm_layer,
                        nl_layer=nl_layer, gpu_ids=gpu_ids, vaeLike=vaeLike)

@junyanz junyanz closed this as completed Apr 27, 2018
@rickkk856
Copy link

The current Encoder network (E_ResNet) only supports 128x128 (--which_model_netE resnet_128) and 256x256 (--which_model_netE resnet_256). But you can simiply add one line after this line.

 elif which_model_netE == 'resnet_512':
        netE = E_ResNet(input_nc, output_nc, ndf, n_blocks=6, norm_layer=norm_layer,
                        nl_layer=nl_layer, gpu_ids=gpu_ids, vaeLike=vaeLike)

Is this line up to date?
comment was on mar 2018

and last update was on 6 Jan 2019.
Its not working for me. I have the same issue 512x512 pixels - 800images dataset preprocess none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants