data_handling.py 文件源码

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

项目:neural-segmentation 作者: melsner 项目源码 文件源码
def pSegs2Segs(pSegs, acoustic=False, threshold=0.1, implementation='delta'):
    if acoustic:
        if implementation == 'delta':
            return relMaxWithDelta(pSegs, threshold)
        else:
            padding = [(0, 0) for d in range(len(pSegs.shape))]
            padding[1] = (1, 1)
            pSegs_padded = np.pad(pSegs, padding, 'constant', constant_values=0.)
            pSegs_padded[pSegs_padded < threshold] = 0
            segs = np.zeros_like(pSegs_padded)
            segs[argrelmax(pSegs_padded, 1)] = 1
            return segs[:, 1:-1, :]
    else:
        return pSegs > 0.5
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号