Fix fake data generation

This commit is contained in:
romi1502
2020-06-05 13:42:52 +02:00
parent e22c64a270
commit ff3ac620dc

View File

@@ -26,28 +26,28 @@ from spleeter.commands import evaluate
from spleeter.utils.configuration import load_configuration from spleeter.utils.configuration import load_configuration
res_4stems = { "vocals": { res_4stems = { "vocals": {
"SDR": -0.009, "SDR": -0.007,
"SAR": -19.044, "SAR": -19.231,
"SIR": -4.072, "SIR": -4.528,
"ISR": -0.000 "ISR": 0.000
}, },
"drums": { "drums": {
"SDR": -0.066, "SDR": -0.071,
"SAR": -14.294, "SAR": -14.496,
"SIR": -4.908, "SIR": -4.987,
"ISR": 0.002 "ISR": 0.001
}, },
"bass":{ "bass":{
"SDR": -0.000, "SDR": -0.001,
"SAR": -6.364, "SAR": -12.426,
"SIR": -9.396, "SIR": -7.198,
"ISR": -0.001 "ISR": -0.001
}, },
"other":{ "other":{
"SDR": -1.464, "SDR": -1.453,
"SAR": -14.893, "SAR": -14.899,
"SIR": -4.762, "SIR": -4.678,
"ISR": -0.027 "ISR": -0.015
} }
} }
@@ -58,10 +58,10 @@ def generate_fake_eval_dataset(path):
fs = 44100 fs = 44100
duration = 3 duration = 3
n_channels = 2 n_channels = 2
rng = np.random.RandomState(seed=0)
for song in range(n_songs): for song in range(n_songs):
song_path = join(path, "test", f"song{song}") song_path = join(path, "test", f"song{song}")
makedirs(song_path, exist_ok=True) makedirs(song_path, exist_ok=True)
rng = np.random.RandomState(seed=0)
for instr in ["mixture", "vocals", "bass", "drums", "other"]: for instr in ["mixture", "vocals", "bass", "drums", "other"]:
filename = join(song_path, f"{instr}.wav") filename = join(song_path, f"{instr}.wav")
data = rng.rand(duration*fs, n_channels)-0.5 data = rng.rand(duration*fs, n_channels)-0.5
@@ -76,4 +76,4 @@ def test_evaluate(path="FAKE_MUSDB_DIR"):
metrics = evaluate.entrypoint(arguments, params) metrics = evaluate.entrypoint(arguments, params)
for instrument, metric in metrics.items(): for instrument, metric in metrics.items():
for metric, value in metric.items(): for metric, value in metric.items():
assert np.allclose(np.median(value), res_4stems[instrument][metric], atol=1e-3) assert np.allclose(np.median(value), res_4stems[instrument][metric], atol=1e-3)