MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / replace_batchnorm

Function replace_batchnorm

tools/infer_det.py:119–129  ·  view source on GitHub ↗
(net)

Source from the content-addressed store, hash-verified

117
118
119def replace_batchnorm(net):
120 import torch
121 for child_name, child in net.named_children():
122 if hasattr(child, 'fuse'):
123 fused = child.fuse()
124 setattr(net, child_name, fused)
125 replace_batchnorm(fused)
126 elif isinstance(child, torch.nn.BatchNorm2d):
127 setattr(net, child_name, torch.nn.Identity())
128 else:
129 replace_batchnorm(child)
130
131
132def draw_det_res(dt_boxes, img, img_name, save_path):

Callers 2

_init_torch_modelMethod · 0.90
_init_torch_modelMethod · 0.85

Calls 1

fuseMethod · 0.45

Tested by

no test coverage detected