Exemplo n.º 1
0
def load_expert_discriminator(path):
    discriminator = SyncNet()
    print("Load sync net checkpoint from: {}".format(path))
    discriminator_checkpoint = _load(path)
    s = discriminator_checkpoint["state_dict"]
    new_s = {}
    for k, v in s.items():
        new_s[k.replace('module.', '')] = v
    discriminator.load_state_dict(new_s)

    discriminator = discriminator.to(device)
    return discriminator.eval()
Exemplo n.º 2
0
def load_expert(path):
    model = SyncNet_color()
    print("Load checkpoint from: {}".format(path))
    checkpoint = _load(path)
    s = checkpoint["state_dict"]
    new_s = {}
    for k, v in s.items():
        new_s[k.replace('module.', '')] = v
    model.load_state_dict(new_s)

    model = model.to(device)
    return model.eval()
Exemplo n.º 3
0
def load_model(path):
    model = SyncNet_color()
    print("Load checkpoint from: {}".format(path))
    checkpoint = _load(path)
    s = checkpoint["state_dict"]
    new_s = {}
    for k, v in s.items():
        new_s[k.replace('module.', '')] = v
    model.load_state_dict(new_s)

    model = model.to(device)
    for p in model.parameters():
        p.reguires_grad = False
    return model.eval()