(net)
| 117 | |
| 118 | |
| 119 | def 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 | |
| 132 | def draw_det_res(dt_boxes, img, img_name, save_path): |
no test coverage detected