This commit is contained in:
2023-03-07 08:59:20 +00:00
parent 0b518e7f0e
commit e192f6f9e3
21 changed files with 1004 additions and 73 deletions
+13 -1
View File
@@ -50,7 +50,7 @@ class CVAE(tf.keras.Model):
# @tf.function
def sample_single(self, uv_template, uv_body_posed, uv_mask, eps=None, nr_of_samples=4):
if eps is None:
eps = tf.random.normal(shape=(nr_of_samples, self.latent_dim))
eps = tf.random.normal(shape=(nr_of_samples, 8, 4, self.latent_dim))
uv_template = tf.tile(tf.transpose(uv_template, [1,2,0])[tf.newaxis,:,:,:], [nr_of_samples,1,1,1])
uv_body_posed = tf.tile(tf.transpose(uv_body_posed, [1,2,0])[tf.newaxis,:,:,:], [nr_of_samples,1,1,1])
@@ -149,3 +149,15 @@ class CVAE(tf.keras.Model):
# x = tf.math.softmax(x)
return x, mean, logvar
def call_sample(self, inputs):
uv_template, uv_body_posed, uv_curv, uv_mask = inputs
z = tf.random.normal(shape=(uv_template.shape[0], 8, 4, self.latent_dim))
z_cond = self.encode_conds(uv_template, uv_body_posed, training=False)
z = tf.concat([z, z_cond], axis=-1)
x = self.decoder([z, uv_mask], training=False)
return x