-
Notifications
You must be signed in to change notification settings - Fork 32
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
ivadomed
to nnunetv2
backend migration
#800
base: master
Are you sure you want to change the base?
Conversation
''' | ||
import pprint | ||
|
||
MODELS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for testing, check if URLs exist
Had to bump python version to 3.11 but this currently causes problems with CI... |
…ure what I am doing)
Unpinning imageio fixed it. Now it gets 2.33 I think which is good enough. |
AxonDeepSeg/apply_model.py
Outdated
predictor.predict_from_files( | ||
list_of_lists_or_source_folder=input_list, | ||
output_folder_or_list_of_truncated_output_files=output_list, | ||
save_probabilities=False, | ||
overwrite=False, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
damn this is something I didn't expect... we trained all nnunet models on grayscale images, meaning they have a single channel. While trying axon_segmentation()
, I encountered an image that, although looking black and white, was saved in RGB format (meaning 3 channels). This makes nnunet fail directly and unfortunately, from my experience, this is a very common occurence.
We thus have 2 options:
- before inference, read all images and if they are in RGB format, save a grayscale conversion in PNG format + update input filenames list
- use
nnUNetPredictor.predict_from_list_of_npy_arrays
instead ofnnUNetPredictor.predict_from_list_of_files
. I don't link this option because it adds a lot of complexity to this PR: we will need to manage the RAM on our side and it will be a problem for large number of inputs. By comparison, I currently usepredict_from_list_of_files
which is memory efficient.
Checklist
Description
This PR replaces the
ivadomed
dependency withnnunetv2
. The old models will unfortunately no longer be supported directly, but they can always be used by reverting to an earlier commit. The main changes aredownload_models.py
where URLs to the 3 standard ivadomed models were hardcoded; this script now only downloads one model at a time (generalist model by default)segment.py
where some ivadomed-related options are no longer available. Input resampling is also applied on our side now (it was previously done in ivadomed itself based on the input px size VS training px size)apply_model.py
; here, we now use the nnunet inference function instead ofivadomed.inference.imed_inference()
Linked issues
Resolves #765 (master issue)
Addresses #797 (download_model refactoring)
Addresses #798 (segmentation CLI refactoring)
Addresses #799 (model cards)