MIC-DKFZ / nnUNet

Apache License 2.0
5.86k stars 1.75k forks source link

Question: Only train the 2d case #1780

Closed iffthomas closed 1 year ago

iffthomas commented 1 year ago

Due to the fact that I have rather big images, I was curious if it's possible to train only on the 2D-Case? I'm using monai's implementation of nnunetv2 and what I try to do is to delete all 3d_lowres, 3d_fullres configurations and then call

python -m monai.apps.nnunet nnUNetV2Runner run--input_config='./input.yaml' --trainer_class_name nnUNetTrainer_250epoch"

to run the whole pipeline in one bit only for the 2D case

Does someone have experience on this matter?

LIKP0 commented 1 year ago

Hello,

I haven't tried nnUNet with monai, and I think just use the nnUNet of this repo is good enough? To do segmentation of 2d, see how_to_use_nnunet#model-training

In details, the command is nnUNetv2_train DATASET_NAME_OR_ID UNET_CONFIGURATION FOLD. The UNET_CONFIGURATION should be 2d

Lars-Kraemer commented 1 year ago

Hey @iffthomas,

I haven't worked with monai so far but when looking at the docs I think there is no way to do this when using the run command. https://docs.monai.io/en/stable/apps.html#monai.apps.nnunet.nnUNetV2Runner.run

As far as I understand it, you have to run the steps of the nnUNet pipeline manually. There it is possible to specify to only train 2d (using the --c and --config parameters).

You have to run the following stages

convert_dataset plan_and_process (add --c 2d) train (add --configs 2d) find_best_configuration (add --configs 2d) predict_ensemble_postprocessing

Look at the monai docs for more details: https://docs.monai.io/en/stable/apps.html#module-monai.apps.nnunet.__main__

Best, Lars

iffthomas commented 1 year ago

Hi Lars,

Thank you for the reply. I will have a look into it. Your proposed approach seems quite straight forward and it works sofar. Again I appreaciate the answer.

Best Thomas