Ejemplo n.º 1
0
for k, v in data_pca.iteritems():
    data_pca[k] = (v + meanshape) - mean
for k, v in data_patches.iteritems():
    data_patches[k] = (v + meanshape) - mean

# TODO: add values so that model is equally as wide/high as cropped images
# in our case: 170 x 178, i.e. add 85 to x-vals, and 89 to y-vals
meanshape = ((meanshape - mean) + [cropsize[0] / 2, cropsize[1] / 2])

if buildPatches:
    # weights for eyes and mouth
    from buildlib.me_weights import weights
    # build patch model
    patchModel = build_patches(data_patches,
                               gradient=True,
                               lbp=True,
                               weights=weights,
                               optimize_params=True)
    #patchModel = build_patches(data_patches)

# store the model
model = {}
if buildPatches:
    model['patchModel'] = patchModel
    model['patchModel']['canvasSize'] = [cropsize[0], cropsize[1]]
if buildScoring:
    model['scoring'] = scoring
model['shapeModel'] = {}
model['shapeModel']['eigenVectors'] = eigenVectors.T.tolist()
model['shapeModel']['eigenValues'] = eigenValues
model['shapeModel']['meanShape'] = meanshape.tolist()
Ejemplo n.º 2
0
for k,v in data_pca.iteritems():
		data_pca[k] = (v+meanshape)-mean
for k,v in data_patches.iteritems():
		data_patches[k] = (v+meanshape)-mean

# TODO: add values so that model is equally as wide/high as cropped images
# in our case: 170 x 178, i.e. add 85 to x-vals, and 89 to y-vals
meanshape = ((meanshape-mean)+[cropsize[0]/2,cropsize[1]/2])


if buildPatches:
	# weights for eyes and mouth
	from buildlib.me_weights import weights
	# build patch model
	patchModel = build_patches(data_patches, gradient=True, lbp=True, weights=weights, optimize_params=True)
	#patchModel = build_patches(data_patches)

# store the model
model = {}
if buildPatches:
	model['patchModel'] = patchModel
	model['patchModel']['canvasSize'] = [cropsize[0],cropsize[1]]
if buildScoring:
	model['scoring'] = scoring
model['shapeModel'] = {}
model['shapeModel']['eigenVectors'] = eigenVectors.T.tolist()
model['shapeModel']['eigenValues'] = eigenValues
model['shapeModel']['meanShape'] = meanshape.tolist()
model['shapeModel']['numEvalues'] = len(eigenValues)
model['shapeModel']['numPtsPerSample'] = meanshape.shape[0]
Ejemplo n.º 3
0
if buildScoring:
	scoring = getScoring(data_pca, meanshape-mean)

for k,v in data_pca.iteritems():
		data_pca[k] = (v+meanshape)-mean
for k,v in data_patches.iteritems():
		data_patches[k] = (v+meanshape)-mean

# TODO: add values so that model is equally as wide/high as cropped images
# in our case: 170 x 178, i.e. add 85 to x-vals, and 89 to y-vals
meanshape = ((meanshape-mean)+[cropsize[0]/2,cropsize[1]/2])

if buildPatches:
	# build patch model
	patchModel = build_patches(data_patches, 0.00000001, False)

# store the model
model = {}
if buildPatches:
	model['patchModel'] = patchModel
	model['patchModel']['canvasSize'] = [cropsize[0],cropsize[1]]
if buildScoring:
	model['scoring'] = scoring
model['shapeModel'] = {}
model['shapeModel']['eigenVectors'] = eigenVectors.T.tolist()
model['shapeModel']['eigenValues'] = eigenValues
model['shapeModel']['meanShape'] = meanshape.tolist()
model['shapeModel']['numEvalues'] = len(eigenValues)
model['shapeModel']['numPtsPerSample'] = meanshape.shape[0]
model['shapeModel']['nonRegularizedVectors'] = [0]