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

Channel issue with ACDC dataset #17

Open
amitojdeep opened this issue Nov 26, 2019 · 3 comments
Open

Channel issue with ACDC dataset #17

amitojdeep opened this issue Nov 26, 2019 · 3 comments

Comments

@amitojdeep
Copy link

I downloaded the provided ACDC dataset and when I tried to run the code, I got the following error (channels issue)

Traceback (most recent call last):
File "main.py", line 87, in
main()
File "main.py", line 73, in main
model.train(args)
File "/project/6037231/amitoj/cycleGAN/model.py", line 362, in train
fake_gt = self.Gsi(unl_img.float()) ### having 21 channels
File "/home/amitoj/.local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/project/6037231/amitoj/cycleGAN/arch/generators.py", line 431, in forward
x = self.conv1(x)
File "/home/amitoj/.local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/home/amitoj/.local/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 343, in forward
return self.conv2d_forward(input, self.weight)
File "/home/amitoj/.local/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 340, in conv2d_forward
self.padding, self.dilation, self.groups)
RuntimeError: Given groups=1, weight of size 64 3 7 7, expected input[5, 1, 256, 256] to have 3 channels, but got 1 channels instead

Any fix for this or do I need to manually edit all the code?

@kevinkwshin
Copy link

kevinkwshin commented Jan 3, 2020

ACDC dataset has only 1 input_channel.

Thus, in "dataloader.py",
I add this line after line 383 to append image in 3 channels.

img = Image.open(img_path)
img = img.convert('RGB') # <-- added

@amitojdeep
Copy link
Author

ACDC dataset has only 1 input_channel.

Thus, in "dataloader.py",
I add this line after line 383 to append image in 3 channels.

img = Image.open(img_path)
img = img.convert('RGB') # <-- added

I also tried this as a quick and dirty fix. But using thrice the amount of memory isn’t the best thing. Any better option?

@sajjadafridi
Copy link

ACDC dataset has only 1 input_channel.

Thus, in "dataloader.py",
I add this line after line 383 to append image in 3 channels.

img = Image.open(img_path)
img = img.convert('RGB') # <-- added

This fix the issue but it show another error when creating one_hot_encodding

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