Exemplo n.º 1
0
     "_ngf"+str(ngf)+"_N"+str(N)+"_dep"+str(nDep)

if opt.WGAN:
    desc +='_WGAN'
if opt.LS:
        desc += '_LS'
if bMirror:
    desc += '_mirror'
if opt.contentScale !=1 or opt.textureScale !=1:
    desc +="_scale"+str(opt.contentScale)+";"+str(opt.textureScale)
desc += '_cLoss'+str(opt.cLoss)

if not opt.coordCopy:
    desc += "no coord copy"

targetMosaic,templates=getTemplates(opt,N,vis=True,path=opt.outputFolder+desc)
fixnoise = torch.FloatTensor(1, nz, targetMosaic.shape[2]//2**nDep,targetMosaic.shape[3]//2**nDep)
print("fixed variables",fixnoise.data.shape,targetMosaic.data.shape) 
netD = Discriminator(ndf, opt.nDepD, bSigm=not opt.LS and not opt.WGAN)

##################################
if opt.multiScale:
    netMix = NetU_MultiScale(ngf, nDep, nz, bSkip=opt.skipConnections, nc=N + 5, ncIn=5, bTanh=False, bCopyIn=opt.coordCopy, Ubottleneck=opt.Ubottleneck)
else:
    netMix =NetUskip(ngf, nDep, nz, bSkip=opt.skipConnections, nc=N + 5, ncIn=5, bTanh=False, bCopyIn=opt.coordCopy, Ubottleneck=opt.Ubottleneck)##copy coords more often
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print ("device",device)

Gnets=[netMix]

if opt.refine:
Exemplo n.º 2
0
ndf = int(opt.ndf)

desc = "fc" + str(opt.fContent) + "_ngf" + str(ngf) + "_ndf" + str(
    ndf) + "_dep" + str(nDep) + "-" + str(opt.nDepD)

if opt.WGAN:
    desc += '_WGAN'
if opt.LS:
    desc += '_LS'
if bMirror:
    desc += '_mirror'
if opt.contentScale != 1 or opt.textureScale != 1:
    desc += "_scale" + str(opt.contentScale) + ";" + str(opt.textureScale)
desc += '_cLoss' + str(opt.cLoss)

targetMosaic = getTemplates(opt, N)
fixnoise = torch.FloatTensor(1, nz, targetMosaic.shape[2] // 2**nDep,
                             targetMosaic.shape[3] // 2**nDep)
print("fixed variables", fixnoise.data.shape, targetMosaic.data.shape)
netD = Discriminator(ndf, opt.nDepD, bSigm=not opt.LS and not opt.WGAN)

##################################
netMix = NetUskip(ngf,
                  nDep,
                  nz,
                  bSkip=opt.skipConnections,
                  nc=3,
                  ncIn=3,
                  bTanh=True,
                  Ubottleneck=opt.Ubottleneck)
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")