annotation_distance_metrics.py 文件源码

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

项目:pylidc 作者: pylidc 项目源码 文件源码
def pairdist(ann1, ann2, which):
    """
    Compute the pairwise euclidean distance between 
    the contour boundary points, and return the 
    minimum, maximum, or average value.

    which: str
        One of 'min', 'max', or 'avg'.
    """
    dists = cdist(ann1.contours_to_matrix(0),
                  ann2.contours_to_matrix(0))

    if   which == 'min':
        return dists.min()
    elif which == 'max':
        return dists.max()
    elif which == 'avg':
        return dists.mean()
    else:
        raise ValueError('invalid `which` value.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号