SegFormer3D icon indicating copy to clipboard operation
SegFormer3D copied to clipboard

How do I make inference?

Open sergiocanar opened this issue 1 year ago • 8 comments

After training the model, I'm encountering difficulties when attempting to test the model and visualize the predictions. Specifically, after running inference on the data, Im not able to match the results you guys showed in your repository.

sergiocanar avatar Oct 15 '24 01:10 sergiocanar

Hello, can you please give more detail on what you do during the prediction and what data you used for it ?

bnavard avatar Oct 15 '24 13:10 bnavard

Sure! Im using Brats2017 that you guys uploaded in the repository. And after I pass one of the modalities.pt through the model I get the logits, but Im unsure to how obtain the final segmentation volume to visualize it.

sergiocanar avatar Oct 23 '24 01:10 sergiocanar

Which code are you using ? Can you put it here ?

bnavard avatar Nov 06 '24 21:11 bnavard

Sure! Its in my forked repo but this is how I extract the volumes from the logits inference.txt

sergiocanar avatar Nov 08 '24 16:11 sergiocanar

@sergiocanar hello. Do you have the full test script?

microchila avatar Feb 27 '25 02:02 microchila

Hello, I am currently working on the medical image segmentation field and have completed the model training process. Could you please provide a corresponding testing script? Thank you very much!

lj-xh avatar Feb 27 '25 03:02 lj-xh

@microchila @lj-xh Hello! I had the same problem since there is no inference or test script. I made this one: https://github.com/sergiocanar/SegFormer3D_baseline/blob/main/experiments/brats2018/experiment5_final_sweep/inference.py that is on my forked repository of SegFormer3D. However I'm not sure if its the same that was used in the original implementation since I did not obtain similar metrics to the ones reported on the paper. Let me know if you guys figure it out or have any comments on my inference script

sergiocanar avatar Feb 27 '25 03:02 sergiocanar

@sergiocanar Hello! I ran your script and noticed that the visualized images are indeed different from those shown in the original paper. I think the reason might be that your script performs inference on preprocessed data instead of the original raw data. Based on your script, I made some modifications — feel free to try it out and see if it helps:inference.txt Also, make sure to add the following line under dataset_parameters: in your config file: brats_raw_root: "../../../data/brats2017_seg/brats2017_raw_data"

ubin-Hu avatar Jul 07 '25 05:07 ubin-Hu