Skip to content
Snippets Groups Projects
Commit 4bf09366 authored by chinyun_yu_joey's avatar chinyun_yu_joey
Browse files

draft

parent 49eba0d3
No related branches found
Tags submission-fusion-3model
No related merge requests found
eval.py 0 → 100644
import museval
import argparse
if __name__ == '__main__':
# Training settings
parser = argparse.ArgumentParser(
description='MUSDB18 Evaluation',
add_help=False
)
parser.add_argument(
'--eval-path',
type=str,
help='Path evaluation root folder'
)
args = parser.parse_args()
method = museval.EvalStore()
method.add_eval_dir(args.eval_path)
print(method)
......@@ -12,7 +12,7 @@ def separate(
audio,
rate,
model,
shifts=5,
shifts=1,
device="cpu"
):
......
......@@ -4,6 +4,7 @@ import norbert
import numpy as np
import soundfile as sf
import torch
from tqdm import tqdm
# from torch_specinv import griffin_lim
from evaluator.music_demixing import MusicDemixingPredictor
......@@ -47,7 +48,7 @@ def istft(X, n_fft=4096, n_hopsize=1024):
def separate(
audio,
x_umx_target,
niter=0,
niter=1,
softmask=False,
alpha=1.0,
residual_model=False,
......@@ -90,7 +91,11 @@ def separate(
with torch.no_grad():
mag = X.abs()
masked_tf_rep = x_umx_target(mag.unsqueeze(0)).squeeze() * mag
frames = 2584
masked_tf_rep = []
for chunk in tqdm(mag.split(frames, dim=-1)):
masked_tf_rep += [x_umx_target(chunk.unsqueeze(0)).squeeze()]
masked_tf_rep = torch.cat(masked_tf_rep, -1) * mag
Vj = masked_tf_rep.cpu().numpy()
if softmask:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment