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
评论列表
文章目录