face3d
face3d copied to clipboard
Not enough randomness in the shape of faces
Hi,
Great repo, very helpful! One issue I had when generating random faces is that the shapes of random faces are very similar to each other. It'd be great if we can get more diverse faces.
The faces become more diverse after I made the following changes. Basically, I use shape_para * self.model['shapeEV']
rather than shape_para
alone in calculating the axis. This is adapted from the Matlab code in the BFM model. (This change somehow breaks the fitting process, though.)
def get_shape_para(self, type = 'random'):
if type == 'zero':
sp = np.zeros((self.n_shape_para, 1))
elif type == 'random':
sp = np.random.randn(self.n_shape_para, 1) # normally distributed random numbers
return sp
def generate_vertices(self, shape_para, exp_para):
vertices = self.model['shapeMU'] + \
self.model['shapePC'].dot(shape_para * self.model['shapeEV']) + \
self.model['expPC'].dot(exp_para)
vertices = np.reshape(vertices, [int(3), int(len(vertices)/3)], 'F').T
return vertices
Hi, Have you solve it? I cannot generate face with enough distinction too. They look nearly the same.
@xinwen-cs The above solution helped to some extent. You can look at the Matlab code from the BFM model to understand how the calculation works.