clean up deshaping
This commit is contained in:
+13
-19
@@ -1,3 +1,6 @@
|
||||
## !!MOVEd to preprocessing.py
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
@@ -18,39 +21,30 @@ if __name__ == '__main__':
|
||||
|
||||
uv2mesh = UV2Mesh()
|
||||
smpl = SMPL()
|
||||
folder = '/home/workspace/local-data/train_skirt_25'
|
||||
|
||||
F = np.load("custom_utils/smpl_faces.npy")
|
||||
|
||||
factory = DatasetFactory()
|
||||
signature_dynamic = { 'id': (),
|
||||
'pose_shape': (72 + 11,),
|
||||
# 'uv_posed': (3, 512, 256,),
|
||||
# 'uv_body_posed': (3, 512, 256,),
|
||||
# 'mesh_body_posed': (14475, 3,),
|
||||
# 'mesh_posed_body_no_orient': (14475, 3,),
|
||||
'mesh_posed': (14475, 3,),
|
||||
'mesh_unposed': (14475, 3,),
|
||||
# 'uv_unposed': (3, 512, 256,),
|
||||
# 'uv_curvature': (512, 256),
|
||||
# 'mesh_curvature': (14475)
|
||||
}
|
||||
signature_static = { #'uv_static': (3, 512, 256,),
|
||||
# 'mesh_static': (14475, 3,),
|
||||
signature_static = {
|
||||
'mesh_mask': (14475,),
|
||||
# 'uv_mask': (512, 256,),
|
||||
# 'uv_shaped_body': (3, 512, 256,),
|
||||
}
|
||||
|
||||
dataset = factory.get_dataset(folder='/home/workspace/local-data/jumpsuit_20/train',
|
||||
dataset = factory.get_dataset(folder=folder,
|
||||
batch_size=1,
|
||||
signature=signature_dynamic)
|
||||
static_dataset = StaticDataset(folder='/home/workspace/local-data/jumpsuit_20/train',
|
||||
signature=signature_dynamic,
|
||||
in_memory=False)
|
||||
static_dataset = StaticDataset(folder=folder,
|
||||
signature=signature_static)
|
||||
|
||||
|
||||
uv_res = 256
|
||||
|
||||
|
||||
os.makedirs(os.path.join(folder, id, 'mesh_unposed_no_shape'), exist_ok=True)
|
||||
|
||||
for i, batch in enumerate(dataset):
|
||||
print(i)
|
||||
@@ -60,15 +54,15 @@ if __name__ == '__main__':
|
||||
mask = np.squeeze(batch['mesh_mask'].numpy()).astype(bool)
|
||||
pose, shape = batch['pose_shape'][:, :72].numpy(), batch['pose_shape'][:, 72:].numpy()
|
||||
# mesh_posed = np.squeeze(batch['mesh_posed'].numpy())
|
||||
gender = int(shape[0, -1] > 0)
|
||||
gender = int(shape[0, -1] > 0.5)
|
||||
print(gender)
|
||||
|
||||
shape_offsets = tf.tensordot(shape[:,:10], smpl.shapedirs[gender], axes=[[1], [2]]).numpy()
|
||||
|
||||
|
||||
mesh_unposed[mask, :] = mesh_unposed[mask, :] - np.squeeze(shape_offsets)[smpl.to_keep, :][mask, :]
|
||||
np.savez_compressed(os.path.join(folder, id, 'mesh_unposed_no_shape', id + '_' + str(i) + '.npz'), mesh_unposed_no_shape = mesh_unposed)
|
||||
|
||||
np.savez_compressed(os.path.join(folder, id, 'mesh_posed_body_no_orient', id + '_' + str(i) + '.npz'), mesh_posed_body_no_orient = T[i, :, :])
|
||||
# np.savez_compressed(os.path.join(folder, id, 'mesh_posed_body_no_orient', id + '_' + str(i) + '.npz'), mesh_posed_body_no_orient = T[i, :, :])
|
||||
|
||||
|
||||
# _, faces = _maskFaces(np.zeros((14475, 3), dtype=np.float32), F, mask)
|
||||
|
||||
Reference in New Issue
Block a user