def main(args): model = custom_model.buildModelStage3(args) optimizer, scheduler, records = solver_utils.configOptimizer(args, model) optimizers = [optimizer, -1] criterion = solver_utils.Stage3Crit(args) recorder = recorders.Records(args.log_dir, records) train_loader, val_loader = custom_data_loader.reflectanceDataloader(args) for epoch in range(args.start_epoch, args.epochs + 1): scheduler.step() recorder.insertRecord('train', 'lr', epoch, scheduler.get_last_lr()) train_utils.train(args, train_loader, model, criterion, optimizers, log, epoch, recorder) if epoch % args.save_intv == 0: model_utils.saveCheckpoint(args.cp_dir, epoch, model, optimizer, recorder.records, args) log.plotCurves(recorder, 'train') if epoch % args.val_intv == 0: test_utils.test(args, 'val', val_loader, model, log, epoch, recorder) log.plotCurves(recorder, 'val')
def main(args): train_loader, val_loader = custom_data_loader.customDataloader(args) model = custom_model.buildModel(args) optimizer, scheduler, records = solver_utils.configOptimizer(args, model) criterion = solver_utils.Criterion(args) recorder = recorders.Records(args.log_dir, records) tf_train_writer, tf_test_writer = tfboard.tensorboard_init() for epoch in range(args.start_epoch, args.epochs+1): scheduler.step() recorder.insertRecord('train', 'lr', epoch, scheduler.get_lr()[0]) train_utils.train(args, train_loader, model, criterion, optimizer, log, epoch, recorder, tf_train_writer) if epoch % args.save_intv == 0: model_utils.saveCheckpoint(args.cp_dir, epoch, model, optimizer, recorder.records, args) if epoch % args.val_intv == 0: test_utils.test(args, 'val', val_loader, model, log, epoch, recorder, tf_test_writer)