Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changing the implementation of
predict_single_npy_array
from parallel to sequential.By default, using
predict_single_npy_array
usesPreprocessAdapterFromNpy
which creates an additional process for loading the data. This process is not needed because the data was already read into a npy array and is passed to nnUNet. This is also faster because Tensors do not need to be transferred between processes.predict_single_npy_array
does not benefit from parallelism in any situation and the users would benefit more for being able to parallelize themselvespredictor.predict_single_npy_array
.Adding support for sequential prediction from files
This allows running
nnUNetv2_predict
with a single process. This allows using less RAM usage pernnUNetv2_predict
and better parallelization across GPUs when running multiplennUNetv2_predict
.Previous behavior
To reduce RAM usage when doing prediction you could use
nnUNetv2_predict ... -npp 1 -nps 1
.Current behavior
Now you can use
nnUNetv2_predict ... -npp 0 -nps 0
. It uses less RAM. It is faster when used only for 1 file or parallelized across many GPUs with-num_parts X
.