def _default_opt(self):
     self.opt = opt.opt()
     self.opt.save_dir = 'checkpoints'
     self.opt.name = 'Facelet'
     self.opt.lr = 1e-4
     self.opt.pretrained = True
     self.opt.effect = 'facehair'
 def __init__(self, opt=opt.opt()):
     super(Facelet, self).__init__()
     self._default_opt()
     self.opt = self.opt.merge_opt(opt)
     self._define_model()
     self._define_optimizer()
     if self.opt.pretrained:
         state_dict = util.load_from_url(model_urls[self.opt.effect], save_dir=facelet_path)
         model_dict = self.model.state_dict()
         model_dict.update(state_dict)
         self.model.load_state_dict(model_dict)
 def __init__(self, model, option=opt.opt()):
     super(optimizer, self).__init__()
     self._default_opt()
     self.opt.merge_opt(option)
     self._get_model(model)
     self._get_aux_nets()
     self._define_optim()
     # self.writer = curves.writer(log_dir=self.opt.save_dir + '/log')
     util.mkdir(self.opt.save_dir + '/log')
     self.writer = tensorboardX.SummaryWriter(log_dir=self.opt.save_dir +
                                              '/log')
     if self.opt.continue_train:
         self.load()
 def _default_opt(self):
     self.opt = opt.opt()
     self.opt.save_dir = '/checkpoints/default'
     self.opt.n_discrim = 5
Exemple #5
0
 def _default_opt(self):
     self.opt = opt.opt()
     self.opt.continue_train = False
     self.opt.lr = 1e-3