Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaderboard B - Windows Support (workaround) #19

Open
wants to merge 3 commits into
base: leaderboard_B
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## MDX-Net Track B Submission
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Ma5onic/mdx-net-submission/leaderboard_B)

This branch contains the source code and the pretrained model that is submitted to the [Sony MDX Challenge](https://www.aicrowd.com/challenges/music-demixing-challenge-ismir-2021) Track B.

Expand Down Expand Up @@ -60,4 +61,4 @@ Just do
conda activate mdx-submit
```

to go back into the environment you have installed MDX's dependencies in.
to go back into the environment you have installed MDX's dependencies in.
20 changes: 12 additions & 8 deletions evaluator/music_demixing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from contextlib import contextmanager
from os import listdir
from os.path import isfile, join
from sys import platform

import soundfile as sf
import numpy as np
Expand All @@ -21,15 +22,18 @@ class TimeoutException(Exception): pass

@contextmanager
def time_limit(seconds):
def signal_handler(signum, frame):
raise TimeoutException("Prediction timed out!")

signal.signal(signal.SIGALRM, signal_handler)
signal.alarm(seconds)
try:
if platform != "win32":
def signal_handler(signum, frame):
raise TimeoutException("Prediction timed out!")

signal.signal(signal.SIGALRM, signal_handler)
signal.alarm(seconds)
try:
yield
finally:
signal.alarm(0)
else:
yield
finally:
signal.alarm(0)


class MusicDemixingPredictor:
Expand Down
6 changes: 6 additions & 0 deletions predict_blend.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ def demix_base(self, mix):
tar_signal = tar_waves[:,:,trim:-trim].transpose(0,1).reshape(2, -1).numpy()[:, :-pad]

sources.append(tar_signal)
print("\n======================================")
print("Time to execute demix_base(self, mix):")
print(time()-start_time)
print("======================================\n")
return np.array(sources)

def demix_demucs(self, mix):
Expand All @@ -71,7 +74,10 @@ def demix_demucs(self, mix):

sources = (sources * ref.std() + ref.mean()).cpu().numpy()
sources[[0,1]] = sources[[1,0]]
print("\n========================================")
print("Time to execute demix_demucs(self, mix):")
print(time() - start_time)
print("========================================\n")
return sources


Expand Down