Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot be inferred using the last model provided? #57

Open
liaochuanlin opened this issue Sep 17, 2023 · 2 comments
Open

Cannot be inferred using the last model provided? #57

liaochuanlin opened this issue Sep 17, 2023 · 2 comments

Comments

@liaochuanlin
Copy link

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
Copy link
Owner

Could you please share the command you using for evaluation?

@auroua
Copy link

auroua commented Jun 5, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants