imBatch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) imBgBatch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) SHBatch = Variable(torch.FloatTensor(opt.batchSize, 3, 9) ) imP1Batch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) imP2Batch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) imP3Batch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) imEBatch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) # Initial Network encoderInit = nn.DataParallel(models.encoderInitial(), device_ids = opt.deviceIds) albedoInit = nn.DataParallel(models.decoderInitial(mode=0), device_ids = opt.deviceIds) normalInit = nn.DataParallel(models.decoderInitial(mode=1), device_ids = opt.deviceIds) roughInit = nn.DataParallel(models.decoderInitial(mode=2), device_ids = opt.deviceIds) depthInit = nn.DataParallel(models.decoderInitial(mode=3), device_ids = opt.deviceIds) envInit = nn.DataParallel(models.envmapInitial(), device_ids = opt.deviceIds) renderLayer = models.renderingLayer(gpuId = opt.gpuId, isCuda = opt.cuda) # Global illumination globIllu1to2 = models.globalIllumination() globIllu2to3 = models.globalIllumination() ######################################### ######################################### # Load weight of network globIllu1to2.load_state_dict(torch.load('{0}/globIllu1to2_{1}.pth'.format(opt.modelRootGlob, opt.epochIdGlob) ) ) globIllu2to3.load_state_dict(torch.load('{0}/globIllu2to3_{1}.pth'.format(opt.modelRootGlob, opt.epochIdGlob) ) ) globIllu1to2 = globIllu1to2.eval() globIllu2to3 = globIllu2to3.eval() for param in globIllu1to2.parameters():
imBatch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) imBgBatch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) SHBatch = Variable(torch.FloatTensor(opt.batchSize, 3, 9) ) imP1Batch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) imP2Batch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) imP3Batch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) imEBatch = Variable(torch.FloatTensor(opt.batchSize, 3, opt.imageSize, opt.imageSize) ) # Initial Network encoderInit = models.encoderInitial() albedoInit = models.decoderInitial(mode=0) normalInit = models.decoderInitial(mode=1) roughInit = models.decoderInitial(mode=2) depthInit = models.decoderInitial(mode=3) envInit = models.envmapInitial() renderLayer = models.renderingLayer(gpuId = opt.gpuId, isCuda = opt.cuda) # Global illumination globIllu1to2 = models.globalIllumination() globIllu2to3 = models.globalIllumination() ######################################### ######################################### # Load the weight to the network encoderInit.load_state_dict(torch.load('{0}/encoderInit_{1}.pth'.format(opt.modelRoot, opt.epochId) ) ) albedoInit.load_state_dict(torch.load('{0}/albedoInit_{1}.pth'.format(opt.modelRoot, opt.epochId) ) ) normalInit.load_state_dict(torch.load('{0}/normalInit_{1}.pth'.format(opt.modelRoot, opt.epochId) ) ) roughInit.load_state_dict(torch.load('{0}/roughInit_{1}.pth'.format(opt.modelRoot, opt.epochId) ) ) depthInit.load_state_dict(torch.load('{0}/depthInit_{1}.pth'.format(opt.modelRoot, opt.epochId) ) )