Created
April 17, 2015 07:22
-
-
Save wookay/657a6c2adefc11f9312c to your computer and use it in GitHub Desktop.
Picture code illustration for 3D face analysis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://mrkulk.github.io/www_cvpr15/1999.pdf | |
function PROGRAM(MU, PC, EV, VERTEX_ORDER) | |
# Scene Language: Stochastic Scene Gen | |
face=Dict(); | |
shape = []; | |
texture = []; | |
for S in ["shape", "texture"] | |
for p in ["nose", "eyes", "outline", "lips"] | |
coeff = MvNormal(0,1,1,99) | |
face[S][p] = MU[S][p]+PC[S][p].*(coeff.*EV[S][p]) | |
end | |
end | |
shape=face["shape"][:]; | |
tex=face["texture"][:]; | |
camera = Uniform(-1,1,1,2); | |
light = Uniform(-1,1,1,2) | |
# Approximate Renderer | |
rendered_img = MeshRenderer(shape,tex,light,camera) | |
# Representation Layer | |
ren_ftrs = getFeatures("CNN_Conv6", rendered_img) | |
# Comparator | |
# Using Pixel as Summary Statistics | |
observe(MvNormal(0,0.01), rendered_img-obs_img) | |
#Using CNN last conv layer as Summary Statistics | |
observe(MvNormal(0,10), ren_ftrs-obs_cnn) | |
end | |
global obs_img = imread("test.png") | |
global obs_cnn = getFeatures("CNN_Conv6", img) | |
#Load args from file | |
TR = trace(PROGRAM,args=[MU,PC,EV,VERTEX_ORDER]) | |
# Data-Driven Learning | |
learn_datadriven_proposals(TR,100000,"CNN_Conv6") | |
load_proposals(TR) | |
# Inference | |
infer(TR,CB,20,["DATA-DRIVEN"]) | |
infer(TR,CB,200,["ELLIPTICAL"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment