Skip to content

Commit

Permalink
run nnunet test with body task
Browse files Browse the repository at this point in the history
  • Loading branch information
wasserth committed Nov 27, 2024
1 parent 1de4511 commit 48d7818
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/tests_nnunet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
def run_tests_and_exit_on_failure():

# Download weights
download_pretrained_weights(297) # total 3mm
# download_pretrained_weights(297) # total 3mm
download_pretrained_weights(300) # body 6mm

# Set nnUNet_results env var
weights_dir = Path.home() / ".totalsegmentator" / "nnunet" / "results"
Expand All @@ -31,7 +32,10 @@ def run_tests_and_exit_on_failure():
shutil.copy("tests/reference_files/example_ct_sm.nii.gz", "tests/nnunet_input_files/example_ct_sm_0000.nii.gz")

# Run nnunet
subprocess.call(f"nnUNetv2_predict -i tests/nnunet_input_files -o tests/nnunet_input_files -d 297 -tr nnUNetTrainer_4000epochs_NoMirroring -c 3d_fullres -f 0 -device cpu", shell=True)
# Task 297
# subprocess.call(f"nnUNetv2_predict -i tests/nnunet_input_files -o tests/nnunet_input_files -d 297 -tr nnUNetTrainer_4000epochs_NoMirroring -c 3d_fullres -f 0 -device cpu", shell=True)
# Task 300
subprocess.call(f"nnUNetv2_predict -i tests/nnunet_input_files -o tests/nnunet_input_files -d 300 -tr nnUNetTrainer -c 3d_fullres -f 0 -device cpu", shell=True)

# Check if output file exists
assert os.path.exists("tests/nnunet_input_files/example_ct_sm.nii.gz"), "A nnunet output file was not generated."
Expand Down

0 comments on commit 48d7818

Please sign in to comment.