ascust / 3DMM-Fitting-Pytorch

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

I have a question about BFM 2019 data #14

Closed nxsf8023 closed 2 years ago

nxsf8023 commented 3 years ago

Do you know the data pcaBasis and pcaVariance in BFM2019? Could you please tell me how this data be calculateed? Thank you very much!!!

ascust commented 3 years ago

As far as know, data are stored in h5 files for BFM2019. The shape and expression bases should be stored as matrices in the h5 files. So your question is how to read h5 files?

nxsf8023 commented 3 years ago

I have already read data from model2019_face12.h5 and I also get the pcaBasis and pcaVariance. But I found that these data is different from shapePC and shapeEV in BFM2009 data 01_MorphableModel.mat. So I want to know how it be calculated, and if I want to generater a random face by BFM2019 data,what should I do? Thanks you very much!

ascust commented 3 years ago

Is it that the dimensions are not right? How different are they? sorry I dont have much time to look into it currently. I will try to add support for BFM2019 in the future

nxsf8023 commented 3 years ago

Now I'm working on generate a random face model by BFM 2019. I find that if I use a couple parameter(normal distribution), some result is very strange. I use code like this:

mean, shape_base, exp_mean, exp_base = load_bfm19_data()
shape_base = shape_base[:, :shape_d]
exp_base = exp_base[:, :exp_d]

coeff_shape = np.random.normal(0, 15, [199, 1])

shape = np.dot(shape_base, coeff_shape)
shape = np.reshape(shape, [1, -1])
vts = mean * 1000 + shape

When the variance of coeff_shape is 15, I get some random face model good, but also someone is wrong. Do you have some idea about this phenomenon? Thank you very much!!!

ascust commented 3 years ago

@nxsf8023 The range of each shape parameter, I guess, is supposed to be small, something like -2~2. Might be larger or smaller, but cannot be very large. I guess normal(0, 15) is a bit too much.