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

Support for partial encoder freezing #341

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

DavidWAbrahams
Copy link

@DavidWAbrahams DavidWAbrahams commented May 28, 2020

Allow you to freeze the backbone encoder partially. For example, you can set encoder_freeze=0.8 which will make the first 80% layers untrainable, and leave the last 20% trainable.

This lets you tune the trainability of your network.

I freeze early layers first because: early layers learn basic features that are less likely to change between data sets. Late layers learn abstract features that may change more between data sets.

In my experiment, setting a 95% freeze was good for accuracy AND training speed for Unet + inceptionv3 on the Oxford-IIIT Pet dataset (code at https://github.com/AllWashedOut/pet_segmentation)

0% frozen

python .\model.py --patience=10 --encoder_freeze_percent=0.0
Test accuracy: 90.0%. Epoch time: 60s

95% frozen

python .\model.py --patience=10 --encoder_freeze_percent=0.95
Test accuracy: 91.13%. Epoch time: 52s

100% frozen

python .\model.py --patience=10 --encoder_freeze_percent=1.0
Test accuracy: 90.99%. Epoch time: 50s

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

Successfully merging this pull request may close these issues.

None yet

1 participant