ben-hayes / beat-tracking-tcn

An implementation of Davies & Böck's beat-tracking temporal convolutional network
42 stars 17 forks source link

prepare custom dataset #4

Closed SutirthaChakraborty closed 3 years ago

SutirthaChakraborty commented 3 years ago

Hi, Thank you for this repo. I have few songs, and I estimated the beats using librosa ( as ground truth) how can I preprocess the data and convert it into a dataset (X and Y) for training to models? Cheers, Suti

ben-hayes commented 3 years ago

Hi @SutirthaChakraborty

You have two options:

  1. You can write a custom torch.utils.data.Dataset which returns mel spectrograms and a corresponding vector of beat activations (see the Davies & Bock paper for how they represented beats in this vector)
  2. (probably easier) You can lay out your data on disk according to the structure of the ballroom dataset and the accompanying beat annotations and then use the BallroomDataset class provided in this repo. The beat annotations are just text files with one line per beat, and two space separated values per line: the first is the beat time in seconds and the second is the beat number within the bar. Then you can just use the scripts provided to create spectrograms and train the model.

Hope that helps!

Ben