Amshaker / unetr_plus_plus

[IEEE TMI-2024] UNETR++: Delving into Efficient and Accurate 3D Medical Image Segmentation
Apache License 2.0
340 stars 32 forks source link

Cannot be inferred using the last model provided? #57

Open liaochuanlin opened 11 months ago

liaochuanlin commented 11 months ago

Task003_tumor Cannot be inferred using the last model provided? Traceback (most recent call last): File "/home/lcl/unetr_plus_plus/unetr_pp/training/model_restore.py", line 168, in trainer = restore_model(pkl, checkpoint, train) File "/home/lcl/unetr_plus_plus/unetr_pp/training/model_restore.py", line 58, in restore_model info = load_pickle(pkl_file) File "/home/lcl/anaconda3/envs/unetr_pp/lib/python3.8/site-packages/batchgenerators/utilities/file_and_folder_operations.py", line 50, in load_pickle a = pickle.load(f) _pickle.UnpicklingError: A load persistent id instruction was encountered, but no persistent_load function was specified.

Amshaker commented 7 months ago

Could you please share the command you using for evaluation?

auroua commented 3 months ago

@Amshaker

I encounter the same problem, and find that the evaluation code of BraTS is different from the other datasets.

The run_evaluation_turom.sh uses the unetr_pp/inference/predict_simple.py to generate the prediction, while other datasets using the run_training.py to generate segment masks.

The predict_simple.py calls the function restore_model from unetr_plus_plus/unetr_pp/training/model_restore.py to load the pre-trained weights.

The first line of restore_model loads the pre-trained weights in the .pkl format, but the pre-trained weights are in the .model format, which causes the problem above.

You can repeat the above error by running the evaluation_scripts/run_evaluation_turmor.sh directly.

Could you provide the pre-trained weights in .pkl format, as the mix of training and inference code together is hard to use.

I think inference the segment mask of raw input using the predict_simple.py is more reasonable than using the unetr_pp/run/run_training.py.