set batchnorm to eval() it is useful to align train and testing result
(model)
| 28 | return model |
| 29 | |
| 30 | def 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 | |
| 41 | def save_image_saliancy(tensor, path, normalize: bool = False, scale_each: bool = False,): |
| 42 | """ |
no outgoing calls
no test coverage detected