machine_vision_d.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:CElegansBehaviour 作者: ChristophKirst 项目源码 文件源码
def create_cost_soft_min_aligned_distance(x,y,nx,ny, k = 2.0, gamma = 1.0):
  d = create_pair_wise_distances(x, y);
  a = create_pair_wise_dots(nx, ny);
  a = tf.scalar_mul(-0.5, tf.add(a, -1.0)); # [0,1] 0 = aligned
  return tf.reduce_mean(create_aligned_distance(d, a, k = k, gamma = gamma));


#def create_cost_spacing(c, length, normalized = True):
#  c_shape = c.get_shape().as_list();
#  c1 = tf.slice(c, [1,0], [-1,-1]);
#  c2 = tf.slice(c, [0,0], [c_shape[0]-1,-1]);
#  d = tf.sqrt(tf.reduce_sum(tf.squared_difference(c1,c2), reduction_indices = 1));
#  if normalized:
#    return tf.reduce_mean(tf.squared_difference(d, tf.constant(length / (c_shape[0]-1), "float32")));
#  else:
#    return tf.reduce_mean(tf.squared_difference(d, tf.constant(length, "float32")));
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号