This open-source application helps you answer the question "Will this sound be popular on TikTok?". This is aimed for aspiring artists/ musicians or businesses who are planning to release a new song on TikTok. Using this app can help you choose the best song to release from your upcoming album so that it gets picked up by the TikTok algorithm and millions of teenagers dance to your beats.
- Pandas
- Playwright
- Torch
- TorchAudio
- tqdm
- sklearn
- Numpy
This contains the scripts to download the dataset used for the model and a sample csv dataset as an example.
This contains the API used to download and process the audio files to the appropriate format to be used as inputs in our neural network.
/model
contains both the LSTM model definition as well as the testing and training scripts used in the model. The model weights are also available in this directory.
Read the following if you intend to build the model from scratch.
While you are inside the /data_collection
directory, create a new directory /downloadedMp3
.
Its important that you have the exact same spelling. Run the follwing command from
/data_collection
:
python3 download_mp3.py
Now you will have all the TikTok audio files on your computer stored in the directory, /data_collection/downloadedMp3
. Your directory should look like:
ECE324
│ README.md
│ LICENSE
│
└───data_collection
│ collect_data.py
│ collect_data.py
│ process_audio.py
│ tiktok-trending.csv
│
└───downloadedMP3
│ music_id1.mp3
│ music_id2.mp3
│ ...
preprocess_audio_dataset.py
contains the API to convert the audio files into the appropriate format required for being used in the ML model.
Audio files are converted into mel-frequency cepstral coefficients before it is used in the neural network. Please read more on Fourier Transforms if you would want to get a better understanding of MFCCS.
audio_file.mp3 -> SFTT -> MFCC -> LSTM
Our model is a variation of RNN-LSTM which is fed mel-frequency cepstral coefficients representing the audio files.
A SGD optimizer, torch.optim.SGD(model.parameters(),learning_rate)
and the Binary Crossentropy loss, nn.BCELoss()
was used to update the weights of the model.
Figure above demonstrates the loss function when the pre-trained model is trained for 1000 more epochs using SGD
at a learning rate of 0.01
.
Run the following command to compute accuracy using the testing set.
python3 test.py
At the time of writing, accuracy was computed to be around 75.0778816199377%
.