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

Subject: Inquiry on Using Pre-trained Models for Transfer Learning with ClinicaDL #476

Open
mtmmu88 opened this issue Sep 13, 2023 · 7 comments

Comments

@mtmmu88
Copy link

mtmmu88 commented Sep 13, 2023

Dear Author

I hope this message finds you well. I am interested in using a pre-trained model you have provided for transfer learning tasks with ClinicaDL. I have successfully downloaded the model, which contains the best_model and performances folders as expected.

However, I have encountered difficulties in implementing this for my own dataset using ClinicaDL's predict command. Specifically, I keep getting an error related to MAPS (Model-Data Architecture), stating that MAPS were not found at the specified directory.

I have verified that the directory structure is correct and even tried upgrading ClinicaDL to the latest version, but the issue persists.

My questions are:

1.Is it possible to use the pre-trained model for transfer learning tasks with ClinicaDL?
2.If yes, could you please provide specific steps or examples on how to properly implement this?
3.Are there any special configurations or files needed to be added to the best_model or performances folders for the transfer learning to work?
Your guidance will be invaluable for me to proceed further in my research. Thank you in advance for your time and assistance.

Best regards.
Feel free to modify this template to suit your specific situation. Good luck!

@camillebrianceau
Copy link
Collaborator

camillebrianceau commented Sep 13, 2023

Hi @mtmmu88,

Thanks for using ClinicaDL,

Have you successfully downloaded it from this address? Yes, it is possible to utilize these pre-trained models for transfer learning tasks with ClinicaDL.

I've personally tested it, and it's working for me. Here's the command line you should use:
clinicadl predict path_to_maps data_group --caps_directory path_to_capsi --participants_tsv path_to_tsv

If it still doesn't work, please send us the full error message so we can investigate further.

Please note that your dataset must be in a CAPS format, and you should verify the required preprocessing steps in the maps.json file within the results folder (for these models, you need ROI, so you should have masks in your CAPS dataset). If these preprocessing steps haven't been performed, execute the preprocessing pipeline as well as clinicadl extract to obtain tensor versions of the images.

For more detailed instructions, you can refer to our tutorial

Bests regards,
Camille

@mtmmu88
Copy link
Author

mtmmu88 commented Sep 14, 2023

Dear Camille,

Thank you for your previous guidance. Despite following the instructions and recommendations you provided, I continue to face issues when trying to use the pre-trained model with ClinicaDL.

The latest error I'm encountering is: 'MapsManager' object has no attribute 'size_reduction'. This issue persists even after verifying that the data is in CAPS format, checking the maps.json file, and upgrading to the latest version of ClinicaDL.

Additionally, I have downloaded a model from this Zenodo link. Could you confirm if this specific model can be used for transfer learning tasks with ClinicaDL?

Could you please offer further advice or guidance on how to resolve these issues?

Thank you once again for your time and assistance. Your expertise is greatly appreciated as I continue my research.

Best regards

@mtmmu88
Copy link
Author

mtmmu88 commented Sep 14, 2023

File "/home/zzc/miniconda3/envs/ClinicaDL/bin/clinicadl", line 8, in
sys.exit(cli())
File "/home/zzc/miniconda3/envs/ClinicaDL/lib/python3.8/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
File "/home/zzc/miniconda3/envs/ClinicaDL/lib/python3.8/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/zzc/miniconda3/envs/ClinicaDL/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/zzc/miniconda3/envs/ClinicaDL/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/zzc/miniconda3/envs/ClinicaDL/lib/python3.8/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/zzc/miniconda3/envs/ClinicaDL/lib/python3.8/site-packages/clinicadl/predict/predict_cli.py", line 113, in cli
predict(
File "/home/zzc/miniconda3/envs/ClinicaDL/lib/python3.8/site-packages/clinicadl/predict/predict.py", line 62, in predict
maps_manager.predict(
File "/home/zzc/miniconda3/envs/ClinicaDL/lib/python3.8/site-packages/clinicadl/utils/maps_manager/maps_manager.py", line 231, in predict
size_reduction=self.size_reduction,
File "/home/zzc/miniconda3/envs/ClinicaDL/lib/python3.8/site-packages/clinicadl/utils/maps_manager/maps_manager.py", line 114, in getattr
raise AttributeError(f"'MapsManager' object has no attribute '{name}'")

@camillebrianceau
Copy link
Collaborator

Hi,

The issue at hand is that the maps available for download are quite outdated, and there have been several changes to ClinicaDL since then. In particular, we've introduced new options that are not present in the maps.json file downladed with the maps. This is an oversight on our part and we will work to rectify it.

For now, you can make the following additions to your maps.json file, which should anable it to work:

size_reduction=false
size_reduction_factor=2

Regarding the models you've downloaded, as indicated on the zenodo page, they appear to be compatible with ClinicaDL v0.0.1. However, I cannot guarantee compatibility with the latest version. The models available here are designed for a higher version (v1.0.0), but you might encounter issues with the maps.json file due to new options introduced since version 1.0.0.

We are working on finding a solution to make all these models compatible with the latest version of ClinicaDL/ I will keep you updated on our progress.

Bests,
Camille

@mtmmu88
Copy link
Author

mtmmu88 commented Sep 15, 2023

Dear ClinicaDL Team,

I am writing to bring to your attention an issue I encountered while trying to run predictions using a pretrained model in ClinicaDL. I followed the instructions in the official documentation but encountered an error.

Here are the details:

Command Used: clinicadl predict --no-gpu /home/zzc/test_adni/INPUT_MAPS_DIRECTORY/maps_exp3/maps /home/zzc/test_adni/DATA_GROUP
Error Message: NotImplementedError: Non-relative patterns are unsupported
I have verified that the maps.json and data.tsv files are in the correct directories as specified in the documentation. I am using the latest version of ClinicaDL and all dependencies are up to date.

Could you please provide some guidance on how to resolve this issue? Your assistance would be greatly appreciated.

Thank you for your time and consideration.
Additional Information:

I have also tried the following steps to resolve the issue:

Moved data.tsv into the DATA_GROUP directory.
Copied maps.json from INPUT_MAPS_DIRECTORY to DATA_GROUP.
Checked all paths and command-line parameters.
Reviewed the official documentation for any additional steps or precautions.
Despite these efforts, the issue remains unresolved. I am particularly interested in using the pretrained model for transfer learning on a new dataset. Could you please provide further guidance?

@camillebrianceau
Copy link
Collaborator

Hi @mtmmu88 ,

Can you please send us the full error message so we can investigate further ?

Thanks,
Camille

@mtmmu88
Copy link
Author

mtmmu88 commented Oct 17, 2023 via email

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

2 participants