本文整理匯總了Python中tf_nndistance.nn_distance方法的典型用法代碼示例。如果您正苦於以下問題:Python tf_nndistance.nn_distance方法的具體用法?Python tf_nndistance.nn_distance怎麽用?Python tf_nndistance.nn_distance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tf_nndistance
的用法示例。
在下文中一共展示了tf_nndistance.nn_distance方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import tf_nndistance [as 別名]
# 或者: from tf_nndistance import nn_distance [as 別名]
def __init__(self, seq_length, num_points=128):
self.ground_truth = tf.placeholder(tf.float32, [1, seq_length, num_points, 3])
self.prediction = tf.placeholder(tf.float32, [1, seq_length, num_points, 3])
gt_frames = tf.split(value=self.ground_truth, num_or_size_splits=seq_length, axis=1)
gt_frames = [tf.squeeze(input=frame, axis=[1]) for frame in gt_frames]
pd_frames = tf.split(value=self.prediction, num_or_size_splits=seq_length, axis=1)
pd_frames = [tf.squeeze(input=frame, axis=[1]) for frame in pd_frames]
cds, emds = [], []
for i in range(seq_length):
match = tf_approxmatch.approx_match(gt_frames[i], pd_frames[i])
emd_distance = tf.reduce_mean(tf_approxmatch.match_cost(gt_frames[i], pd_frames[i], match))
emds.append(emd_distance)
dists_forward, _, dists_backward, _ = tf_nndistance.nn_distance(pd_frames[i], gt_frames[i])
cd_distance = tf.reduce_mean(dists_forward+dists_backward)
cds.append(cd_distance)
self.cds = tf.stack(cds, 0)
self.emds = tf.stack(emds, 0)