MeteorsHub / GLIA-Net

A segmentation network for intracranial aneurysm on CTA images using pytorch
37 stars 10 forks source link

Mismatch channels between weight and input patch #16

Closed KuroTetsuya closed 3 months ago

KuroTetsuya commented 10 months ago

Hi, I am new to Github so please forgive me if me question is immature or inexperience in anyway.

I trying to run your code with a sample from the dataset. Yet when I reach the inference.py trying to implement the GLIA-Net, I got a mismatch in the shape of the input patch with the weight originated from the model (Please refer to the attach image for more details)

Error_mismatch_channel_weight_and_input

I had been running into the data_loader.py file and try to debug the error (suspecting the error are at the "patch_bundle" variable definition but not yet solve the problem). Have you encounter similar experience?

Thank you and wish you had a good day!!

MeteorsHub commented 10 months ago

It seems that your input image has only 1 channel. The provided model ckpt file needs to get 3 channel input image. The 3 channels represent 3 hu_ranges defined in the config file, like hu_ranges: [[0,50], [50, 200], [200,600]]. If your modified this config, you should replace it with the default values, unless you train you own model with different hu_ranges.

KuroTetsuya commented 10 months ago

Dear @MeteorsHub, Thank you for replying.

For the input image, I am trying to test your model using the ADAM dataset and all the images are 3 channels in nifti format with .nii.gz extension. In the config file, the 3 hu_ranges was left untouched, although I did try to adjust the values within the 3 ranges to see whether it will bring any changes. For the moment, the error remains the same.

Based on the information display during the inference process, I've seen that the input images are successfully divided into patches of size [96,96,96] but I am not really sure about this one, thus I am currently diving into the data_loader.py to explore the patch generation process checking whether everything is going according to our expectation or not.

I am actually fairly new to python, so the time taking for testing is slow, but I am really appreciate your comment. Wish you had a good day.

MeteorsHub commented 10 months ago

Got it! Maybe its abuot the dataset. Our model is trained using 1 channel CT images (like gray image). We use 3 hu-ranges to expand it to 3 channels. If your dataset is originally 3 channels, the data loader may behave unpredictable. You can check and test the data loader further.

KuroTetsuya commented 10 months ago

Thank you very much,

Your comment does actually open more clues for me to try compare to me debugging blindly for the past few days. I will be back if I ever figure out how to adjust the original model to fit 3 channels images.