Loading
Feedback

Music Demixing Challenge @ISMIR 2021

🚀 Make your submissions from inside Google Colab

Explore different baselines and make your submission

By  vrv

Dear participants,

Check out the Colab notebook below, and get started with the challenge easily, right from inside Google Colab!

Let us know if you face any issues or want to share any feedback. 



AIcrowd

How to use this notebook 📝

  1. Copy the notebook. This is a shared template and any edits you make here will not be saved. You should copy it into your own drive folder. For this, click the "File" menu (top-left), then "Save a Copy in Drive". You can edit your copy however you like.
  2. Link it to your AIcrowd account. In order to submit your code to AIcrowd, you need to add ssh key to your GitLab account temporarily.
  3. Stick to the classes definitions. The submission to AIcrowd will look for the pre-defined class names.

Your music demixing solution 🚀

In this notebook, you can play with the data, and define and train your music demixing model. You can then directly submit it to the AIcrowd, with some magic code at the end.

Baselines

You can also play with the baselines available in example below!

Setup the notebook 🛠

In [ ]:
!pip install -q -U "tqdm<4.60"
!apt install git-lfs
!git clone https://github.com/AIcrowd/music-demixing-challenge-starter-kit.git > /dev/null
%cd music-demixing-challenge-starter-kit
!git lfs pull
     |████████████████████████████████| 81kB 7.1MB/s 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libnvidia-common-460
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
  git-lfs
0 upgraded, 1 newly installed, 0 to remove and 34 not upgraded.
Need to get 2,129 kB of archives.
After this operation, 7,662 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 git-lfs amd64 2.3.4-1 [2,129 kB]
Fetched 2,129 kB in 1s (2,909 kB/s)
Selecting previously unselected package git-lfs.
(Reading database ... 160706 files and directories currently installed.)
Preparing to unpack .../git-lfs_2.3.4-1_amd64.deb ...
Unpacking git-lfs (2.3.4-1) ...
Setting up git-lfs (2.3.4-1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Cloning into 'music-demixing-challenge-starter-kit'...
remote: Enumerating objects: 171, done.
remote: Counting objects: 100% (171/171), done.
remote: Compressing objects: 100% (92/92), done.
remote: Total 171 (delta 82), reused 153 (delta 70), pack-reused 0
Receiving objects: 100% (171/171), 5.08 MiB | 31.34 MiB/s, done.
Resolving deltas: 100% (82/82), done.
/content/music-demixing-challenge-starter-kit
Git LFS: (5 of 5 files) 5.89 MB / 5.89 MB

👇 Run the below collapsed cell for helper functions

In [ ]:
#@title
import os
import IPython
import pprint

def display_result(path):
  print(path)
  print("🔈 Bass:")
  display(IPython.display.Audio(path + "/bass.wav"))
  print("🥁 Drums:")
  display(IPython.display.Audio(path + "/drums.wav"))
  print("🎹 Other:")
  display(IPython.display.Audio(path + "/other.wav"))
  print("🎤 Vocals:")
  display(IPython.display.Audio(path + "/vocals.wav"))

def install_pip_and_apt_on_colab():
  default_requirements = open("requirements.txt").read().split('\n')
  local_pip_install = " ".join(default_requirements + PIP_PACKAGES)
  default_packages = open("apt.txt").read().split('\n')
  local_apt_install = " ".join(default_packages + APT_PACKAGES)
  !pip install -q $local_pip_install
  !apt install -y {local_apt_install}

def write_custom_implementation(file_name):
  relevant_cell = None
  for i in _ih[::-1]:
    if "bfb41056a0e55e7b715c21ea9285cb1c" in i and "relevant_cell" not in i:
      relevant_cell = i

  if relevant_cell is None:
    raise Exception("Did you run your custom code?")

  with open(file_name, "w") as f:
    f.write(relevant_cell)

def add_models_to_submission(model_regex):
  import os
  echo_and_run("git lfs install")
  echo_and_run("git lfs track \"%s\"" % model_regex)
  echo_and_run("git add .gitattributes")

def echo_and_run(command):
  print("#> " + command)
  return os.system(command)

def make_submission():
  status_code = echo_and_run("ssh -o StrictHostKeyChecking=no -T git@gitlab.aicrowd.com")
  if status_code > 1:
    raise Exception("SSH login failed, did you add above SSH key in your account?")
  !git push aicrowd master -f
  !git push aicrowd --tags

def prepare_for_submission(class_name, commit_message=None):
  import datetime
  import time
  timestamp_now = int(time.time())
  time_now = datetime.datetime.utcnow().strftime('%B %d %Y - %H:%M:%S')
  file_name = os.popen("grep -nr \"class %s\" *.py" % class_name).read().split(':')[0].split('.')[0]
  predict_py_content = """#!/usr/bin/env python
from {file_name} import {class_name}

submission = {class_name}()
submission.run()
print("Successfully completed music demixing...")
""".format(class_name=class_name, file_name=file_name)
  with open("predict.py", "w") as f:
    f.write(predict_py_content)

  echo_and_run("git add .")
  if not commit_message:
    commit_message = "Automated submission via notebook: %s" % time_now
  if not AICROWD_USER_NAME or not AICROWD_EMAIL_ID:
    raise Exception("AICROWD_USER_NAME or AICROWD_EMAIL_ID not configured")
  echo_and_run("git config --global user.name \"%s\"" % AICROWD_USER_NAME)
  echo_and_run("git config --global user.email \"%s\"" % AICROWD_EMAIL_ID)
  echo_and_run("git commit -m \"%s\"" % commit_message)
  echo_and_run("git remote add aicrowd git@gitlab.aicrowd.com:%s/music-demixing-challenge-starter-kit.git" % AICROWD_USER_NAME)
  echo_and_run("git tag submission-v%s" % timestamp_now)
  if not os.path.isfile("/root/.ssh/id_rsa.pub"):
    echo_and_run('cat /dev/zero | ssh-keygen -q -N "" > /dev/null')
  ssh_pub = open("/root/.ssh/id_rsa.pub").read()
  return IPython.display.HTML("""
  <h3>👉 Copy paste below ssh key to your profile: 
    <a href="https://gitlab.aicrowd.com/profile/keys" target="_blank">Add</a>
  </h3>
  <i>Please remove the SSH key from your profile after you make your submission.<i>
  <br>
  <textarea cols=100 rows=10>%s</textarea>""" % ssh_pub)

Configure your environment 📎

In [ ]:
# Additional **pip** packages required by your submission
# Default list: https://github.com/AIcrowd/music-demixing-challenge-starter-kit/blob/master/requirements.txt
PIP_PACKAGES = [
    'musdb',
]

# Additional **apt** packages required by your submission.
# Default list: https://github.com/AIcrowd/music-demixing-challenge-starter-kit/blob/master/apt.txt
APT_PACKAGES = [
    'ffmpeg',
]

install_pip_and_apt_on_colab()
ERROR: botocore 1.20.72 has requirement urllib3<1.27,>=1.25.4, but you'll have urllib3 1.24.3 which is incompatible.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
git is already the newest version (1:2.17.1-1ubuntu0.8).
libsndfile1 is already the newest version (1.0.28-4ubuntu0.18.04.1).
ffmpeg is already the newest version (7:3.4.8-0ubuntu0.2).
The following package was automatically installed and is no longer required:
  libnvidia-common-460
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  libao-common libao4 libid3tag0 libmad0 libmagic-mgc libmagic1
  libopencore-amrnb0 libopencore-amrwb0 libsox-fmt-alsa libsox-fmt-ao
  libsox-fmt-base libsox-fmt-mp3 libsox-fmt-oss libsox-fmt-pulse libsox3
Suggested packages:
  libaudio2 file
The following NEW packages will be installed:
  libao-common libao4 libid3tag0 libmad0 libmagic-mgc libmagic1
  libopencore-amrnb0 libopencore-amrwb0 libsox-dev libsox-fmt-all
  libsox-fmt-alsa libsox-fmt-ao libsox-fmt-base libsox-fmt-mp3 libsox-fmt-oss
  libsox-fmt-pulse libsox3 sox
0 upgraded, 18 newly installed, 0 to remove and 34 not upgraded.
Need to get 1,267 kB of archives.
After this operation, 9,153 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopencore-amrnb0 amd64 0.1.3-2.1 [92.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopencore-amrwb0 amd64 0.1.3-2.1 [45.8 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.4 [184 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.4 [68.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 libao-common all 1.2.2+20180113-1ubuntu1 [6,644 B]
Get:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 libao4 amd64 1.2.2+20180113-1ubuntu1 [35.1 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libid3tag0 amd64 0.15.1b-13 [31.2 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libmad0 amd64 0.15.1b-9ubuntu18.04.1 [64.6 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox3 amd64 14.4.2-3ubuntu0.18.04.1 [226 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-fmt-alsa amd64 14.4.2-3ubuntu0.18.04.1 [10.6 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-fmt-ao amd64 14.4.2-3ubuntu0.18.04.1 [7,464 B]
Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-fmt-base amd64 14.4.2-3ubuntu0.18.04.1 [32.1 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-fmt-mp3 amd64 14.4.2-3ubuntu0.18.04.1 [15.9 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-fmt-oss amd64 14.4.2-3ubuntu0.18.04.1 [9,012 B]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-fmt-pulse amd64 14.4.2-3ubuntu0.18.04.1 [7,348 B]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-fmt-all amd64 14.4.2-3ubuntu0.18.04.1 [5,128 B]
Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libsox-dev amd64 14.4.2-3ubuntu0.18.04.1 [325 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 sox amd64 14.4.2-3ubuntu0.18.04.1 [101 kB]
Fetched 1,267 kB in 1s (1,590 kB/s)
Selecting previously unselected package libopencore-amrnb0:amd64.
(Reading database ... 160752 files and directories currently installed.)
Preparing to unpack .../00-libopencore-amrnb0_0.1.3-2.1_amd64.deb ...
Unpacking libopencore-amrnb0:amd64 (0.1.3-2.1) ...
Selecting previously unselected package libopencore-amrwb0:amd64.
Preparing to unpack .../01-libopencore-amrwb0_0.1.3-2.1_amd64.deb ...
Unpacking libopencore-amrwb0:amd64 (0.1.3-2.1) ...
Selecting previously unselected package libmagic-mgc.
Preparing to unpack .../02-libmagic-mgc_1%3a5.32-2ubuntu0.4_amd64.deb ...
Unpacking libmagic-mgc (1:5.32-2ubuntu0.4) ...
Selecting previously unselected package libmagic1:amd64.
Preparing to unpack .../03-libmagic1_1%3a5.32-2ubuntu0.4_amd64.deb ...
Unpacking libmagic1:amd64 (1:5.32-2ubuntu0.4) ...
Selecting previously unselected package libao-common.
Preparing to unpack .../04-libao-common_1.2.2+20180113-1ubuntu1_all.deb ...
Unpacking libao-common (1.2.2+20180113-1ubuntu1) ...
Selecting previously unselected package libao4:amd64.
Preparing to unpack .../05-libao4_1.2.2+20180113-1ubuntu1_amd64.deb ...
Unpacking libao4:amd64 (1.2.2+20180113-1ubuntu1) ...
Selecting previously unselected package libid3tag0:amd64.
Preparing to unpack .../06-libid3tag0_0.15.1b-13_amd64.deb ...
Unpacking libid3tag0:amd64 (0.15.1b-13) ...
Selecting previously unselected package libmad0:amd64.
Preparing to unpack .../07-libmad0_0.15.1b-9ubuntu18.04.1_amd64.deb ...
Unpacking libmad0:amd64 (0.15.1b-9ubuntu18.04.1) ...
Selecting previously unselected package libsox3:amd64.
Preparing to unpack .../08-libsox3_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking libsox3:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Selecting previously unselected package libsox-fmt-alsa:amd64.
Preparing to unpack .../09-libsox-fmt-alsa_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking libsox-fmt-alsa:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Selecting previously unselected package libsox-fmt-ao:amd64.
Preparing to unpack .../10-libsox-fmt-ao_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking libsox-fmt-ao:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Selecting previously unselected package libsox-fmt-base:amd64.
Preparing to unpack .../11-libsox-fmt-base_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking libsox-fmt-base:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Selecting previously unselected package libsox-fmt-mp3:amd64.
Preparing to unpack .../12-libsox-fmt-mp3_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking libsox-fmt-mp3:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Selecting previously unselected package libsox-fmt-oss:amd64.
Preparing to unpack .../13-libsox-fmt-oss_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking libsox-fmt-oss:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Selecting previously unselected package libsox-fmt-pulse:amd64.
Preparing to unpack .../14-libsox-fmt-pulse_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking libsox-fmt-pulse:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Selecting previously unselected package libsox-fmt-all:amd64.
Preparing to unpack .../15-libsox-fmt-all_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking libsox-fmt-all:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Selecting previously unselected package libsox-dev:amd64.
Preparing to unpack .../16-libsox-dev_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking libsox-dev:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Selecting previously unselected package sox.
Preparing to unpack .../17-sox_14.4.2-3ubuntu0.18.04.1_amd64.deb ...
Unpacking sox (14.4.2-3ubuntu0.18.04.1) ...
Setting up libid3tag0:amd64 (0.15.1b-13) ...
Setting up libao-common (1.2.2+20180113-1ubuntu1) ...
Setting up libmagic-mgc (1:5.32-2ubuntu0.4) ...
Setting up libmagic1:amd64 (1:5.32-2ubuntu0.4) ...
Setting up libopencore-amrnb0:amd64 (0.1.3-2.1) ...
Setting up libmad0:amd64 (0.15.1b-9ubuntu18.04.1) ...
Setting up libopencore-amrwb0:amd64 (0.1.3-2.1) ...
Setting up libsox3:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Setting up libsox-fmt-mp3:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Setting up libsox-fmt-base:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Setting up libsox-fmt-pulse:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Setting up libao4:amd64 (1.2.2+20180113-1ubuntu1) ...
Setting up libsox-fmt-alsa:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Setting up libsox-fmt-oss:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Setting up libsox-fmt-ao:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Setting up sox (14.4.2-3ubuntu0.18.04.1) ...
Setting up libsox-fmt-all:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Setting up libsox-dev:amd64 (14.4.2-3ubuntu0.18.04.1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.2) ...
/sbin/ldconfig.real: /usr/local/lib/python3.7/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link

Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

Download dataset files 💾

In [ ]:
# You can select to download full dataset or 7s dataset, it will be present in `data/` folder.
# !python utility/verify_or_download_data.py

Baselines 🗃

Let's go through few of the baselines, before jumping to the problem!

🎶 Let's listen to example song added as part of starter kit.

In [ ]:
import IPython, os

print("Original mixture:")
IPython.display.Audio("data/test/Mu - Too Bright/mixture.wav")
Original mixture:
Out[ ]: