當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。