def laplace_loss_2(pred1, pred2, placeholders, block_id):
# laplace term
lap1 = laplace_coord(pred1, placeholders, block_id)
lap2 = laplace_coord(pred2, placeholders, block_id)
laplace_loss = tf.reduce_mean(tf.reduce_sum(tf.square(tf.subtract(lap1, lap2)), 1)) * 1500
move_loss = tf.reduce_mean(tf.reduce_sum(tf.square(tf.subtract(pred1, pred2)), 1)) * 100
return laplace_loss + move_loss
def mesh_loss_2(pred, placeholders, block_id):
gt_pt = placeholders['labels'][:, :3] # gt points
gt_nm = placeholders['labels'][:, 3:] # gt normals
# edge in graph
nod1 = tf.gather(pred, placeholders['edges'][block_id - 1][:, 0])
nod2 = tf.gather(pred, placeholders['edges'][block_id - 1][:, 1])
edge = tf.subtract(nod1, nod2)
# edge length loss
edge_length = tf.reduce_sum(tf.square(edge), 1)
edge_loss = tf.reduce_mean(edge_length) * 500
# chamfer distance
sample_pt = sample(pred, placeholders, block_id)
sample_pred = tf.concat([pred, sample_pt], axis=0)
dist1, idx1, dist2, idx2 = nn_distance(gt_pt, sample_pred)
point_loss = (tf.reduce_mean(dist1) + 0.55 * tf.reduce_mean(dist2)) * 3000
# normal cosine loss
normal = tf.gather(gt_nm, tf.squeeze(idx2, 0))
normal = tf.gather(normal, placeholders['edges'][block_id - 1][:, 0])
cosine = tf.abs(tf.reduce_sum(tf.multiply(unit(normal), unit(edge)), 1))
normal_loss = tf.reduce_mean(cosine) * 0.5
total_loss = point_loss + edge_loss + normal_loss
return total_loss
Hi,
I was intrigued regarding the constants we can find in the
mesh_lossfunction (for example the *500 onedge_loss) so I looked at your paper but I didn't find any mention of these, I assume they are regularization constants.I have two questions regarding these constants :
chamfer_losswhich isn't regularized, 1500 for laplace_loss` which would indicate a regularization factor of 0.5). What is the number 3000 based on?tf.reduce_mean(dist2)in chamfer loss. What is this number?I notice the same question was asked on the Pixel2Mesh repository here but there are no answer. Hopefully we could kill two birds with one stone with an answer here or there :)