what.models.detection.ssd.utils.misc API documentation

# what.models.detection.ssd.utils.misc

View Source

     1import torch
     2
     3
     4def save_checkpoint(epoch, net_state_dict, optimizer_state_dict, best_score, checkpoint_path, model_path):
     5    torch.save({
     6        'epoch': epoch,
     7        'model': net_state_dict,
     8        'optimizer': optimizer_state_dict,
     9        'best_score': best_score
    10    }, checkpoint_path)
    11    torch.save(net_state_dict, model_path)
    12
    13
    14def load_checkpoint(checkpoint_path):
    15    return torch.load(checkpoint_path)
    16
    17
    18def freeze_net_layers(net):
    19    for param in net.parameters():
    20        param.requires_grad = False

def save_checkpoint( epoch, net_state_dict, optimizer_state_dict, best_score, checkpoint_path, model_path): View Source

     5def save_checkpoint(epoch, net_state_dict, optimizer_state_dict, best_score, checkpoint_path, model_path):
     6    torch.save({
     7        'epoch': epoch,
     8        'model': net_state_dict,
     9        'optimizer': optimizer_state_dict,
    10        'best_score': best_score
    11    }, checkpoint_path)
    12    torch.save(net_state_dict, model_path)

def load_checkpoint(checkpoint_path): View Source

    15def load_checkpoint(checkpoint_path):
    16    return torch.load(checkpoint_path)

def freeze_net_layers(net): View Source

    19def freeze_net_layers(net):
    20    for param in net.parameters():
    21        param.requires_grad = False