hassony2 / manopth

MANO layer for PyTorch, generating hand meshes as a differentiable layer
GNU General Public License v3.0
603 stars 107 forks source link

Efficient way to get ManoLayer's jacobian matrix #15

Open milkcat0904 opened 3 years ago

milkcat0904 commented 3 years ago

Hello, thx for sharing your code, I got some issues about calculate ManoLayer's jacobian matrix in my project. I use pytorch official api to get ManoLayer's jacobian but it takes too much time, about 0.2s each sample 1 Nvidia RTX 3090 Here is my code:

from torch.autograd.functional import jacobian
 j = jacobian(mano_layer.forward, (theta, beta)) 

btw, I only calculate joints' jacobian matrix, if add verts' jacobian matrix, it cost a larger time. Is there any way to get jacobian more efficient? How could I get ManoLayer's analytical differential expression?

hassony2 commented 3 years ago

Hi @milkcat0904,

Sorry for the late answer ! Computing vertices and joints in mano is done jointly and it is not easy (if even feasible) to reduce the code only to joint computations. So unfortunately at this time no good solution for speeding up the computations comes to mind !

Best,

Yana