post_processing.py 文件源码

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

项目:DocumentSegmentation 作者: SeguinBe 项目源码 文件源码
def hysteresis_thresholding(probs: np.array, candidates: np.array, low_threshold: float, high_threshold: float):
    low_mask = candidates & (probs > low_threshold)
    # Connected components extraction
    label_components, count = label(low_mask, np.ones((3, 3)))
    # Keep components with high threshold elements
    good_labels = np.unique(label_components[low_mask & (probs > high_threshold)])
    label_masks = np.zeros((count + 1,), bool)
    label_masks[good_labels] = 1
    return label_masks[label_components]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号