MIC-DKFZ / nnUNet

Apache License 2.0
5.86k stars 1.75k forks source link

nnUNetPredictor should have a seperate option to return predictions #2387

Open scarere opened 3 months ago

scarere commented 3 months ago

the predict_from_data_iterator method and hence by extension predict_from_files and predict_from_npy etc. only return the predicted annotations (and maybe predicted probabilities) if the list of output files is set to None. There should be a separate option to return this information so that the data can both be saved and returned to the user. Additionally there should be options to return the list of ofiles associated with each sample, or at the very least the case identifiers, as well as the data properties for each sample so that the data can be saved manually by the user later on should they so choose.

TaWald commented 1 day ago

What is your exact use-case? Why would a user ever want to save images conditionally? Is there a reason why you would need to do this during inference and not just after inference concluded in a separate postprocessing step?

scarere commented 16 hours ago

The main reason would be to prevent the additional I/O of having to load all the images again in order to do evaluation/postprocessing. I was trying to make a script that did everything in one go. I could have them returned and save them manually, but since the case_id's are not returned, I don't know what to save them as or which case is what