Skip to content

Using pre trained audio classification models available with this library

Jyotika Singh edited this page May 11, 2022 · 5 revisions

Classifying with Pre-trained Models

There are three models that have been pre-trained and provided in this project under the /models directory. They are as follows.

music genre: Contains SVM classifier to classify audio into 10 music genres - blues, classical, country, disco, hiphop, jazz, metal, pop, reggae, rock. This classifier was trained using mfcc, gfcc, spectral and chroma features. In order to classify your audio files using this classifier, please follow the audio files structuring guidelines. The following commands in Python can be used to classify your data.

musicVSspeech: Contains SVM classifier that classifying audio into two possible classes - music and speech. This classifier was trained using mfcc, spectral and chroma features.

musicVSspeechVSbirds: Contains SVM classifier that classifying audio into three possible classes - music, speech and birds. This classifier was trained using mfcc, spectral and chroma features.

In order to classify your audio files using any of these classifier, please follow the audio files structuring guidelines. The following commands in Python can be used to classify your data.

from pyAudioProcessing.run_classification import classify_ms, classify_msb, classify_genre

# musicVSspeech classification
results_music_speech = classify_ms("../data")

# musicVSspeechVSbirds classification
results_music_speech_birds = classify_msb("../data")

# music genre classification
results_music_genre = classify_genre("../data")

Sample results look like

{'../data/music': {'beatles.wav': {'probabilities': [0.8899067858599712, 0.011922234412695229, 0.0981709797273336], 'classes': ['music', 'speech', 'birds']}, ...}