This commit is contained in:
2023-02-26 23:45:39 +01:00
parent 9148d63dc3
commit 716026f0a9
4 changed files with 59 additions and 7 deletions
+7 -1
View File
@@ -42,6 +42,7 @@ from custom_utils.custom_utils import batch_to_dict, load_model, plot_3d, UV2Mes
from dataset import DatasetFactory, StaticDataset
from custom_utils.smpl import SMPL
from models.cvae_model import CVAENew as CVAE
from models.gnn import Smoother
from custom_utils.custom_utils import Accumulator
@@ -54,6 +55,7 @@ def init_wandb():
# artifact.add_file('configs/config_base.py')
# artifact.add_file('configs/config_cvae.py')
artifact.add_file('models/base.py')
artifact.add_file('models/gnn.py')
artifact.add_file('models/cond_encoder.py')
artifact.add_file('dataset.py')
artifact.add_file('convnext/models/convnext_tf.py')
@@ -88,6 +90,7 @@ def train_step(batch):
pred, mean, logvar = model([uv_orig, batch['uv_static'], batch['uv_body_posed'], batch['uv_curvature'], batch['uv_mask']], training=True)
mesh_pred = uv2mesh(pred)
mesh_pred = smoother(mesh_pred, training=True)
if config['use_skinning']:
shape = batch['pose_shape'][:, 72:]
@@ -146,6 +149,7 @@ def valid_step(batch):
pred, mean, logvar = model([uv_orig, batch['uv_static'], batch['uv_body_posed'], batch['uv_curvature'], batch['uv_mask']], training=False)
mesh_pred = uv2mesh(pred)
mesh_pred = smoother(mesh_pred, training=False)
if config['use_skinning']:
shape = batch['pose_shape'][:, 72:]
@@ -255,7 +259,8 @@ def plot_everything(batch: dict, type: str):
pred, mean, logvar = model([uv_orig, batch['uv_static'], batch['uv_body_posed'], batch['uv_curvature'], batch['uv_mask']], training=False)
mesh_pred = uv2mesh(pred).numpy()
mesh_pred = uv2mesh(pred)
mesh_pred = smoother(mesh_pred, training=False).numpy()
orig_img = uv_orig
uv_static_img = batch['uv_static']
@@ -520,6 +525,7 @@ if __name__ == '__main__':
is_cape=config['is_cape'])
model = CVAE(config)
smoother = Smoother()
optimizer = tf.optimizers.Adam(learning_rate=config['lr'])
balancing_activated_step = 0