def create_cost_bending(tn):
tn_shape = tn.get_shape().as_list();
tn1 = tf.slice(tn, [1,0], [-1,-1]);
tn2 = tf.slice(tn, [0,0], [tn_shape[0]-1,-1]);
dp = tf.reduce_sum(tf.mul(tn1, tn2), reduction_indices = 1);
return tf.scalar_mul(-1.0, tf.reduce_mean(dp));
#def create_cost_side(s, b, length = 1.0, weight_spacing = 1.0, weight_bending = 1.0):
# cost = create_cost_soft_min_distance(s, b);
# if weight_spacing != 0:
# cost_spacing = create_cost_spacing(s, length);
# cost = tf.add(cost, tf.mul(tf.constant(weight_spacing, "float32"), cost_spacing));
# if weight_bending != 0:
# cost_bending = create_cost_bending(s);
# cost = tf.add(cost, tf.mul(tf.constant(weight_bending, "float32"), cost_bending));
# return cost;
machine_vision_c.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录