• Stars
    star
    196
  • Rank 198,553 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

museval - source separation evaluation tools for python

museval

Build Status Latest Version Supported Python versions

A python package to evaluate source separation results using the MUSDB18 dataset. This package was part of the MUS task of the Signal Separation Evaluation Campaign (SISEC).

BSSEval v4

The BSSEval metrics, as implemented in the MATLAB toolboxes and their re-implementation in mir_eval are widely used in the audio separation literature. One particularity of BSSEval is to compute the metrics after optimally matching the estimates to the true sources through linear distortion filters. This allows the criteria to be robust to some linear mismatches. Apart from the optional evaluation for all possible permutations of the sources, this matching is the reason for most of the computation cost of BSSEval, especially considering it is done for each evaluation window when the metrics are computed on a framewise basis.

For this package, we enabled the option of having time invariant distortion filters, instead of necessarily taking them as varying over time as done in the previous versions of BSS eval. First, enabling this option significantly reduces the computational cost for evaluation because matching needs to be done only once for the whole signal. Second, it introduces much more dynamics in the evaluation, because time-varying matching filters turn out to over-estimate performance. Third, this makes matching more robust, because true sources are not silent throughout the whole recording, while they often were for short windows.

Installation

Package installation

You can install the museval parsing package using pip:

pip install museval

Usage

The purpose of this package is to evaluate source separation results and write out validated json files. We want to encourage users to use this evaluation output format as the standardized way to share source separation results. museval is designed to work in conjuction with the musdb tools and the MUSDB18 dataset (however, museval can also be used without musdb).

Separate MUSDB18 tracks and Evaluate on-the-fly

  • If you want to perform evaluation while processing your source separation results, you can make use musdb track objects. Here is an example for such a function separating the mixture into a vocals and accompaniment track:
import musdb
import museval

def estimate_and_evaluate(track):
    # assume mix as estimates
    estimates = {
        'vocals': track.audio,
        'accompaniment': track.audio
    }

    # Evaluate using museval
    scores = museval.eval_mus_track(
        track, estimates, output_dir="path/to/json"
    )

    # print nicely formatted and aggregated scores
    print(scores)

mus = musdb.DB()
for track in mus:
    estimate_and_evaluate(track)

Make sure output_dir is set. museval will recreate the musdb file structure in that folder and write the evaluation results to this folder.

Evaluate MUSDB18 tracks later

If you have already computed your estimates, we provide you with an easy-to-use function to process evaluation results afterwards.

Simply use the museval.eval_mus_dir to evaluate your estimates_dir and write the results into the output_dir. For convenience, the eval_mus_dir function accepts all parameters of the musdb.run().

import musdb
import museval

# initiate musdb
mus = musdb.DB()

# evaluate an existing estimate folder with wav files
museval.eval_mus_dir(
    dataset=mus,  # instance of musdb
    estimates_dir=...,  # path to estimate folder
    output_dir=...,  # set a folder to write eval json files
    ext='wav
)

Aggregate and Analyze Scores

Scores for each track can also be aggregated in a pandas DataFrame for easier analysis or the creation of boxplots. To aggregate multiple tracks in a DataFrame, create museval.EvalStore() object and add the track scores successively.

results = museval.EvalStore(frames_agg='median', tracks_agg='median')
for track in tracks:
    # ...
    results.add_track(museval.eval_mus_track(track, estimates))

You may also add scores that have been computed beforehand through museval.eval_mus_dir:

results = museval.EvalStore(frames_agg='median', tracks_agg='median')
results.add_eval_dir(
    path=...# path to the output_dir for eval_mus_dir
)

When all tracks have been added, the aggregated scores can be shown using print(results) and results may be saved as a pandas DataFrame results.save('my_method.pandas').

To compare multiple methods, create a museval.MethodStore() object add the results

methods = museval.MethodStore()
methods.add_evalstore(results, name="XZY")

To compare against participants from SiSEC MUS 2018, we provide a convenient method to load the existing scores on demand using methods.add_sisec18(). For the creation of plots and statistical significance tests we refer to our list of examples.

Commandline tool

We provide a command line wrapper of eval_mus_dir by calling the museval command line tool. The following example is equivalent to the code example above:

museval --musdb path/to/musdb -o path/to/output_dir path/to/estimate_dir

💡 you use the --is-wav flag to use the decoded wav musdb dataset.

Using Docker for Evaluation

If you don't want to set up a Python environment to run the evaluation, we would recommend to use Docker. Assuming you have already computed your estimates and installed docker in your machine, you just need to run the following two lines in your terminal:

1. Pull Docker Container

Pull our precompiled sigsep-mus-eval image from dockerhub:

docker pull faroit/sigsep-mus-eval

2. Run evaluation

To run the evaluation inside of the docker, three absolute paths are required:

  • estimatesdir will stand here for the absolute path to the estimates directory. (For instance /home/faroit/dev/mymethod/musdboutput)
  • musdbdir will stand here for the absolute path to the root folder of musdb. (For instance /home/faroit/dev/data/musdb18)
  • outputdir will stand here for the absolute path to the output directory. (For instance /home/faroit/dev/mymethod/scores)

We just mount these directories into the docker container using the -v flags and start the docker instance:

docker run --rm -v estimatesdir:/est -v musdbdir:/mus -v outputdir:/out faroit/sigsep-mus-eval --musdb /mus -o /out /est

In the line above, replace estimatesdir, musdbdir and outputdir by the absolute paths for your setting. Please note that docker requires absolute paths so you have to rely on your command line environment to convert relative paths to absolute paths (e.g. by using $HOME/ on Unix).

⚠️ museval requires a significant amount of memory for the evaluation. Evaluating all five targets for MUSDB18 may require more than 4GB of RAM. It is recommended to adjust your Docker preferences, because the docker container might just quit if its out of memory.

How to contribute

museval is a community focused project, we therefore encourage the community to submit bug-fixes and requests for technical support through github issues. For more details of how to contribute, please follow our CONTRIBUTING.md.

References

A. If you use the museval in the context of source separation evaluation comparing a method it to other methods of SiSEC 2018, please cite

@InProceedings{SiSEC18,
  author="St{\"o}ter, Fabian-Robert and Liutkus, Antoine and Ito, Nobutaka",
  title="The 2018 Signal Separation Evaluation Campaign",
  booktitle="Latent Variable Analysis and Signal Separation:
  14th International Conference, LVA/ICA 2018, Surrey, UK",
  year="2018",
  pages="293--305"
}

B. if you use the software for any other purpose, you can cite the software release

DOI

More Repositories

1

open-unmix-pytorch

Open-Unmix - Music Source Separation for PyTorch
Python
1,232
star
2

norbert

Painless Wiener filters for audio separation
Python
180
star
3

sigsep-mus-db

Python parser and tools for MUSDB18 Music Separation Dataset
Python
159
star
4

website

Vue
104
star
5

open-unmix-nnabla

Open-Unmix - Music Source Separation for NNabla
Python
63
star
6

sigsep-mus-2018

SiSEC MUS 2018 Submission System
Python
43
star
7

bsseval

audio source separation evaluation metrics
Python
27
star
8

open-unmix-tensorflow

open unmix - music source separation for tensorflow
22
star
9

open-unmix-demo-electron

desktop source separation demo player
Vue
21
star
10

open-unmix-js

web based audio unmixing
JavaScript
12
star
11

sigsep-mus-2018-analysis

Analysis and Visualization for SiSEC 2018
Jupyter Notebook
9
star
12

sigsep-mus-io

Tools to convert sigsep mus dataset from STEMS <-> WAV
Shell
8
star
13

ismir2018_tutorial

Music source separation: making it work
CSS
7
star
14

open-unmix-paper-joss

Repository for the open-unmix JOSS submission
TeX
6
star
15

share

multitrack share platform
Vue
3
star
16

stem-player-website

CSS
2
star
17

slides-pytorch-summer-hackathon

HTML
2
star
18

sigsep-mus-mdbconvert

Python
2
star
19

sigsep-mus-preview-generator

Trimmer for generating the SiSEC MUS 2018 previews
Python
2
star
20

sigsep.github.io

sigsep website. Edit here: https://github.com/sigsep/website
HTML
2
star
21

eusipco2019_tutorial

Deep learning for music separation
HTML
1
star
22

sigsep-mus-2018-website

SiSEC MUS 2018 Website
Vue
1
star
23

talk-rennes2018-dl-slides

JavaScript
1
star
24

pub-SiSEC2018

Paper for SiSEC 2018, published at LVA/ICA
TeX
1
star
25

slides-deeplearning-musicseparation

JavaScript
1
star