diff --git a/totalspineseg/inference.py b/totalspineseg/inference.py index 162e1e2..4142f85 100644 --- a/totalspineseg/inference.py +++ b/totalspineseg/inference.py @@ -298,7 +298,7 @@ def main(): # Get the nnUNet parameters from the results folder nnUNetTrainer, nnUNetPlans, configuration = next((nnUNet_results / step1_dataset).glob('*/fold_*')).parent.name.split('__') # Check if the final checkpoint exists, if not use the latest checkpoint - checkpoint = 'checkpoint_final.pth' if (nnUNet_results / step1_dataset / f'{nnUNetTrainer}__{nnUNetPlans}__{configuration}' / f'fold_{fold}' / 'checkpoint_final.pth').is_file() else 'checkpoint_latest.pth' + checkpoint = 'checkpoint_final.pth' if (nnUNet_results / step1_dataset / f'{nnUNetTrainer}__{nnUNetPlans}__{configuration}' / f'fold_{fold}' / 'checkpoint_final.pth').is_file() else 'checkpoint_best.pth' if not quiet: print('\n' 'Running step 1 model:') subprocess.run([ @@ -549,7 +549,7 @@ def main(): # Get the nnUNet parameters from the results folder nnUNetTrainer, nnUNetPlans, configuration = next((nnUNet_results / step2_dataset).glob('*/fold_*')).parent.name.split('__') # Check if the final checkpoint exists, if not use the latest checkpoint - checkpoint = 'checkpoint_final.pth' if (nnUNet_results / step2_dataset / f'{nnUNetTrainer}__{nnUNetPlans}__{configuration}' / f'fold_{fold}' / 'checkpoint_final.pth').is_file() else 'checkpoint_latest.pth' + checkpoint = 'checkpoint_final.pth' if (nnUNet_results / step2_dataset / f'{nnUNetTrainer}__{nnUNetPlans}__{configuration}' / f'fold_{fold}' / 'checkpoint_final.pth').is_file() else 'checkpoint_best.pth' if not quiet: print('\n' 'Running step 2 model:') subprocess.run([