Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I migrate pre-training weights into the training process in nnUNet? #371

Closed
tea321000 opened this issue Oct 29, 2020 · 2 comments
Closed

Comments

@tea321000
Copy link

Hi Isensee,
As mentioned in MrGiovanni/ModelsGenesis#31, I would like to pretrain the encoder of Generic_UNet by inheriting the trainer class, and then run the training process. I would like this to be done with the nnUNet_train command.

But when switching from pretraining to training, the trainer class will be changed (from my trainer class to nnUNetTrainerV2) and a new output folder will be created where the training will start from scratch instead of from the pretrained model weights.
How do I implement migrating the pretrained encoder model weights into the training process? Should I replace the Generic_UNet.py with my pre-trained network during the pre-training phase and recover it during the training phase? Looking forward to hearing from you soon.

@FabianIsensee
Copy link
Member

Hi,
please have a look at the run_training.py file. This file will instantiate the trainer class. After the trainer class has been instantiated, you can access the network via trainer.network. So you can add some lines here which will replace the parameters of the network with your pretrained ones.
Best,
Fabian

@tea321000
Copy link
Author

Thanks, I appreciate your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants