Views
No views yet
| Category | Accuracy | Correct | Total |
|---|---|---|---|
| Pure Music | 100.0% | 10 | 10 |
| Pure Speech | 70.0% | 7 | 10 |
| Speech + Music | 90.0% | 9 | 10 |
| File | Music Score | Speech Score | Prediction | Result |
|---|---|---|---|---|
| music_1.wav | 1.000 | 0.000 | MUSIC | ✅ |
| music_10.wav | 0.999 | 0.001 | MUSIC | ✅ |
| music_2.wav | 0.999 | 0.001 | MUSIC | ✅ |
| music_3.wav | 0.999 | 0.001 | MUSIC | ✅ |
| music_4.wav | 1.000 | 0.000 | MUSIC | ✅ |
| music_5.wav | 0.996 | 0.004 | MUSIC | ✅ |
| music_6.wav | 1.000 | 0.000 | MUSIC | ✅ |
| music_7.wav | 0.998 | 0.002 | MUSIC | ✅ |
| music_8.wav | 1.000 | 0.000 | MUSIC | ✅ |
| music_9.wav | 1.000 | 0.000 | MUSIC | ✅ |
| File | Music Score | Speech Score | Prediction | Result |
|---|---|---|---|---|
| speech_1.wav | 0.000 | 1.000 | SPEECH | ✅ |
| speech_10.wav | 0.000 | 1.000 | SPEECH | ✅ |
| speech_2.wav | 0.000 | 1.000 | SPEECH | ✅ |
| speech_3.wav | 0.824 | 0.176 | MUSIC | ❌ |
| speech_4.wav | 0.978 | 0.022 | MUSIC | ❌ |
| speech_5.wav | 1.000 | 0.000 | MUSIC | ❌ |
| speech_6.wav | 0.038 | 0.962 | SPEECH | ✅ |
| speech_7.wav | 0.003 | 0.997 | SPEECH | ✅ |
| speech_8.wav | 0.001 | 0.999 | SPEECH | ✅ |
| speech_9.wav | 0.000 | 1.000 | SPEECH | ✅ |
| File | Music Score | Speech Score | Prediction | Result |
|---|---|---|---|---|
| speech_and_music_1.wav | 1.000 | 0.000 | MUSIC | ✅ |
| speech_and_music_10.wav | 1.000 | 0.000 | MUSIC | ✅ |
| speech_and_music_2.wav | 1.000 | 0.000 | MUSIC | ✅ |
| speech_and_music_3wav.wav | 1.000 | 0.000 | MUSIC | ✅ |
| speech_and_music_4.wav | 1.000 | 0.000 | MUSIC | ✅ |
| speech_and_music_5.wav | 1.000 | 0.000 | MUSIC | ✅ |
| speech_and_music_6.wav | 1.000 | 0.000 | MUSIC | ✅ |
| speech_and_music_7.wav | 0.353 | 0.647 | SPEECH | ❌ |
| speech_and_music_8.wav | 1.000 | 0.000 | MUSIC | ✅ |
| speech_and_music_9.wav | 1.000 | 0.000 | MUSIC | ✅ |
1from transformers import pipeline
2
3# Load the model
4classifier = pipeline(
5 "audio-classification",
6 model="AIGenLab/AST-speech-and-music-45K"
7)
8
9# Classify audio
10result = classifier("your_audio.wav")
11print(result)1from transformers import AutoModelForAudioClassification, AutoFeatureExtractor
2import torch
3import torchaudio
4
5# Load model and feature extractor
6model = AutoModelForAudioClassification.from_pretrained(
7 "AIGenLab/AST-speech-and-music-45K"
8)
9feature_extractor = AutoFeatureExtractor.from_pretrained(
10 "AIGenLab/AST-speech-and-music-45K"
11)
12
13# Load audio (16kHz required)
14audio, sr = torchaudio.load("audio.wav")
15if sr != 16000:
16 audio = torchaudio.functional.resample(audio, sr, 16000)
17
18# Process
19inputs = feature_extractor(
20 audio.squeeze().numpy(),
21 sampling_rate=16000,
22 return_tensors="pt"
23)
24
25# Predict
26with torch.no_grad():
27 outputs = model(**inputs)
28 predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
29
30music_score = predictions[0][0].item()
31speech_score = predictions[0][1].item()
32
33print(f"Music: {music_score:.3f}")
34print(f"Speech: {speech_score:.3f}")| Parameter | Value |
|---|---|
| Base Model | MIT/ast-finetuned-audioset-10-10-0.4593 |
| Dataset | AIGenLab/speech-music-45k (45000 samples) |
| Epochs | 1 |
| Batch Size | 64 |
| Learning Rate | 3e-5 |
| Loss Weight | Music: 2.5x, Speech: 1.0x |
| Optimizer | AdamW |
| Framework | Transformers + PyTorch |