(self, opt)
| 49 | return parser |
| 50 | |
| 51 | def __init__(self, opt): |
| 52 | BaseModel.__init__(self, opt) |
| 53 | |
| 54 | # specify the training losses you want to print out. |
| 55 | # The training/test scripts will call <BaseModel.get_current_losses> |
| 56 | self.loss_names = ['D_A', 'G_A', 'NCE1', 'D_B', 'G_B', 'NCE2', 'G', 'Sim'] |
| 57 | visual_names_A = ['real_A', 'fake_B'] |
| 58 | visual_names_B = ['real_B', 'fake_A'] |
| 59 | self.nce_layers = [int(i) for i in self.opt.nce_layers.split(',')] |
| 60 | |
| 61 | if opt.nce_idt and self.isTrain: |
| 62 | self.loss_names += ['idt_B', 'idt_A'] |
| 63 | visual_names_A.append('idt_A') |
| 64 | visual_names_B.append('idt_B') |
| 65 | |
| 66 | self.visual_names = visual_names_A + visual_names_B # combine visualizations for A and B |
| 67 | |
| 68 | if self.isTrain: |
| 69 | self.model_names = ['G_A', 'F1', 'D_A', 'G_B', 'F2', 'D_B', 'F3', 'F4', 'F5', 'F6'] |
| 70 | else: # during test time, only load G |
| 71 | self.model_names = ['G_A', 'G_B'] |
| 72 | |
| 73 | # define networks (both generator and discriminator) |
| 74 | self.netG_A = networks.define_G(opt.input_nc, opt.output_nc, opt.ngf, opt.netG, opt.normG, |
| 75 | not opt.no_dropout, opt.init_type, opt.init_gain, opt.no_antialias, |
| 76 | opt.no_antialias_up, self.gpu_ids, opt) |
| 77 | self.netG_B = networks.define_G(opt.input_nc, opt.output_nc, opt.ngf, opt.netG, opt.normG, |
| 78 | not opt.no_dropout, opt.init_type, opt.init_gain, opt.no_antialias, |
| 79 | opt.no_antialias_up, self.gpu_ids, opt) |
| 80 | self.netF1 = networks.define_F(opt.input_nc, opt.netF, opt.normG, |
| 81 | not opt.no_dropout, opt.init_type, opt.init_gain, opt.no_antialias, self.gpu_ids, |
| 82 | opt) |
| 83 | self.netF2 = networks.define_F(opt.input_nc, opt.netF, opt.normG, |
| 84 | not opt.no_dropout, opt.init_type, opt.init_gain, opt.no_antialias, self.gpu_ids, |
| 85 | opt) |
| 86 | n_layers = len(self.nce_layers) |
| 87 | self.netF3 = networks.define_F(n_layers, 'mapping', opt.normG, |
| 88 | not opt.no_dropout, opt.init_type, opt.init_gain, opt.no_antialias, self.gpu_ids, |
| 89 | opt) |
| 90 | self.netF4 = networks.define_F(n_layers, 'mapping', opt.normG, |
| 91 | not opt.no_dropout, opt.init_type, opt.init_gain, opt.no_antialias, self.gpu_ids, |
| 92 | opt) |
| 93 | self.netF5 = networks.define_F(n_layers, 'mapping', opt.normG, |
| 94 | not opt.no_dropout, opt.init_type, opt.init_gain, opt.no_antialias, self.gpu_ids, |
| 95 | opt) |
| 96 | self.netF6 = networks.define_F(n_layers, 'mapping', opt.normG, |
| 97 | not opt.no_dropout, opt.init_type, opt.init_gain, opt.no_antialias, self.gpu_ids, |
| 98 | opt) |
| 99 | if self.isTrain: |
| 100 | self.netD_A = networks.define_D(opt.output_nc, opt.ndf, opt.netD, |
| 101 | opt.n_layers_D, opt.normD, opt.init_type, opt.init_gain, opt.no_antialias, |
| 102 | self.gpu_ids, opt) |
| 103 | self.netD_B = networks.define_D(opt.output_nc, opt.ndf, opt.netD, |
| 104 | opt.n_layers_D, opt.normD, opt.init_type, opt.init_gain, opt.no_antialias, |
| 105 | self.gpu_ids, opt) |
| 106 | self.fake_A_pool = ImagePool(opt.pool_size) # create image buffer to store previously generated images |
| 107 | self.fake_B_pool = ImagePool(opt.pool_size) # create image buffer to store previously generated images |
| 108 | # define loss functions |
nothing calls this directly
no test coverage detected