当前位置: 首页>>代码示例>>Python>>正文


Python museval.eval_mus_track方法代码示例

本文整理汇总了Python中museval.eval_mus_track方法的典型用法代码示例。如果您正苦于以下问题:Python museval.eval_mus_track方法的具体用法?Python museval.eval_mus_track怎么用?Python museval.eval_mus_track使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在museval的用法示例。


在下文中一共展示了museval.eval_mus_track方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_aggregate

# 需要导入模块: import museval [as 别名]
# 或者: from museval import eval_mus_track [as 别名]
def test_aggregate(reference):
    track, _ = reference

    np.random.seed(0)
    random_voc = np.random.random(track.audio.shape)
    random_acc = np.random.random(track.audio.shape)

    # create a silly regression test
    estimates = {
        'vocals': random_voc,
        'accompaniment': random_acc
    }

    scores = museval.eval_mus_track(
        track, estimates
    )

    print(scores.df)

    results = museval.EvalStore()
    results.add_track(scores)
    agg = results.agg_frames_scores()
    print(results) 
开发者ID:sigsep,项目名称:sigsep-mus-eval,代码行数:25,代码来源:test_regression.py

示例2: test_random_estimate

# 需要导入模块: import museval [as 别名]
# 或者: from museval import eval_mus_track [as 别名]
def test_random_estimate(reference):
    track, _ = reference
    np.random.seed(0)
    random_voc = np.random.random(track.audio.shape)
    random_acc = np.random.random(track.audio.shape)

    # create a silly regression test
    estimates = {
        'vocals': random_voc,
        'accompaniment': random_acc
    }

    scores = museval.eval_mus_track(
        track, estimates
    )

    # save json
    with open(
        os.path.join('.', track.name) + '.json', 'w+'
    ) as f:
        f.write(scores.json)

    # validate json
    assert scores.validate() is None 
开发者ID:sigsep,项目名称:sigsep-mus-eval,代码行数:26,代码来源:test_regression.py

示例3: test_one_estimate

# 需要导入模块: import museval [as 别名]
# 或者: from museval import eval_mus_track [as 别名]
def test_one_estimate(reference):
    track, _ = reference

    np.random.seed(0)
    random_voc = np.random.random(track.audio.shape)

    estimates = {
        'vocals': random_voc
    }

    with pytest.warns(UserWarning):
        est_scores = museval.eval_mus_track(
            track, estimates
        )

    est_json = json.loads(est_scores.json)

    assert len(est_json['targets']) == 0 
开发者ID:sigsep,项目名称:sigsep-mus-eval,代码行数:20,代码来源:test_regression.py

示例4: oracle

# 需要导入模块: import museval [as 别名]
# 或者: from museval import eval_mus_track [as 别名]
def oracle(track, separation_fn):
    # compute the mixture complex tf transform
    x = stft(track.audio)
    v = []
    for name, value in track.sources.items():
        v_j = np.sum(np.abs(stft(value.audio))**2,
                     axis=-1, keepdims=True)

        v += [np.squeeze(v_j)]

    v = np.moveaxis(np.array(v), 0, 2)
    y = separation_fn(v, x)

    estimates = {}
    for j, (name, value) in enumerate(track.sources.items()):
        audio_hat = istft(y[..., j])
        estimates[name] = audio_hat

    # Evaluate using museval
    scores = museval.eval_mus_track(
        track, estimates, output_dir=None
    )

    print(scores)

    return estimates 
开发者ID:sigsep,项目名称:norbert,代码行数:28,代码来源:oracle_separation.py

示例5: test_track_scores

# 需要导入模块: import museval [as 别名]
# 或者: from museval import eval_mus_track [as 别名]
def test_track_scores(reference):
    track, ref_scores = reference

    np.random.seed(0)
    random_voc = np.random.random(track.audio.shape)
    random_acc = np.random.random(track.audio.shape)

    # create a silly regression test
    estimates = {
        'vocals': random_voc,
        'accompaniment': random_acc
    }

    scores = museval.eval_mus_track(
        track, estimates
    )

    est_scores = json.loads(scores.json)
    for target in ref_scores['targets']:
        for metric in ['SDR', 'SIR', 'SAR', 'ISR']:

            ref = np.array([d['metrics'][metric] for d in target['frames']])
            idx = [t['name']
                   for t in est_scores['targets']].index(target['name'])
            est = np.array(
                [
                    d['metrics'][metric]
                    for d in est_scores['targets'][idx]['frames']
                ]
            )

            assert np.allclose(ref, est, atol=1e-02, equal_nan=True) 
开发者ID:sigsep,项目名称:sigsep-mus-eval,代码行数:34,代码来源:test_regression.py

示例6: separate_and_evaluate

# 需要导入模块: import museval [as 别名]
# 或者: from museval import eval_mus_track [as 别名]
def separate_and_evaluate(
    track,
    targets,
    model_name,
    niter,
    alpha,
    softmask,
    output_dir,
    eval_dir,
    device='cpu'
):
    estimates = test.separate(
        audio=track.audio,
        targets=targets,
        model_name=model_name,
        niter=niter,
        alpha=alpha,
        softmask=softmask,
        device=device
    )
    if output_dir:
        mus.save_estimates(estimates, track, output_dir)

    scores = museval.eval_mus_track(
        track, estimates, output_dir=eval_dir
    )
    return scores 
开发者ID:sigsep,项目名称:open-unmix-pytorch,代码行数:29,代码来源:eval.py


注:本文中的museval.eval_mus_track方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。