AssertionError for 2 input channel image and label #4740
-
Hi, I wanted to do the segmentation on kidneys dataset. For preprocessing data I tried to use cropforground and use labels so I could extract two kidneys. then for giving good dataset to training model I extract the left kidney and right kidney separably and I did these steps for labels. So I had left kidney images, left kidney labels, right kidney images and right kidney labels. I made two datasets with monai left kidney that contains left images and labels, right kidney that contains right images and labels. Because kidneys are two before making dataloader I tried to make a custom dataset with pytorch that gets left kidney dataset and right kidney dataset. Then concatenate the left image with right image and left label with right label. Finally it returns image and label which both of them has 2 channels. This is my custome dataset:
Then I chose Unet network that has 2 input channels and 2 output channels.
I tried to extract image and label from batch data:
And the output of batch data for image and label is:
But when I try to train model with this method:
I get this error on the second line of previous code:
I can not understand where is problem, can you please help me? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I think the issue is with |
Beta Was this translation helpful? Give feedback.
-
Thanks for your answer. It solved problem. But do you know what is the usage of |
Beta Was this translation helpful? Give feedback.
I think the issue is with
loss_function
, you can setto_onehot_y=False, sigmoid=True