updated pipeline, added uv_mask_loss

This commit is contained in:
2022-06-12 15:50:30 +00:00
parent 94e693d7f6
commit def8a85cf9
6 changed files with 160 additions and 78 deletions
+11
View File
@@ -187,6 +187,17 @@ def collision_penalty(va, vb, mask, eps=1e-3):
return tf.reduce_sum(interpenetration**3) / batch_size
whole_garment_uv_mask = np.load('custom_utils/mask_256x512.npy')
def uv_mask_loss(pred, uv_mask):
inv_mask = (1 - uv_mask) * whole_garment_uv_mask
pred = tf.reduce_sum(pred, axis=1)
invalid = pred * inv_mask
invalid = invalid > 0.01
invalid_count = tf.math.count_nonzero(invalid, dtype=tf.float32)
total_count = tf.math.count_nonzero(inv_mask, dtype=tf.float32)
return invalid_count / total_count
if __name__ == '__main__':
V = tf.ones((4, 14475, 3))