wasserth / TotalSegmentator

Tool for robust segmentation of >100 important anatomical structures in CT and MR images
Apache License 2.0
1.41k stars 237 forks source link

RuntimeError: Encountered inf in predicted array. Aborting... #346

Open hari3100 opened 1 month ago

hari3100 commented 1 month ago

This is a awesome ripo, Thank you @wasserth for this. Im using on my laptop with a intel core i7 with no gpu in it . python==3.10, torch==2.4.0 , i tried using the totalsegmentator v2.3.0 still the issue is there , i was first on the lastest version as of now that is 2.40 where i first got this error. is it normal for a system of my configeration to take 11 to 13 mins to produce result from a nifti file , or was I taking so long because I was ought to get this error?

my code: import nibabel as nib from totalsegmentator.python_api import totalsegmentator

input_path = 'D:\Totalsegmentator\data\lung_003.nii.gz' output_path = 'D:\Totalsegmentator\data\mask\output from ts' zone = ['lung_upper_lobe_left', 'lung_lower_lobe_left', 'lung_upper_lobe_right', 'lung_middle_lobe_right', 'lung_lower_lobe_right']

if name == "main": input_img = nib.load(input_path) output_img = totalsegmentator(input_img, ml=True, roi_subset_robust=zone) nib.save(output_img, output_path)

Error:


RuntimeError Traceback (most recent call last) Cell In[17], line 8 1 if name == "main": 2 # # option 1: provide input and output as file paths 3 # totalsegmentator(input_path, output_path, fast=True, roi_subset_robust=["lung_upper_lobe_left", "lung_lower_lobe_left", "lung_upper_lobe_right", 4 # "lung_middle_lobe_right", "lung_lower_lobe_right"]) 5
6 # option 2: provide input and output as nifti image objects 7 input_img = nib.load(input_path) ----> 8 output_img = totalsegmentator(input_img, ml=True, roi_subset_robust=zone) 9 nib.save(output_img, output_path)

..... 606 del predicted_logits, n_predictions, prediction, gaussian, workon

RuntimeError: Encountered inf in predicted array. Aborting... If this problem persists, reduce value_scaling_factor in compute_gaussian or increase the dtype of predicted_logits to fp32

Did anyone face this error ?

Thank you for any help provided.

wasserth commented 1 month ago

This is a known issue and needs to be solved by nnUNet: https://github.com/MIC-DKFZ/nnUNet/issues/2396

hari3100 commented 3 weeks ago

This is a known issue and needs to be solved by nnUNet: MIC-DKFZ/nnUNet#2396

Is it solved yet from their end ?