MCPcopy Index your code
hub / github.com/ActiveVisionLab/DFNet / freeze_bn_layer_train

Function freeze_bn_layer_train

script/utils/utils.py:30–39  ·  view source on GitHub ↗

set batchnorm to eval() it is useful to align train and testing result

(model)

Source from the content-addressed store, hash-verified

28 return model
29
30def freeze_bn_layer_train(model):
31 ''' set batchnorm to eval()
32 it is useful to align train and testing result
33 '''
34 # model.train()
35 # print("Freezing BatchNorm Layers...")
36 for module in model.modules():
37 if isinstance(module, nn.BatchNorm2d):
38 module.eval()
39 return model
40
41def save_image_saliancy(tensor, path, normalize: bool = False, scale_each: bool = False,):
42 """

Callers 4

train_on_batchFunction · 0.90
train_on_epochFunction · 0.90
train_on_epochFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected