def train_net(config): # enable cudnn cudnn.benchmark = True data_loader = get_loader(config) solver = Solver(config, data_loader=data_loader, device="cuda") solver.train()
def train_net(): # enable cudnn cudnn.benchmark = True data_loader = get_loader(dataset_config, config, mode="train") solver = Solver_makeupGAN(config, data_loader=data_loader, device="cuda") solver.train()
def train_net(config): # enable cudnn https://zhuanlan.zhihu.com/p/73711222 cudnn.benchmark = True data_loader = get_loader(config) #solver = Solver(config, data_loader=data_loader, device="cuda") solver = Solver(config, data_loader=data_loader, device=config.device) solver.train()
def train_net(): # enable cudnn cudnn.benchmark = True data_loaders = get_loader(config, mode="train") # return train&test #get the solver if args.model == 'cycleGAN': solver = Solver_cycleGAN(data_loaders, config, dataset_config) elif args.model == 'makeupGAN': solver = Solver_makeupGAN(data_loaders, config, dataset_config) else: print("model that not support") exit() solver.train()
def tes_net(): # enable cudnn cudnn.benchmark = True # get the DataLoader data_loaders = get_loader(dataset_config, config, mode="test") #get the solver if args.model == 'cycleGAN': solver = Solver_cycleGAN(data_loaders, config, dataset_config) elif args.model =='makeupGAN': solver = Solver_makeupGAN(data_loaders, config, dataset_config) else: print("model that not support") exit() solver.test()
def train_net(): # enable cudnn cudnn.benchmark = True data_loaders = get_loader(dataset_config, config, mode="train") solver = Solver_PSGAN(data_loaders, config, dataset_config) solver.train()
from config import config, dataset_config from dataloder import get_loader from psgan.inference import Inference from setup import setup_config, setup_argparser import numpy as np import neupeak.utils.webcv2 as cv2 args = setup_argparser().parse_args() config = setup_config(args) loader = get_loader(config) inference = Inference(config) for source_input, reference_input in loader: ret = inference.solver.test(*source_input, *reference_input) source = (source_input[0].squeeze(0).squeeze(0).numpy().transpose(1, 2, 0) + 1) / 2 reference = (reference_input[0].squeeze(0).squeeze(0).numpy().transpose( 1, 2, 0) + 1) / 2 mask_s = (source_input[1][0, :, 0].numpy().transpose(1, 2, 0) * 255 + 0.5).astype(np.uint8) mask_r = ( reference_input[1][0, :, 0].squeeze(2).numpy().transpose(1, 2, 0) * 255 + 0.5).astype(np.uint8) cv2.imshow("source", source[..., ::-1]) cv2.imshow("reference", reference[..., ::-1]) cv2.imshow("mask_s", mask_s) cv2.imshow("mask_r", mask_r) cv2.imshow("ret", np.asarray(ret)[..., ::-1]) cv2.waitKey()