-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example of optimisation using parametric models #140
Comments
Facing the same problem. Parameters are used in every term, but terms iterate over an image or graph. |
Seems like Opt is unable to model such problems. Sad. |
I find a workaround using Graph. You know the number of your parameters so encode it with a floatN, no an array with dimension N, so you can directly access its index. Then create a graph to associate every term with the only parameter block. One example of estimating spherical harmonic lighting is as follows. local WH, One = Dim("WH", 0), Dim("One", 1)
local Ls = Unknown("L", float9, {One}, 0)
local T = Array("T", uint8, {WH}, 1) -- tri index
local N = Array("N", float3, {WH}, 2) -- normal
local A = Array("A", float, {WH}, 3) -- albedo
local I = Array("I", float, {WH}, 4) -- image
local G = Graph("G", 5,
"xy", {WH}, 6,
"L0", {One}, 7)
-- UsePreconditioner(true)
local n = N(G.xy)
local x, y, z = n(0), n(1), n(2)
local L = Ls(G.L0)
local light = L(0)
+ L(1) * z
+ L(2) * y
+ L(3) * x
+ L(4) * (2 * z * z - x * x - y * y)
+ L(5) * y * z
+ L(6) * x * z
+ L(7) * x * y
+ L(8) * (x * x - y * y)
local render = light * A(G.xy)
local data = I(G.xy) - render
Energy(Select(T(G.xy) , data, 0.0)) |
Hello, Thanks, @gerwang for the interest of this problem. Maybe we can try to solve this problem together. One of the main problems I faced while trying to use the SMPL model for optimizing using Opt is the optimization function to be represented by a kinematic tree. That means the position of each vertex depends upon the product of transformations of parameters. I am a little busy now, I will definitely reply to this thread later. |
Hi @gerwang ,
Could you share your full code implementation for lighting estimation? Thx in advance~ |
Thanks for your interest.
Sorry that my full code contains a lot irrelevant to Opt, thus I don't paste all of it here. I think for Opt the script is enough. |
Hi @gerwang Thank u for your answer~ I'm also curious about the
How could a 2D array in the graph be used? (if not flattened into 1D array) For example, if I have an Image
How can I access a pixel in
I didn't see any demo code or docs in the paper or in this repo, not sure if I missed something... |
I think If you want to access a pixel and its neighbors, maybe you need five "auxiliary index arrays", like the |
hi @gerwang , as the doc says:
So I'm just wondering if it's true, and how that multi-dimensional arrays could be used. Anyway, the "five auxiliary index arrays" idea indeed works :) |
Dear Opt authors,
Most of the tracking approach using parametric models for tracking specific subjects like a human hand, face, and body. Some of such models are given below.
smpl (huamn body) : http://smpl.is.tue.mpg.de
mano (hands) : http://mano.is.tue.mpg.de
flame (face) : http://flame.is.tue.mpg.de
Is it possible to give an example of optimization using such models? This could be useful for researchers to experiment model-based optimization fastly.
Thanks and Regards,
Shafeeq E
The text was updated successfully, but these errors were encountered: