working weight learning

This commit is contained in:
2023-02-15 11:19:14 +00:00
parent 8fbd075f92
commit 61a609c8f7
7 changed files with 96 additions and 39 deletions
+7 -7
View File
@@ -193,12 +193,12 @@ class CVAENew(tf.keras.Model):
self.noise_amount = config['cvae']['noise_amount']
self.use_curvature = config['use_curvature']
self.only_curvatures = config['only_curvatures'] if 'only_curvatures' in config.keys() and config['only_curvatures'] == True else None
self.use_offsets_over_body = not config['use_skinning']
self.use_offsets_over_body = False
if self.use_offsets_over_body:
assert self.avg_garment is None, 'When we are not using skinning, we can\'t use avg_garment!'
if self.avg_garment is not None:
assert not self.use_offsets_over_body, 'When avg_garment is given, we must use skinning!'
# if self.avg_garment is not None:
# assert not self.use_offsets_over_body, 'When avg_garment is given, we must use skinning!'
# @tf.function
def sample(self, uv_template, uv_body_posed, uv_curv, uv_mask, noise=None, add_noise=False):
@@ -213,7 +213,7 @@ class CVAENew(tf.keras.Model):
z = tf.concat([eps, z_cond], axis=-1)
x = self.decoder(z, training=False)
x, weights = self.decoder(z, training=False)
if self.avg_garment is not None:
x = x + self.avg_garment[tf.newaxis,:,:,:]
@@ -223,7 +223,7 @@ class CVAENew(tf.keras.Model):
x = x * uv_mask[:,:,:,tf.newaxis]
return x
return x, weights
def reparameterize(self, mean, logvar, training, fix_noise=False):
@@ -271,7 +271,7 @@ class CVAENew(tf.keras.Model):
z = tf.concat([z, z_cond], axis=-1)
x = self.decoder(z, training=training)
x, weights = self.decoder(z, training=training)
if self.avg_garment is not None:
x = x + self.avg_garment[tf.newaxis,:,:,:]
@@ -281,5 +281,5 @@ class CVAENew(tf.keras.Model):
x = x * uv_mask[:,:,:,tf.newaxis]
return x, mean, logvar
return x, mean, logvar, weights