Esempio n. 1
0
def startupParameters():
	numpy.set_printoptions(threshold=numpy.nan)
	# argv: outputPath, occluder, occLevel, numIterations
	ind = sys.argv.index('--')
	args = sys.argv[ind+1:]
	outputPath = str('/om/user/janner/mit/urop/picture/centos/' + args[0])
	print('\nOutput Path: ', outputPath)
	hideAll_inference()
	occluder = args[1]
	occLevel = 0 if occluder == 'None' else int(args[2]) 
	if occLevel != 0:
		parameterize(occluder, outputPath, 0, 0, occLevel)
	print('Occlusion: ', occluder, str(occLevel))
	if len(args) >= 4:
		numIterations = int(args[3])
	else:
		numIterations = 20
	print('numIterations: ', numIterations, '\n')
	if len(args) >= 5:
		batchNumber = int(args[4])
	print('batchNumber: ', batchNumber, '\n')
	if len(args) >= 6:
		sweep = int(args[5])
	print('sweep: ', sweep, '\n')
	gpu = int(args[6])
	print('gpu: ', gpu)
	if gpu:
		setToGPU()
	return outputPath, occluder, occLevel, numIterations, batchNumber, sweep
Esempio n. 2
0
end = int(args[1])
if len(args) > 2:
	gpu = eval(args[2])
else:
	gpu = False

if gpu:
	switchToGPU()	
outputBase = '/om/user/janner/mit/urop/picture/centos/dDiff-dOccl/'
# identity, name, outputPath = startupParameters(outputBase)
shapeMU, shapePC, shapeEV, texMU, texPC, texEV, segMM, segMB, tl = loadModel()
#### [identity, name, path, (occluder, occLevel)]
renderArray = numpy.load(outputBase + 'render.npy')

for [identity, name, tempPath, (occluder, occlusionLevel)] in renderArray[start:end]:
	hideAll_inference()
	print(len(identity))
	if len(identity) == 1:
		identity = identity.tolist()[0]
		print('Converted to list of length ', len(identity), sep='')
	# print(identity)
	print(str(outputBase + tempPath + name))
	alpha = identity[:200]
	beta = identity[200:]
	# print('alpha: ', alpha)
	# print('beta: ', beta)
	print('Received coefs:', len(alpha), len(beta))
	print('tempPath: ', '/om' in tempPath, tempPath)
	parameterize(occluder, outputBase + tempPath, 0, 0, occlusionLevel)
	newFace(alpha, beta)
	write(outputBase + tempPath if '/om/' not in tempPath else tempPath, name)