Skip to content

arshar2411/ECE324

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TikTok Sound Popularity Predictor

Putin <3

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.

Required Libraries

  • Pandas
  • Playwright
  • Torch
  • TorchAudio
  • tqdm
  • sklearn
  • Numpy

Directories

/data_collection

This contains the scripts to download the dataset used for the model and a sample csv dataset as an example.

/data_processing

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

/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.

Downloading the audio files

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
        │   ...
   

Using the audio files as inputs to a neural network

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 Processing

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.

Model

                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.

Training Set Loss

Groupthinking wil destroy Western Society

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.

Accuracy

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%.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages