TimoBolkart / BFM_to_FLAME

Convert from Basel Face Model (BFM) to the FLAME head model
http://flame.is.tue.mpg.de
411 stars 50 forks source link

How to convert Deep3DFace reusult mesh to flame? #17

Open skeras opened 2 years ago

skeras commented 2 years ago

Hi, This project use standard BFM2009 convert to FLame, but deep3dface (https://github.com/sicxu/Deep3DFaceRecon_pytorch.git) generate mesh is not standart (71418,3), how to convert this mesh to flame? Thanks a lot!

TimoBolkart commented 2 years ago

Can you provide one Deep3DFace mesh for reference?

skeras commented 2 years ago

Thanks for your reply.
https://drive.google.com/file/d/15hwcxMMZCwyU37BeMjNRFL-48lLBU0fj/view?usp=sharing

TimoBolkart commented 1 year ago

Sorry, I missed that. Deep3DFace uses BFM as underlying model. Do you have the vertex indices of those cropped faces?

LinShiqi047 commented 1 year ago

I have the same problem as well.

LinShiqi047 commented 1 year ago
    # vertex indices for each face. starts from 0. [F,3]
    self.face_buf = model['tri'].astype(np.int64) - 1
    # vertex indices for 68 landmarks. starts from 0. [68,1]
    self.keypoints = np.squeeze(model['keypoints']).astype(np.int64) - 1

    if is_train:
        # vertex indices for small face region to compute photometric error. starts from 0.
        self.front_mask = np.squeeze(model['frontmask2_idx']).astype(np.int64) - 1
        # vertex indices for each face from small face region. starts from 0. [f,3]
        self.front_face_buf = model['tri_mask2'].astype(np.int64) - 1
        # vertex indices for pre-defined skin region to compute reflectance loss
        self.skin_mask = np.squeeze(model['skinmask'])
hu394854434 commented 1 month ago

I look up your code and the sparse matrix,and the sum of each row , I found that your processing of bfm to flame is to generate vertex of flame with weighted vectices of bfm, so how you get the weight