cache_feature.py 文件源码

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

项目:gcforest 作者: w821881341 项目源码 文件源码
def save_cache(src_path, des_path, get_feature_func):
    des_path = osp.splitext(des_path)[0] + '.npy'
    try:
        X, sr = librosa.load(src_path)
        src = int(sr)
        feature = get_feature_func(X, sr)
        print('[INFO] Saving Cache in {} ...'.format(des_path))
        des_par = osp.abspath(osp.join(des_path, osp.pardir))
        if not osp.exists(des_par):
            os.makedirs(des_par)
    except Exception, e:
        print("[ERROR] Unkown error happend when dealing with{}".format(src_path))
        #print(e)
        return -1
    np.save(des_path, feature)
    return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号