nnUNet icon indicating copy to clipboard operation
nnUNet copied to clipboard

nnUNetv2_predict.exe error

Open avBuffer opened this issue 1 year ago • 1 comments

(base) PS D:\workspace\nnUNet> nnUNetv2_predict.exe -i nnUNet_raw/Dataset001_BrainTumour/imagesTs -o out_results -d 001 -c 3d_fullres -f all -chk checkpoint_ best.pth --save_probabilities

####################################################################### Please cite the following paper when using nnU-Net: Isensee, F., Jaeger, P. F., Kohl, S. A., Petersen, J., & Maier-Hein, K. H. (2021). nnU-Net: a self-configuring method for deep learning-based biomedical imag e segmentation. Nature methods, 18(2), 203-211. #######################################################################

There are 1 cases in the source folder Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in run_code File "C:\ProgramData\anaconda3\Scripts\nnUNetv2_predict.exe_main.py", line 7, in File "D:\workspace\nnUNet\nnunetv2\inference\predict_from_raw_data.py", line 843, in predict_entry_point predictor.predict_from_files(args.i, args.o, save_probabilities=args.save_probabilities, File "D:\workspace\nnUNet\nnunetv2\inference\predict_from_raw_data.py", line 238, in predict_from_files self._manage_input_and_output_lists(list_of_lists_or_source_folder, File "D:\workspace\nnUNet\nnunetv2\inference\predict_from_raw_data.py", line 163, in _manage_input_and_output_lists caseids = [os.path.basename(i[0])[:-(len(self.dataset_json['file_ending']) + 5)] for i in ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\workspace\nnUNet\nnunetv2\inference\predict_from_raw_data.py", line 163, in caseids = [os.path.basename(i[0])[:-(len(self.dataset_json['file_ending']) + 5)] for i in ~^^^ IndexError: list index out of range (base) PS D:\workspace\nnUNet>

avBuffer avatar Feb 14 '24 03:02 avBuffer

Hi @avBuffer,

the problem seems to be with the matching in this line. Did you name your file for the predictions correctly, i.e. filename_0000.file_ending?

Best, Yannick

ykirchhoff avatar Feb 14 '24 10:02 ykirchhoff

Hi all,

I just run into the same problem. The reason in my case were additional files in the input folder (which of course did not have the required filename-structure filename_0000.file_ending) . After I removed them, everything worked as expected.

Best, Lukas

lukaspirpamer avatar Apr 19 '24 08:04 lukaspirpamer