示例#1
0
def test_silent_sources(X, V):
    V[..., :] = 0.0
    Y = norbert.softmask(V, X)

    assert X.shape == Y.shape[:-1]

    Y = norbert.wiener(V, X)
    assert X.shape == Y.shape[:-1]
示例#2
0
def test_softmask_copy(X, V):
    X0 = X.clone()
    V0 = V.clone()

    _ = norbert.softmask(V, X)

    assert torch.allclose(X0, X)
    assert torch.allclose(V0, V)
示例#3
0
def test_softmask_copy(X, V):
    X0 = np.copy(X)
    V0 = np.copy(V)

    _ = norbert.softmask(V, X)

    assert np.allclose(X0, X)
    assert np.allclose(V0, V)
示例#4
0
def test_shapes(X, V):
    Y = norbert.wiener(V, X)

    assert X.shape == Y.shape[:-1]

    Y = norbert.softmask(V, X)

    assert X.shape == Y.shape[:-1]
示例#5
0
def test_shapes(V, X):
    Y = norbert.residual(V, X)
    assert X.shape == Y.shape[:-1]

    Y = norbert.wiener(V, X)
    assert X.shape == Y.shape[:-1]

    Y = norbert.softmask(V, X)
    assert X.shape == Y.shape[:-1]
示例#6
0
def oracle(track):
    # compute the mixture complex tf transform
    x = stft(torch.from_numpy(track.audio.T)).transpose(0, 2)
    v = []
    for name, value in track.sources.items():
        v_j = stft(torch.from_numpy(value.audio.T)).transpose(0, 2).abs()**2
        v += [v_j]
    v = torch.stack(v, 3)

    y = norbert.softmask(v, x).permute(3, 2, 1, 0)

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

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

    print(scores)

    return estimates
示例#7
0
def test_softmask(V, X):
    X = X.shape[-1] * np.ones(X.shape)

    Y = norbert.softmask(V, X)
    assert np.allclose(Y.sum(-1), X)
示例#8
0
def test_softmask(V, X):
    X = (X.shape[-1] * torch.ones(X.shape)).to(torch.complex128)
    Y = norbert.softmask(V, X)
    assert torch.allclose(Y.sum(-1), X)
    Y.sum().backward()
示例#9
0
 def closure(v, x):
     return norbert.softmask(torch.from_numpy(v),
                             torch.from_numpy(x)).numpy()
示例#10
0
def test_softmask(V, X):
    X = (X.shape[-1] * np.ones(X.shape)).astype(np.complex128)
    Y = norbert.softmask(V, X)
    assert np.allclose(Y.sum(-1), X)