def match_to_dict(image_as_patches, dictionary):
patch_size = len(image_as_patches.get_shape())+1
distance = tf.reduce_sum(tf.square(tf.expand_dims(image_as_patches,1) - tf.expand_dims(dictionary,0)), range(2,patch_size))
min_loc = tf.argmin(distance, 1)
return tf.gather(dictionary, min_loc)
评论列表
文章目录