MeteorsHub / GLIA-Net

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

Can I use the MR data to train your model ? #8

Closed YingJGuo closed 2 years ago

YingJGuo commented 2 years ago

I have tried many times to use my MRA-TOF data for training, but I still haven't succeeded to train a model that can work. The metrics can not be calculated correctly due to the wrong fp, tp and so on. (For example, The precision results always 0.0000 or 0.5000)

So, how can I change code to train my MRA data successfully? Maybe the spacing? Normalization ? or....? I think the main question is the difference between MRA and CTA data, I have checked the other possible questions like num_classes and so on. I tried to affirm the difference between my data and your CTA data and tried to change the MRA data like CTA data, but it still failed to work.

Need help :( Maybe you can give me some suggestions about how to preprocess the MRA data or how to change the code..?

MeteorsHub commented 2 years ago

Of course you can use MR data to train. But you need to specify the correct input value range, i.e. hu_values in the config file, because MR values are different from CT

YingJGuo commented 2 years ago

Of course you can use MR data to train. But you need to specify the correct input value range, i.e. hu_values in the config file, because MR values are different from CT

Yes I noticed that today and I changed the 'def _normalize' in core.py. I changed the code:

for hu_inter in hu_intervals: hu_channel = torch.clamp(image, hu_inter[0], hu_inter[1])

norm to 0-1

            normalized_img.append((hu_channel - hu_inter[0]) / (hu_inter[1] - hu_inter[0]))
        normalized_img = torch.stack(normalized_img, dim=1)

to:

   nMin = image.min()
   nMax = image.max()
   normalized_img.append((image - nMin)/(nMax - nMin))
   normalized_img.append((image - nMin)/(nMax - nMin))
   normalized_img.append((image - nMin) / (nMax - nMin))
   normalized_img = torch.stack(normalized_img, dim=1)

I tried to train the model. But it still not work :( I noticed that there is still many '1.0000' in your data (normalized_img) after the _normalize. But if I use my new code, it don't have any '1.0000' now.

Thanks a lot if u can give me more suggestions!

MeteorsHub commented 2 years ago

You could debug step by step and look what is the value in the image. You need to normalize the MR image (say maybe values within -100 and 100) to 01 image (values with 0 and 1)

YingJGuo commented 2 years ago

Yes I have already normalized the 'modal input' value within 0 and 1.