smaller error but still not same

This commit is contained in:
2023-02-06 15:53:34 +00:00
parent 79a09e0f62
commit 0a65dbd75d
4 changed files with 119 additions and 23 deletions
+11 -10
View File
@@ -84,12 +84,13 @@ class SMPL:
self.to_keep = sio.loadmat(os.path.join(path, 'keep_remove.mat'))['keep'].reshape(-1)
self.weights_all = self.weights
if use_one_hot:
self.weights = tf.gather(self.weights_one_hot, self.to_keep, axis=0)
self.weights = tf.tile(self.weights[tf.newaxis,:,:], [2,1,1])
else:
self.weights = tf.gather(self.weights, self.to_keep, axis=1)
# if use_one_hot:
# self.weights = tf.gather(self.weights_one_hot, self.to_keep, axis=0)
# self.weights = tf.tile(self.weights[tf.newaxis,:,:], [2,1,1])
# else:
# self.weights = tf.gather(self.weights, self.to_keep, axis=1)
self.shape = (1,27578,3)
if orig_smpl:
@@ -189,21 +190,21 @@ class SMPL:
v = tf.matmul(T, tf.reshape(rest_shape_h, (-1, 4, 1)))
v = tf.reshape(v, (-1, 4))[:, :3]
return v, tf.squeeze(J), v_posed
return v, tf.squeeze(J), v_posed, lrotmin
gender = tf.cast(tf.greater_equal(betas[:, 10] , 0.5), tf.int32)
T_out, J_out, v_posed = tf.map_fn(single_run, (R, v_shaped, gender), (tf.float32, tf.float32, tf.float32))
T_out, J_out, v_posed,lrotmin = tf.map_fn(single_run, (R, v_shaped, gender), (tf.float32, tf.float32, tf.float32, tf.float32))
J0 = tf.reshape(J_out[:,0,:], (-1, 1, 3))
J_out = tf.subtract(J_out, J0)
T_out = tf.subtract(T_out, J0)
v_posed = tf.subtract(v_posed, J0)
# v_posed = tf.subtract(v_posed, J0)
if remove:
T_out = tf.gather(T_out, self.to_keep, axis=1)
v_posed = tf.gather(v_posed, self.to_keep, axis=1)
# v_posed = tf.gather(v_posed, self.to_keep, axis=1)
return T_out, J_out, v_posed
return T_out, J_out, lrotmin, v_posed
def run_with_weights(self, R, betas, v_cloth, weights=None, filter=None):