AHNet parameters for 3D CT organ segmentation #1456
Replies: 7 comments 1 reply
-
Hi @dlabella29 , I think the |
Beta Was this translation helpful? Give feedback.
-
Hi @Nic-Ma, I have tried out_channels values from [1,3] for AHNet, and each one resulted in the same error message. I also tried modifying psp_block_num from [0,4] and still received the same error message. Would loading the data into cache matter for AHNet? Both ways worked for the UNet. I'm not sure how the rest of the SpleenSegmentation code needs to change when switching from UNet to AHNet on the same dataset. Is the error possibly being caused by a mismatch here... Thanks! |
Beta Was this translation helpful? Give feedback.
-
You're using all the default arguments from the constructor, so my guess is the size of the input image is wrong:
Does the above work? |
Beta Was this translation helpful? Give feedback.
-
Hi @rijobro, I ran your attached code without error. I am also guessing the issue is with the input image. But, I am not sure where the issue is since UNet is training appropriately without error on the same data set. It's interesting that UNet is working with the default parameters (and adjustments above), but AHNet is not for the 3Dspleensegmentation file. Please let me know if I am missing an understanding for the implementation of the two networks. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, there's no guarantee that if the default parameters of a network are OK with a set of images, then they will also be OK with another default network. What is the shape fo the images you're trying to use? |
Beta Was this translation helpful? Give feedback.
-
I have listed 3 different image shapes below from the same training/validation sample dataset... image shape: torch.Size([512, 424, 87]), label shape: torch.Size([512, 424, 87]) These were produced 3 times respectively referring to different images/labels by the following... These images and their respective shapes worked for UNet. I'm still not sure if any additional formatting or configuration is needed for AHNet. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
Hi @yiheng-wang-nv , Could you please help confirm the data size for AHNet? Thanks. |
Beta Was this translation helpful? Give feedback.
-
I am trying to use AHNet in MONAI instead of Unet for 3D segmentation and cannot figure out the parameters to get the model training.
I'm using nifti CT's with nifti kidney segmentations.
https://docs.monai.io/en/latest/networks.html
Unet working...
model = monai.networks.nets.UNet(dimensions=3, in_channels=1, out_channels=2, channels=(32, 64, 128, 256,512),strides=(2, 2, 2, 2), num_res_units=2, norm=Norm.BATCH,dropout=0.1).to(device)
AHNet not working...
model = monai.networks.nets.AHNet(layers=(3,4,6,3),spatial_dims=3,in_channels=1, out_channels=1,psp_block_num=4,upsample_mode='transpose',pretrained=False,progress=True).to(device)
AHNet error log...
File "SegmentHNfinal.py", line 227, in
outputs = model(inputs)
File "/home/user/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/user/MONAIahnet/MONAI-master/monai/networks/nets/ahnet.py", line 497, in forward
sum0 = self.up0(fm4) + fm3
RuntimeError: The size of tensor a (2) must match the size of tensor b (3) at non-singleton dimension 4
Please let me know if you have any direction on how to get this working.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions