Described Error-
RuntimeError: Given groups=1, weight[512, 3, 1, 1, 1], so expected input[32, 1, 6, 4, 4] to have 3 channels, but got 1 channels instead
I am aware that this issue type has been raised several times, but none of them helped me solved my issue.
I am trying to Implement a FutureGAN model
from here- GitHub - TUM-LMF/FutureGAN: Official PyTorch Implementation of FutureGAN
I followed all the steps mentioned in the Description and finally ran -
python /content/FutureGAN/train.py --data_root='/content/mmnist-2/train'
This yields an error -
... loading training configuration ...
... saving training configuration to <_io.TextIOWrapper name='./logs/2021-08-24_172412/train_config.txt' mode='w' encoding='UTF-8'>
... creating initial models ...
... initial models have been built successfully ...
... saving initial model strutures to <_io.TextIOWrapper name='./logs/2021-08-24_172412/initial_model_structure_4x4.txt' mode='w' encoding='UTF-8'>
0% 0/10140 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/content/FutureGAN/train.py", line 832, in <module>
trainer.train()
File "/content/FutureGAN/train.py", line 574, in train
self.z_x_gen = self.G(self.z)
File "/usr/local/envs/FutureGAN/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
result = self.forward(*input, **kwargs)
File "/content/FutureGAN/model.py", line 307, in forward
y = self.model(x)
File "/usr/local/envs/FutureGAN/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
result = self.forward(*input, **kwargs)
File "/usr/local/envs/FutureGAN/lib/python3.6/site-packages/torch/nn/modules/container.py", line 67, in forward
input = module(input)
File "/usr/local/envs/FutureGAN/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
result = self.forward(*input, **kwargs)
File "/usr/local/envs/FutureGAN/lib/python3.6/site-packages/torch/nn/modules/container.py", line 67, in forward
input = module(input)
File "/usr/local/envs/FutureGAN/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
result = self.forward(*input, **kwargs)
File "/content/FutureGAN/custom_layers.py", line 114, in forward
x = self.conv(x.mul(self.scale))
File "/usr/local/envs/FutureGAN/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in __call__
result = self.forward(*input, **kwargs)
File "/usr/local/envs/FutureGAN/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 388, in forward
self.padding, self.dilation, self.groups)
File "/usr/local/envs/FutureGAN/lib/python3.6/site-packages/torch/nn/functional.py", line 126, in conv3d
return f(input, weight, bias)
RuntimeError: Given groups=1, weight[512, 3, 1, 1, 1], so expected input[32, 1, 6, 4, 4] to have 3 channels, but got 1 channels instead
I could resolve this issue by providing an input of just 1 channel,
python /content/FutureGAN/train.py --data_root='/content/mmnist-2/train' --nc 1
but that is not exactly how I wish to solve this. I would want my input to be in the RGB form.
Here are the details of my environment -
I am using a google colab notebook to do the training with all the steps here -
It is a regular Colab environment with Conda installed with all dependencies.
https://github.com/dhruvsheth-ai/FutureGAN/blob/master/FutureGAN-new.ipynb
Would appreciate any suggestions and if possible the change to be made in the code to solve this issue. Thanks!