MedicalZooPytorch icon indicating copy to clipboard operation
MedicalZooPytorch copied to clipboard

Something trouble with inference.py

Open JinxLv opened this issue 5 years ago • 4 comments

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

JinxLv avatar Sep 10 '20 13:09 JinxLv

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 ?

iliasprc avatar Sep 10 '20 13:09 iliasprc

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 avatar Sep 10 '20 14:09 JinxLv

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.

JinxLv avatar Sep 11 '20 15:09 JinxLv

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 [email protected],thank you ! ! !

ghost avatar Jul 09 '22 03:07 ghost