Closed wasahaiah closed 2 years ago
The tri.pkl seems not corespond to bfm_noneck_v3.pkl. I obtain the mean face and the triangle index , by the following code: bfm.py:
def exp_base_write(self, obj): for i in range(1): object_name = obj + str(i) + ".obj" write_obj(object_name, self.u, self.w_exp[:,0], self.tri, self.bfm_param_mean, self.bfm_param_std)
tddfa_util.py:
def write_obj(obj_name, u_base, vertices, faces, param_mean, param_std): if obj_name.split('.')[-1] != 'obj': obj_name = obj_name + '.obj' faces = faces.copy()
with open(obj_name, 'w') as f: for i in np.arange(0, vertices.shape[0], 3): f.write('v {} {} {}\n'.format(u_base[i,0], u_base[i+1,0], u_base[i+2,0])) if u_base[i+2] == 0: print("i: ", i) for j in np.arange(faces.shape[0]): f.write('f {}/{} {}/{} {}/{}\n'.format( faces[j, 0], faces[j, 0], faces[j, 1], faces[j, 1], faces[j, 2], faces[j, 2]))
I get the obj file that seems not right which maybe caused by the file tri.pk
The problem is solved
The tri.pkl seems not corespond to bfm_noneck_v3.pkl. I obtain the mean face and the triangle index , by the following code: bfm.py:
def exp_base_write(self, obj): for i in range(1): object_name = obj + str(i) + ".obj" write_obj(object_name, self.u, self.w_exp[:,0], self.tri, self.bfm_param_mean, self.bfm_param_std)
tddfa_util.py:
def write_obj(obj_name, u_base, vertices, faces, param_mean, param_std): if obj_name.split('.')[-1] != 'obj': obj_name = obj_name + '.obj' faces = faces.copy()
vertices = vertices * param_mean[52:] + param_std[52:]
I get the obj file that seems not right which maybe caused by the file tri.pk