Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
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