def define_G(input_nc, output_nc, ngf, n_downsample_global=3, n_blocks_global=9, norm='instance'):
    norm_layer = get_norm_layer(norm_type=norm)
    netG = GlobalGenerator(input_nc, output_nc, ngf, n_downsample_global, n_blocks_global, norm_layer)
    #assert (torch.cuda.is_available())
    netG.cuda() #cuda Azade
    netG.apply(weights_init)
    return netG
def define_D(input_nc, ndf, n_layers_D, norm='instance', use_sigmoid=False, num_D=1):
    norm_layer = get_norm_layer(norm_type=norm)
    netD = MultiscaleDiscriminator(input_nc, ndf, n_layers_D, norm_layer, use_sigmoid, num_D)
    # print(netD)
    assert (torch.cuda.is_available()) # #cuda Azade
    netD.cuda() #cuda Azade
    netD.apply(weights_init)
    return netD
Esempio n. 3
0
def define_mask_D(input_nc,
                  ndf,
                  n_layers_D,
                  norm='instance',
                  use_sigmoid=False,
                  num_D=1,
                  num_objects=None):
    norm_layer = get_norm_layer(norm_type=norm)
    netD = MultiscaleDiscriminator_2(input_nc, ndf, n_layers_D, norm_layer,
                                     use_sigmoid, num_D, num_objects)
    assert (torch.cuda.is_available())
    netD.cuda()
    netD.apply(weights_init)
    return netD