ascust / 3DMM-Fitting-Pytorch

A 3DMM fitting framework using Pytorch.
600 stars 95 forks source link

some questions about reg_loss #3

Closed ganqi91 closed 3 years ago

ganqi91 commented 3 years ago

q1: why ex_coeff use sum(1).mean() ,and other two use .sum() `def reg_loss(id_coeff, ex_coeff, tex_coeff):

loss = torch.square(id_coeff).sum() + \
        torch.square(tex_coeff).sum() * 1.7e-3 + \
        torch.square(ex_coeff).sum(1).mean() * 0.8

return loss`

q2:why pose coeff(rot and tans) not include in reg_loss ?

q3:why illumination coeff(gamma)not include in reg_loss ?

ascust commented 3 years ago

Sorry for the late reply. a1: It seems a redundant command. It makes no difference.

a2: The purpose of using regularizers is to make those parameters closer to zeros. The assumption here is that those variable are drawn from a gaussian distribution. This works for shape, texture and expression params. However it does not make much sense for rotation and translation in my opinion.

a3: As illumination params are related to some illumination model, they are not supposed to be generated from a gaussian distribution as rotation and translation params. Dont know if that explained your question.

wwdok commented 2 years ago

Hello, @ascust , you said

The assumption here is that those variable are drawn from a gaussian distribution. This works for shape, texture and expression params.

Do you have some recommended materials about this assumption, i want to learn more about it ~

ascust commented 2 years ago

@wwdok Hi, maybe gaussian distribution is not that precise here and I am not 100% sure. The main idea here is that the bases for shape, texture and expression are obtained from PCA on the scanned face training data, so the params for shape, texture and expression describe the combinations of the bases. In general, the most params tend to be close to zeros to be close to the mean face. Only some entries have large absolute values for different face shape, texture or expression. The regularizers are used to make sure the parameters are controlled in a reasonable range. You can refer to some 3DMM papers for the details like BFM model or FLAME model.