Exemple #1
0
##################################
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:
    netRefine=NetUskip(ngf, nDep, nz, bSkip=True, nc=5, ncIn=4 * 3 + 2 + 2, bTanh=False)
    Gnets +=[netRefine]
if opt.cLoss>=100:
    from network import ColorReconstruction
    netR = ColorReconstruction(50, 1)#
    Gnets+=[netR]
elif opt.cLoss==10:
    from network import PerceptualF
    netR=PerceptualF()
else:
    netR = None
if opt.zPeriodic:
    Gnets += [learnedWN]

for net in [netD] + Gnets:
    try:
        net.apply(weights_init)
    except Exception as e:
        print (e,"weightinit")
    pass
Exemple #2
0
##################################
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")
print("device", device)

Gnets = [netMix]
if opt.cLoss >= 100:
    from network import ColorReconstruction
    netR = ColorReconstruction(50, 1)  #
    Gnets += [netR]
elif opt.cLoss == 10:
    from network import PerceptualF
    netR = PerceptualF()
else:
    netR = None
if opt.zPeriodic:
    Gnets += [learnedWN]

for net in [netD] + Gnets:
    try:
        net.apply(weights_init)
    except Exception as e:
        print(e, "weightinit")
    pass