train on template only with mask applied

This commit is contained in:
2022-06-14 10:16:55 +00:00
parent def8a85cf9
commit 245f811d47
11 changed files with 112 additions and 60 deletions
+1
View File
@@ -102,6 +102,7 @@ class Generator(tf.keras.Model):
w_broadcasted = self.truncation_trick(w_broadcasted, truncation_psi, truncation_cutoff)
image_out = self.synthesis(w_broadcasted)
image_out = image_out * conditions[3][:,tf.newaxis,:,:]
if ret_w_broadcasted:
return image_out, w_broadcasted
+6 -4
View File
@@ -14,8 +14,9 @@ class Mapping(tf.keras.layers.Layer):
self.gain = 1.0
self.lrmul = 0.01
self.pose_shape_embedding = PoseShapeEmbedding()
self.garment_embedding = GarmentEmbedding((self.w_dim * 2) - (216 + 11))
# self.pose_shape_embedding = PoseShapeEmbedding()
# self.garment_embedding = GarmentEmbedding((self.w_dim * 2) - (216 + 11))
self.garment_embedding = GarmentEmbedding(self.w_dim)
self.normalize = tf.keras.layers.Lambda(lambda x: x * tf.math.rsqrt(tf.reduce_mean(tf.square(x), axis=1, keepdims=True) + 1e-8))
@@ -30,9 +31,10 @@ class Mapping(tf.keras.layers.Layer):
x = latents
# embed label if any
pose_shape_latent = self.pose_shape_embedding([conditions[0], conditions[1]])
# pose_shape_latent = self.pose_shape_embedding([conditions[0], conditions[1]])
garment_latent = self.garment_embedding(conditions[2])
x = tf.concat([x, pose_shape_latent, garment_latent], axis=1)
# x = tf.concat([x, pose_shape_latent, garment_latent], axis=1)
x = tf.concat([x, garment_latent], axis=1)
# normalize inputs
x = self.normalize(x)