black0017 / MedicalZooPytorch

A pytorch-based deep learning framework for multi-modal 2D/3D medical image segmentation
MIT License
1.72k stars 299 forks source link

Something trouble with inference.py #11

Open JinxLv opened 4 years ago

JinxLv commented 4 years ago

Hello! I have trained a segmentation model using my own datasets,there is nothing wrong with my valuation dataset and the dice is high.But when I use the 'non_overlap_padding' fuction in the inference.py ,the dice score is very low.I have tried to output the prediction image (image bellow),there might something wrong with the patches index.Would you mind help me to fix this problem?Thank you very much !

13

iliasprc commented 4 years ago

Hello OldDriverJinx . We are conducting further experiments in order to correctly evaluate the whole medical image during inference. Non_overlap_padding function is still under development, we are trying to figure some issues. Could you provide some more details about the model and the dataset you used ?

JinxLv commented 4 years ago

Hello OldDriverJinx . We are conducting further experiments in order to correctly evaluate the whole medical image during inference. Non_overlap_padding function is still under development, we are trying to figure some issues. Could you provide some more details about the model and the dataset you used ?

Thanks for your reply! I have used my own brain segmentation dataset (like the MRBrains18) to train the 3DUnet.I found that there is nothing wrong with this function when my input is the full image(256256256),and this is the prediction image image .But when I want to predict in patches,I meet the problem which I have mentioned above.The same problem appears in function 'visualize_3D_no_overlap_new'.Could you please give me some suggestions to fix it?Thanks a lot !

JinxLv commented 4 years ago

Hello OldDriverJinx . We are conducting further experiments in order to correctly evaluate the whole medical image during inference. Non_overlap_padding function is still under development, we are trying to figure some issues. Could you provide some more details about the model and the dataset you used ?

I have found the solution.Just add output = output.permute(1,0,2,3,4).contiguous() at line 78 in "viz.py" like this:

# Reshape backlist 
output = output.permute(1,0,2,3,4).contiguous()
output_unfold_shape = unfold_shape[1:] 
output_unfold_shape.insert(0, Classes) 

Now the output seems to be normal.

ghost commented 2 years ago

Can you share you inference code? The official reasoning code doesn't seem to be used directly, I'm a novice and won't modify it, this is my email 2434196708@qq.com,thank you ! ! !