-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: dongy <dongy@nvidia.com> ### Description Adding nnunetv2 runner class to launch different steps in nnunet via Python APIs. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: dongy <dongy@nvidia.com> Signed-off-by: Wenqi Li <wenqil@nvidia.com> Co-authored-by: dongy <dongy@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Wenqi Li <wenqil@nvidia.com>
- Loading branch information
1 parent
81b25ae
commit eed660c
Showing
9 changed files
with
1,151 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ | |
"(^(monai._C))", | ||
"(.*(__main__)$)", | ||
"(.*(video_dataset)$)", | ||
"(.*(nnunet).*$)", | ||
] | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) MONAI Consortium | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from __future__ import annotations | ||
|
||
from .nnunetv2_runner import nnUNetV2Runner | ||
from .utils import NNUNETMode, analyze_data, create_new_data_copy, create_new_dataset_json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Copyright (c) MONAI Consortium | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
""" | ||
Examples: | ||
- User can use the one-liner to start the nnU-Net workflow | ||
.. code-block:: bash | ||
python -m monai.apps.nnunet nnUNetV2Runner run --input "./input.yaml" | ||
- convert dataset | ||
.. code-block:: bash | ||
python -m monai.apps.nnunet nnUNetRunner convert_dataset --input "./input_new.yaml" | ||
- convert msd datasets | ||
.. code-block:: bash | ||
python -m monai.apps.nnunet nnUNetRunner convert_msd_dataset \\ | ||
--input "./input.yaml" --data_dir "Task05_Prostate" | ||
- experiment planning and data pre-processing | ||
.. code-block:: bash | ||
python -m monai.apps.nnunet nnUNetRunner plan_and_process --input "./input.yaml" | ||
- single-gpu training for all 20 models | ||
.. code-block:: bash | ||
python -m monai.apps.nnunet nnUNetV2Runner train --input "./input.yaml" | ||
- single-gpu training for a single model | ||
.. code-block:: bash | ||
python -m monai.apps.nnunet nnUNetV2Runner train_single_model --input "./input.yaml" \\ | ||
--config "3d_fullres" \\ | ||
--fold 0 \\ | ||
--trainer_class_name "nnUNetTrainer_5epochs" \\ | ||
--export_validation_probabilities true | ||
- multi-gpu training for all 20 models | ||
.. code-block:: bash | ||
export CUDA_VISIBLE_DEVICES=0,1 # optional | ||
python -m monai.apps.nnunet nnUNetV2Runner train --input "./input.yaml" --num_gpus 2 | ||
- multi-gpu training for a single model | ||
.. code-block:: bash | ||
export CUDA_VISIBLE_DEVICES=0,1 # optional | ||
python -m monai.apps.nnunet nnUNetV2Runner train_single_model --input "./input.yaml" \\ | ||
--config "3d_fullres" \\ | ||
--fold 0 \\ | ||
--trainer_class_name "nnUNetTrainer_5epochs" \\ | ||
--export_validation_probabilities true \\ | ||
--num_gpus 2 | ||
- find best configuration | ||
.. code-block:: bash | ||
python -m monai.apps.nnunet nnUNetRunner find_best_configuration --input "./input.yaml" | ||
- predict, ensemble, and post-process | ||
.. code-block:: bash | ||
python -m monai.apps.nnunet nnUNetRunner predict_ensemble_postprocessing --input "./input.yaml" | ||
""" | ||
|
||
|
||
from __future__ import annotations | ||
|
||
from monai.apps.nnunet.nnunetv2_runner import nnUNetV2Runner | ||
|
||
if __name__ == "__main__": | ||
from monai.utils import optional_import | ||
|
||
fire, _ = optional_import("fire") | ||
fire.Fire({"nnUNetV2Runner": nnUNetV2Runner}) |
Oops, something went wrong.