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

Error on RGB images or channel 3 #2

Open
deep0learning opened this issue Jan 12, 2018 · 0 comments
Open

Error on RGB images or channel 3 #2

deep0learning opened this issue Jan 12, 2018 · 0 comments

Comments

@deep0learning
Copy link

deep0learning commented Jan 12, 2018

I want to try to implement your code on RGB images where I got the following errors. Can you help me to sort out the problem please?

transform = transforms.Compose([
transforms.Resize((28,28)),
transforms.Grayscale(num_output_channels=3),
transforms.ToTensor(),
transforms.Normalize((0.1307,), (0.3081,))])

File "main.py", line 117, in
predict, reconstruct_img = net(img_batch, label_batch, train=True)
File "/home/user/pytorch_python3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "/media/user/DATA/New_CODE/Working/CapsNet_pytorch/lib/network.py", line 45, in forward
output = self.conv1(x)
File "/home/user/pytorch_python3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 224, in call
result = self.forward(*input, **kwargs)
File "/home/user/pytorch_python3/lib/python3.5/site-packages/torch/nn/modules/conv.py", line 254, in forward
self.padding, self.dilation, self.groups)
File "/home/user/pytorch_python3/lib/python3.5/site-packages/torch/nn/functional.py", line 52, in conv2d
return f(input, weight, bias)
RuntimeError: Need input.size[1] == 1 but got 3 instead.

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

1 participant