Views
No views yet
| Architecture | 3× CNN blocks → BiLSTM (2 layers, 128 hidden) → Attention → FC |
| Input | Log-mel spectrogram, 96 mels × 172 time frames (~4 s @ 22.05 kHz) |
| Output | Logits over 6 emotions |
| 6-class performance | 76.76% validation accuracy, 82.80% macro F1 |
| Inference | ~10–20 ms per sample (real-time capable) |
1git clone https://github.com/willchristophersander/SpeechEmotionCS3540
2cd SpeechEmotionCS3540
3pip install torch librosa numpy huggingface_hub noisereduce
4python scripts/huggingface/load_and_run_from_hub.py --repo-id williamsander/speech-emotion-crnn-6class --audio your_audio.wavwilliamsander/speech-emotion-crnn-6class with this model’s repo id (e.g. username/speech-emotion-crnn-6class).torch, librosa, numpy, huggingface_hub. You need the model class from the project repo (fly-app/ser/models/crnn_6class.py). Then:1from huggingface_hub import hf_hub_download
2import torch, json
3
4repo_id = "williamsander/speech-emotion-crnn-6class"
5config_path = hf_hub_download(repo_id=repo_id, filename="config.json")
6weights_path = hf_hub_download(repo_id=repo_id, filename="pytorch_model.bin")
7
8with open(config_path) as f:
9 config = json.load(f)
10
11# Use CRNN_6Class from the project repo (see link above)
12from crnn_6class import CRNN_6Class
13model = CRNN_6Class(n_mels=config["n_mels"], dropout=config["dropout"])
14state = torch.load(weights_path, map_location="cpu")
15model.load_state_dict(state.get("model_state_dict") or state.get("model_state") or state)
16model.eval()hop_length=512, n_fft=2048, normalize to [-1, 1], then pad/trim to 172 time frames. See config.json for exact parameters and the repo for a full pipeline.