Semi-supervised-segmentation-cycleGAN icon indicating copy to clipboard operation
Semi-supervised-segmentation-cycleGAN copied to clipboard

Channel issue with ACDC dataset

Open amitojdeep opened this issue 5 years ago • 3 comments

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?

amitojdeep avatar Nov 26 '19 00:11 amitojdeep

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

kevinkwshin avatar Jan 03 '20 04:01 kevinkwshin

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?

amitojdeep avatar Jan 03 '20 05:01 amitojdeep

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

sajjadafridi avatar Dec 10 '20 09:12 sajjadafridi