duclvQ's picture
Add inference package
bddc68f verified
|
Raw
History Blame Contribute Delete
918 Bytes
metadata
license: mit
library_name: pytorch
tags:
  - audio-classification
  - speech
  - music
  - pytorch
pipeline_tag: audio-classification

SMAD Audio Classifier

Classifies audio into four labels:

id label meaning
0 speech_noise spoken voice over non-music noise
1 speech_music spoken voice over a music bed
2 singing_music sung voice over music
3 none no human voice: instrumental music, noise, or silence

Install

pip install torch librosa soundfile numpy

Use

from predict_crnn import SmadClassifier

clf = SmadClassifier()
result = clf.predict("audio.mp3")

print(result["overall"])
print(result["share"])

CLI:

python predict_crnn.py audio.mp3 --json

Each 4-second window includes a label, confidence, and per-class probabilities. The overall label is the class covering the most windows in the file.