dists_forward has the shape output: dist1: (batch_size,#point_1) that means it's averaged over num_points
and hence you aren't dividing it by num_points.
while calculating earth mover distance using tf_approxmatch module
match = tf_approxmatch.approx_match(frames[i+int(seq_length/2)], predicted_frames[i]) emd_distance = tf.reduce_mean(input_tensor=tf_approxmatch.match_cost(frames[i+int(seq_length/2)], predicted_frames[i], match))
match_cost has the shape match : batch_size * #query_points * #dataset_points and after taking reduce mean it's giving the mean over whole point cloud and that's why you are dividing the emd loss as self.emd /= (int(seq_length/2)*num_points)
But in the loss calculation you are using self.loss += (alpha*loss_cd + beta*loss_emd) before dividing loss_emd with the num_points that means loss_cd is calculated over per molecule but loss _emd is calculated over per point cloud and let's assume if we take alpha as 1 and beta as 1, will that mean we aren't taking the equal contribution of both type of loss?
Hey! while calculating chamfer distance loss using
tf_nn_distance
moduledists_forward, _, dists_backward, _ = tf_nndistance.nn_distance(predicted_frames[i], frames[i+int(seq_length/2)]) loss_cd = tf.reduce_mean(input_tensor=dists_forward+dists_backward)
dists_forward
has the shapeoutput: dist1: (batch_size,#point_1)
that means it's averaged overnum_points
and hence you aren't dividing it bynum_points
.while calculating earth mover distance using
tf_approxmatch
modulematch = tf_approxmatch.approx_match(frames[i+int(seq_length/2)], predicted_frames[i]) emd_distance = tf.reduce_mean(input_tensor=tf_approxmatch.match_cost(frames[i+int(seq_length/2)], predicted_frames[i], match))
match_cost
has the shapematch : batch_size * #query_points * #dataset_points
and after taking reduce mean it's giving the mean over whole point cloud and that's why you are dividing the emd loss asself.emd /= (int(seq_length/2)*num_points)
But in the loss calculation you are using
self.loss += (alpha*loss_cd + beta*loss_emd)
before dividingloss_emd
with thenum_points
that means loss_cd is calculated over per molecule but loss _emd is calculated over per point cloud and let's assume if we take alpha as 1 and beta as 1, will that mean we aren't taking the equal contribution of both type of loss?@hehefan Could you please clarify this? Thanks.