diff --git a/README.md b/README.md index 12078ef..e2a0d22 100644 --- a/README.md +++ b/README.md @@ -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. @@ -60,4 +61,4 @@ Just do conda activate mdx-submit ``` -to go back into the environment you have installed MDX's dependencies in. \ No newline at end of file +to go back into the environment you have installed MDX's dependencies in. diff --git a/evaluator/music_demixing.py b/evaluator/music_demixing.py index 1ad121d..cb7f2a1 100644 --- a/evaluator/music_demixing.py +++ b/evaluator/music_demixing.py @@ -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 @@ -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: diff --git a/predict_blend.py b/predict_blend.py index 32faa4c..1909b6b 100644 --- a/predict_blend.py +++ b/predict_blend.py @@ -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): @@ -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