All Projects → amdegroot → deepgenres.torch

amdegroot / deepgenres.torch

Licence: MIT license
Predict the genre of a song using the Torch deep learning library

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to deepgenres.torch

Python Torchfile
Deserialize Lua torch-serialized objects from Python
Stars: ✭ 196 (+988.89%)
Mutual labels:  torch
Torchdata
PyTorch dataset extended with map, cache etc. (tensorflow.data like)
Stars: ✭ 226 (+1155.56%)
Mutual labels:  torch
Artificial Intelligence Deep Learning Machine Learning Tutorials
A comprehensive list of Deep Learning / Artificial Intelligence and Machine Learning tutorials - rapidly expanding into areas of AI/Deep Learning / Machine Vision / NLP and industry specific areas such as Climate / Energy, Automotives, Retail, Pharma, Medicine, Healthcare, Policy, Ethics and more.
Stars: ✭ 2,966 (+16377.78%)
Mutual labels:  torch
Pytorch Beam Search Decoding
PyTorch implementation of beam search decoding for seq2seq models
Stars: ✭ 204 (+1033.33%)
Mutual labels:  torch
Torch
R Interface to Torch
Stars: ✭ 214 (+1088.89%)
Mutual labels:  torch
Alphaction
Spatio-Temporal Action Localization System
Stars: ✭ 221 (+1127.78%)
Mutual labels:  torch
Online Neural Doodle
Feedforward neural doodle
Stars: ✭ 183 (+916.67%)
Mutual labels:  torch
lantern
[Android Library] Handling device flash as torch for Android.
Stars: ✭ 81 (+350%)
Mutual labels:  torch
Visdial
[CVPR 2017] Torch code for Visual Dialog
Stars: ✭ 215 (+1094.44%)
Mutual labels:  torch
Pixeldtgan
A torch implementation of "Pixel-Level Domain Transfer"
Stars: ✭ 248 (+1277.78%)
Mutual labels:  torch
Netron
Visualizer for neural network, deep learning, and machine learning models
Stars: ✭ 17,193 (+95416.67%)
Mutual labels:  torch
Opennmt
Open Source Neural Machine Translation in Torch (deprecated)
Stars: ✭ 2,339 (+12894.44%)
Mutual labels:  torch
Gpt2 Newstitle
Chinese NewsTitle Generation Project by GPT2.带有超级详细注释的中文GPT2新闻标题生成项目。
Stars: ✭ 235 (+1205.56%)
Mutual labels:  torch
Torchinfo
View model summaries in PyTorch!
Stars: ✭ 203 (+1027.78%)
Mutual labels:  torch
multiclass-semantic-segmentation
Experiments with UNET/FPN models and cityscapes/kitti datasets [Pytorch]
Stars: ✭ 96 (+433.33%)
Mutual labels:  torch
Php Opencv
php wrapper for opencv
Stars: ✭ 194 (+977.78%)
Mutual labels:  torch
Echotorch
A Python toolkit for Reservoir Computing and Echo State Network experimentation based on pyTorch. EchoTorch is the only Python module available to easily create Deep Reservoir Computing models.
Stars: ✭ 231 (+1183.33%)
Mutual labels:  torch
ThArrays.jl
A Julia interface for PyTorch's C++ backend, focusing on Tensor, AD, and JIT
Stars: ✭ 23 (+27.78%)
Mutual labels:  torch
graftr
graftr: an interactive shell to view and edit PyTorch checkpoints.
Stars: ✭ 89 (+394.44%)
Mutual labels:  torch
Floorplantransformation
Raster-to-Vector: Revisiting Floorplan Transformation
Stars: ✭ 243 (+1250%)
Mutual labels:  torch

deepgenres.torch

A deep learning method for automatically labeling songs by genre using Torch. The primary reason for creating this was to become more familiar with audio deep learning.

Requirements

  • Make sure to install Torch by following the instructions on the website.
  • You also need sox. If you don't already have it, then run:
git clone git://git.code.sf.net/p/sox/code sox

Architecture

Data Collection

First, because music from SoundCloud is free, we take advantage of a pretty sweet SoundCloud song scraper called SoundScrape, which you can install with pip install soundscrape.

To give you an example of how to install songs by genre:

  1. Simply type the genre into the SoundCloud search bar online, select Playlists on the sidebar and pick a set.
  2. Navigate to one level outside this repo and open up a terminal to create a Data folder (we assume you download all sets there).
mkdir Data
cd Data
  1. Then Open up a terminal and download each set with SoundScrape:
soundscrape https://soundcloud.com/full-url-to-the-selected-genre-set
  1. You should create a separate folder containing the tracks for each genre inside the Data folder.
  2. Repeat this process for each genre of your choice and then update config.lua to support the genres you've selected.
    • Currently the config file is set up for Classical, Country, Hip-Hop, Rock, and (of course) Tropical-House.

Pre-Processing

Next, using sox, we combine the two stereo channels to mono, and convert all of our songs to spectrograms so that they can be processed by the Conv-Net in a way that is similar to normal images.

In order to make the most of the data we have, we slice-up these spectrograms to produce several small ~2 second clips that we can train on and treat as individual instances.

Full Pipeline

Usage

  • To tweak the configuration to your setup, you may have to change some of the opts inside config.lua, train.lua, or test.lua.
  • Since we only needed to train for 20 epochs to get impressive accuracy (~95%), the model is saved at each epoch by default.
  • Again, all details like this can be changed to user preference by editing the files listed above.
  • Note: To run on an Nvidia GPU, set the -backend flag to 'cudnn' rather than the default 'nn'.

Training

  • run th train.lua.
  • Note: Conversion to mono, conversion to spectrogram, and spectrogram slicing is all done by default when running th train.lua. This can be changed for subsequent runs by changing the flag -createSpectrograms to false.

Testing

  • To test the accuracy of a trained model run th test.lua.
  • This will evaluate the pre-trained model on the evaluation set that was set aside and print the accuracy for each genre as well as the overall accuracy.

Results

  • Training on Soundcloud sets containing the genres metioned above (Tropical-House etc.) we were able to achieve an overall classification accuracy of 95%.
  • Keep in mind the model is able to make these predictions from just ~2 second audio clips, so that's pretty cool!

References

All of the above images can be found on Julien Despois' really cool blog post, which can also be used as a reference for more in-depth details. This code is largely based off of his original TensorFlow implementation which can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].