def gaussian_image(label):
label = tf.reshape(label, [-1, 2])
indices = np.indices([368, 368])[:, ::8, ::8].astype(np.float32)
coords = tf.constant(indices)
stretch = tf.reshape(tf.to_float(label), [-1, 2, 1, 1])
stretch = tf.tile(stretch, [1, 1, 46, 46])
# pdf = 1.0/(np.sqrt(2*(sigma**2)*np.pi)) * tf.exp(-tf.pow(coords-stretch,2)/(2*sigma**2))
pdf = tf.pow(coords - stretch, 2) / (2 * sigma ** 2)
pdf = tf.reduce_sum(pdf, [1])
# pdf = tf.reduce_prod(pdf,[1])
# print debug
pdf = tf.expand_dims(pdf, 3)
debug = tf.exp(-pdf) # 1.0 / (np.sqrt(2 * (sigma ** 2) * np.pi)) *
pdf_debug_img('super', debug, sigma)
return debug
评论列表
文章目录