ff2.py 文件源码

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

项目:extract 作者: dblalock 项目源码 文件源码
def filterSimMat(simMat, filtLength, filtType, scaleFilterMethod='max1'):
    if filtType == 'hamming':
        filt = np.hamming(filtLength)
    elif filtType == 'flat':
        filt = np.ones(filtLength)
    else:
        raise RuntimeError("Unknown/unsupported filter type {}".format(filtType))
    if scaleFilterMethod == 'max1':
        filt /= np.max(filt)
    elif scaleFilterMethod == 'sum1':
        filt /= np.sum(filt)
    # print filt
    # filt = np.tile(filt, (simMat.shape[0], 1))
    # print filt.shape
    return filters.convolve1d(simMat, weights=filt, axis=1, mode='constant')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号