pyramid with common encoders per level

This commit is contained in:
2022-09-16 20:51:31 +00:00
parent eac8aad8ab
commit 37df8468e2
3 changed files with 81 additions and 26 deletions
+33 -13
View File
@@ -258,21 +258,31 @@ class CVAE32(tf.keras.Model):
static_model='',
body_model='',
curvature_model='',
freeze_encoders=False):
freeze_encoders=False,
use_full_res_encoders=True):
super(CVAE32, self).__init__()
self.latent_dim = latent_dim
model : StaticAE32 = StaticAE32()
if use_full_res_encoders:
model : StaticAE = StaticAE()
else:
model : StaticAE32 = StaticAE32()
if static_model != '':
load_model(model, static_model)
self.static_enc = tf.keras.Sequential([model.encoder, model.bottleneck])
model : BodyAE32 = BodyAE32()
if use_full_res_encoders:
model : BodyAE = BodyAE()
else:
model : BodyAE32 = BodyAE32()
if body_model != '':
load_model(model, body_model)
self.body_enc = tf.keras.Sequential([model.encoder, model.bottleneck])
model : CurvatureAE32 = CurvatureAE32()
if use_full_res_encoders:
model : CurvatureAE = CurvatureAE()
else:
model : CurvatureAE32 = CurvatureAE32()
if curvature_model != '':
load_model(model, curvature_model)
self.curv_enc = tf.keras.Sequential([model.encoder, model.bottleneck])
@@ -429,21 +439,31 @@ class CVAE128(tf.keras.Model):
static_model='',
body_model='',
curvature_model='',
freeze_encoders=False):
freeze_encoders=False,
use_full_res_encoders=True):
super(CVAE128, self).__init__()
self.latent_dim = latent_dim
model : StaticAE128 = StaticAE128()
if use_full_res_encoders:
model : StaticAE = StaticAE()
else:
model : StaticAE128 = StaticAE128()
if static_model != '':
load_model(model, static_model)
self.static_enc = tf.keras.Sequential([model.encoder, model.bottleneck])
model : BodyAE128 = BodyAE128()
if use_full_res_encoders:
model : BodyAE = BodyAE()
else:
model : BodyAE128 = BodyAE128()
if body_model != '':
load_model(model, body_model)
self.body_enc = tf.keras.Sequential([model.encoder, model.bottleneck])
model : CurvatureAE128 = CurvatureAE128()
if use_full_res_encoders:
model : CurvatureAE = CurvatureAE()
else:
model : CurvatureAE128 = CurvatureAE128()
if curvature_model != '':
load_model(model, curvature_model)
self.curv_enc = tf.keras.Sequential([model.encoder, model.bottleneck])
@@ -515,11 +535,11 @@ class CVAE128(tf.keras.Model):
def call(self, inputs, training=None, zero_latent=False):
uv_unposed, uv_template, uv_body_posed, uv_curv = inputs
uv_unposed, uv_template, uv_body_posed, uv_curv, uv_template_high, uv_body_posed_high, uv_curv_high = inputs
uv_unposed, uv_template, uv_body_posed = tf.transpose(uv_unposed, [0,2,3,1]), tf.transpose(uv_template, [0,2,3,1]), tf.transpose(uv_body_posed, [0,2,3,1])
z_static = self.static_enc(uv_template)
z_body = self.body_enc(uv_body_posed)
z_curv = self.curv_enc(uv_curv)
z_static = self.static_enc(uv_template_high)
z_body = self.body_enc(uv_body_posed_high)
z_curv = self.curv_enc(uv_curv_high)
x = tf.concat([uv_unposed, uv_template, uv_body_posed, uv_curv], axis=-1)