MCPcopy Create free account
hub / github.com/chenhaoxing/HDNet / __init__

Method __init__

models/hdnet_model.py:11–31  ·  view source on GitHub ↗
(self, opt)

Source from the content-addressed store, hash-verified

9
10class HDNetModel(BaseModel):
11 def __init__(self, opt):
12 BaseModel.__init__(self, opt)
13 # specify the training losses you want to print out. The training/test scripts will call <BaseModel.get_current_losses>
14 self.loss_names = ['G_L1']
15 # specify the images you want to save/display. The training/test scripts will call <BaseModel.get_current_visuals>
16 self.visual_names = ['comp', 'real', 'output', 'mask', 'real_f', 'fake_f', 'bg', 'attentioned']
17 # specify the models you want to save to the disk. The training/test scripts will call <BaseModel.save_networks> and <BaseModel.load_networks>
18 if self.isTrain:
19 self.model_names = ['G']
20 else:
21 self.model_names = ['G']
22 # define networks (both generator and discriminator)
23 self.netG = networks.define_G(opt.input_nc, opt.output_nc, opt.ngf, opt.netG, opt.normG,
24 not opt.no_dropout, opt.init_type, opt.init_gain, self.gpu_ids)
25 self.relu = nn.ReLU()
26 if self.isTrain:
27 # define loss functions
28 self.criterionL1 = MaskWeightedMSE(100)
29 # initialize optimizers; schedulers will be automatically created by function <BaseModel.setup>.
30 self.optimizer_G = torch.optim.Adam(self.netG.parameters(), lr=opt.lr*opt.g_lr_ratio, betas=(opt.beta1, 0.999))
31 self.optimizers.append(self.optimizer_G)
32
33 def set_input(self, input):
34 """Unpack input data from the dataloader and perform necessary pre-processing steps.

Callers

nothing calls this directly

Calls 1

MaskWeightedMSEClass · 0.85

Tested by

no test coverage detected