forked from aliutkus/sisec-mus-oracle
-
Notifications
You must be signed in to change notification settings - Fork 6
/
MIX.py
59 lines (47 loc) · 1.21 KB
/
MIX.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import musdb
import museval
import functools
import argparse
def MIX(track, eval_dir=None):
"""Mixture as Estimate
"""
# perform separtion
estimates = {}
for name, target in track.sources.items():
# set accompaniment source
estimates[name] = track.audio / len(track.sources)
estimates['accompaniment'] = estimates['bass'] + \
estimates['drums'] + estimates['other']
if eval_dir is not None:
museval.eval_mus_track(
track,
estimates,
output_dir=eval_dir,
)
return estimates
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Evaluate Mixture as Estimate'
)
parser.add_argument(
'--audio_dir',
nargs='?',
help='Folder where audio results are saved'
)
parser.add_argument(
'--eval_dir',
nargs='?',
help='Folder where evaluation results are saved'
)
args = parser.parse_args()
# initiate musdb
mus = musdb.DB()
mus.run(
functools.partial(
MIX, eval_dir=args.eval_dir
),
estimates_dir=args.audio_dir,
subsets='test',
parallel=True,
cpus=2
)