This function only care about state dict of model For other modules such as optimizer, resume learning, please refer @load_model
(model, weight_path)
| 41 | |
| 42 | |
| 43 | def load_pretrained(model, weight_path): |
| 44 | ''' |
| 45 | This function only care about state dict of model |
| 46 | For other modules such as optimizer, resume learning, please refer @load_model |
| 47 | ''' |
| 48 | state_dict = torch.load(weight_path)['state_dict'] |
| 49 | model.load_state_dict(state_dict, strict=True) |
| 50 | return model |
| 51 | |
| 52 | |
| 53 | def freeze_backbone(cfg, model): |