learn.bn_freeze(True): how/when to use?

Hi all;

I see this command learn.bn_freeze(True) in several notebooks, often following learn.unfreeze().

How does it work ?
When to use it ?
What relation with learn.unfreeze() ?

1 Like

There’s been a few threads touching on this http://forums.fast.ai/search?expanded=true&q=bn_freeze . Hopefully you’ll find they answer your question - if not, feel free to post a followup of course.

I searched for ‘learn.bn_freeze(True)’, not ‘bn_freeze’.

Thanks for the tips !

E.

Looks like bn_freeze(True) following a call to learn.unfreeze() is mentioned in the Lesson3 notes
DeepLearning-LecNotes3:

Note: If Images are of size between 200-500px and arch > 34 e.g. resnet50 then add bn_freeze(True)

learn.unfreeze()
learn.bn_freeze(True)
%time learn.fit([1e-5, 1e-4,1e-2], 1, cycle_len=1)

And the best discussion I could find as to why we should do this is here: Freezing batch norm but I’m still trying to wrap my head around it.

1 Like

Refer timlee’s wonderful quick notes
(above is part of it)

4 Likes