Пример #1
0
# load CUDA
cuda = torch.cuda.is_available()
torch.manual_seed(1)
if cuda:
    torch.cuda.manual_seed(1)
    model = model.cuda()

# load trainer
trainer = torchsrc.Trainer(
    cuda=cuda,
    model=model,
    optimizer=optim,
    #train_loader=train_loader,
    test_loader=test_loader,
    out=out,
    outmodel=outmodel,
    max_epoch=epoch_num,
    batch_size=batch_size,
    lmk_num=lmk_num,
    finetune=finetune,
    fineepoch=fineepoch)

print("==start training==")

start_epoch = 0
start_iteration = 1
trainer.epoch = start_epoch
trainer.iteration = start_iteration
trainer.test_epoch()
Пример #2
0
# optim = torch.optim.SGD(model.parameters(), lr=learning_curve() _rate, momentum=0.9)

# load CUDA
cuda = torch.cuda.is_available()
torch.manual_seed(1)
if cuda:
    torch.cuda.manual_seed(1)
    model = model.cuda()

# load trainer
trainer = torchsrc.Trainer(
    cuda=cuda,
    model=model,
    optimizer=optim,
    train_loader=train_loader,
    # val_loader=val_loader,
    test_loader=test_loader,
    out=out,
    max_epoch=epoch_num,
    batch_size=batch_size,
    lmk_num=lmk_num,
)

print("==start training==")

start_epoch = 0
start_iteration = 1
trainer.epoch = start_epoch
trainer.iteration = start_iteration
trainer.train_epoch()
Пример #3
0
cuda = torch.cuda.is_available()
#cuda = False
torch.manual_seed(1)
if cuda:
    torch.cuda.manual_seed(1)
    model = model.cuda()

# load trainer
trainer = torchsrc.Trainer(
    cuda=cuda,
    model=model,
    optimizer=optim,
    train_loader=train_loader,
    test_loader=test_loader,
    out=out,
    max_epoch=epoch_num,
    batch_size=batch_size,
    lmk_num=clss_num,
    dual_network=dual_network,
    add_calcium_mask=add_calcium_mask,
    use_siamese=use_siamese,
    siamese_coeiff=siamese_coeiff,
)

print("==start training==")

start_iteration = 1
trainer.epoch = start_epoch
if ValidateAttention:
    trainer.epoch = 84
    trainer.max_epoch = trainer.epoch + 1
Пример #4
0
#
# load optimizor
# optim = torch.optim.SGD(model.parameters(), lr=learning_curve() _rate, momentum=0.9)

# load CUDA
cuda = torch.cuda.is_available()
torch.manual_seed(1)
if cuda:
    torch.cuda.manual_seed(1)
    model = model.cuda()

# load trainer
trainer = torchsrc.Trainer(
    cuda=cuda,
    model=model,
    test_loader=test_loader,
    train_root_dir=train_root_dir,
    out=out,
    max_epoch=epoch_num,
    batch_size=batch_size,
    lmk_num=lmk_num,
)

print("==start testing==")

start_epoch = 0
start_iteration = 1
trainer.epoch = start_epoch
trainer.iteration = start_iteration
trainer.test_epoch()
Пример #5
0
start_epoch = 0
start_iteration = 1

optim = torch.optim.Adam(model.parameters(),
                         lr=learning_rate,
                         betas=(0.9, 0.999))

trainer = torchsrc.Trainer(
    cuda=cuda,
    model=model,
    optimizer=optim,
    train_loader=train_loader,
    test_loader=test_loader,
    out=out,
    network_num=network_num,
    max_epoch=epoch_num,
    compete=compete,
    GAN=GAN,
    batch_size=lmk_batch_size,
    lmk_num=lmk_num,
    onlyEval=onlyEval,
    view=viewName,
    loss_fun=loss_fun,
    noLSGAN=noLSGAN,
)

print("==start training==")
print("==view is == %s " % viewName)

start_epoch = 0
start_iteration = 1
trainer.epoch = start_epoch