fassabilf's picture
Upload folder using huggingface_hub
6a382ea verified
|
Raw
History Blame Contribute Delete
4.65 kB

LinguaWave — Competition Writeup

Task: Language Identification — 8-class audio classification
Metric: Macro F1-score
Dataset: 8,000 train samples, 4,000 test samples (1,000 / 500 per language)
Source: Google FLEURS (CC BY 4.0)
Languages: Indonesian (id), Malay (ms), Vietnamese (vi), Thai (th), English (en), Chinese (zh), Arabic (ar), French (fr)


Approach Progression

# Approach Val Macro F1 Description
1 MFCC + SVM 0.9775 40-dim MFCC mean+std → SVM RBF, C=10
2 Pitch + LightGBM 0.9594 ~80-dim acoustic + prosody → LGBM
3 Bag of Codewords 0.6290 k-means codebook (k=64) + histogram → LogReg
4 CNN on Log-Mel 0.8960 128×625 log-mel → 4-block CNN, BATCH=64, 5 epochs
5 Multi-Scale CNN 0.9682 3-branch CNN (n_fft=512/1024/2048) + hard-neg mining on id/ms, precomputed mel cache

Key Takeaways

  • Language ID is surprisingly easy with MFCCs: at 0.9775, approach 1 already nears the ceiling. The 8 languages span distinct phoneme inventories, rhythm, and prosody, making them linearly separable in MFCC space.
  • More features ≠ better (approach 2 < 1): adding pitch and prosody (F0, jitter, shimmer, HNR) slightly hurts because these features are noisier over 10-second clips with variable speech content. The MFCC SVM is more robust.
  • Codebook approach underperforms (0.63): bag-of-codewords with k=64 compresses too aggressively. Language ID benefits from temporal dynamics (captured by delta-MFCC in approach 1) that flat histograms discard.
  • Hard negative mining for id/ms: Indonesian and Malay share ~60% vocabulary and acoustic similarity. The multi-scale CNN addresses this by oversampling these pairs during training (2× factor).
  • Multi-scale spectrograms: using n_fft=512/1024/2048 captures short-term phonemes (512), syllable-level rhythm (1024), and prosodic contours (2048) simultaneously. However, the multi-branch architecture converges unstably (F1 oscillating 0.30–0.78) — a lower learning rate and warm-up schedule are recommended.

Dataset Details

  • All clips from FLEURS dataset, filtered to 3–12 seconds duration
  • Padded/trimmed to exactly 10 seconds (160,000 samples at 16 kHz)
  • Stratified 80/20 split: 1,000 train / 500 test per language
  • Class balance is exact — macro F1 = accuracy in this case

Tips for Participants

  1. Approach 1 sets a very high bar: if your CNN underperforms the MFCC SVM (0.9775), your model is not learning — check preprocessing and batch size.
  2. Memory-aware mel computation: the mel shape is (1, 128, 625) at 16 kHz / 10s. With BATCH=64 this is ~64 MB/batch — safe on Colab T4. Do NOT use batch >128 without checking memory.
  3. id vs ms is the hard pair: confusion between Indonesian and Malay is the main error source. Consider adding language pair augmentation or a dedicated hard-negative loss.
  4. Cache your mel spectrograms: approach 5 precomputes all mels to numpy arrays before training. This cuts training time from 27 hours (on-the-fly) to ~30 minutes.
  5. LabelEncoder order matters: ensure consistent label encoding between train/val/test splits. Always fit the encoder on training data only.
  6. For approach 3 improvement: try k=256 codebook, Fisher vectors instead of BoW histograms, and SVM classifier — this should recover 10–15 points vs. k=64 + LogReg.

Hardest Language Pairs (id/ms)

Indonesian and Malay are the most commonly confused pair. Strategies that help:

  • Train on more diverse speakers per language
  • Use character n-gram language models on ASR transcripts
  • Temporal pooling over the full 10-second clip rather than just mean/std

Reproducibility

All scripts use SEED = 42. Feature extraction caches are keyed by script number (e.g., lw_01_train.npy). The CNN uses torch.manual_seed(42). joblib parallel feature extraction is thread-based (prefer="threads") for librosa compatibility.


Baseline Comparison

Method Val Macro F1 Notes
Majority class 0.125 8 balanced classes
Approach 3 (BoW k=64) 0.6290 Histogram loses temporal dynamics
Approach 4 (CNN Log-Mel) 0.8960 5 epochs; converged well at epoch 5
Approach 5 (MultiScale CNN) 0.9682 Best epoch 5; precomputed mel cache
Approach 2 (Pitch LGBM) 0.9594 Prosody features + gradient boosting
Approach 1 (MFCC SVM) 0.9775 Best overall — classical ML wins here
Human (expert) ~0.98 Native speakers, clean recordings