Views
No views yet
Improved version available: caa-speech-detection-asvspoof2019/wav2vec2-v2-unfrozen — wav2vec2_v2 (top-4 transformer blocks unfrozen) achieves 1.55% eval EER (vs 7.53% here) and 0.3966 tandem min t-DCF.
facebook/wav2vec2-base with a frozen encoder and a lightweight classification head, trained on the ASVspoof 2019 Logical Access scenario.| Property | Value |
|---|---|
| Base model | facebook/wav2vec2-base |
| Encoder | Frozen during training |
| Classification head | Linear(768→256) → GELU → Dropout(0.1) → Linear(256→2) |
| Input | Raw waveform, 16 kHz, padded/truncated to 64 000 samples (4 s) |
| Parameters | ~95 M total (~300 k trainable head only) |
| Checkpoint size | 362 MB (best.pt) |
| Local version tag | wav2vec2 |
mask_time_prob, mask_feature_prob) is disabled at load time, following Tak et al. (2022) who showed masking hurts countermeasure performance.| Split | Utterances | Attacks |
|---|---|---|
| Train | ~25 000 | A01–A06 (known) |
| Dev | ~25 000 | A01–A06 (known) |
| Eval | ~71 000 | A07–A19 (unseen) |
[8.837, 1.0] for bonafide/spoof) compensates for the ~8.84:1 spoof-heavy imbalance in the training split.| Split | EER | tandem min t-DCF | In-the-Wild EER |
|---|---|---|---|
| Dev (baseline → improved) | 4.199% → 0.197% | — | — |
| Eval | 7.53% | 0.9994 | 27.68% |
| Eval (improved: wav2vec2_v2) | 1.55% | 0.3966 | 27.68% |
lcnn_v7_cqt achieves 3.26% eval EER with a t-DCF of 0.4930, making it the recommended model for applications that weight calibration alongside raw detection rate. The improved wav2vec2_v2 achieves the best eval EER (1.55%) and the best t-DCF (0.3966) across all models.huggingface-cli download caa-speech-detection-asvspoof2019/wav2vec21import torch
2from src.models.wav2vec2.model import Wav2Vec2Model
3
4config = {
5 "pretrained_model": "facebook/wav2vec2-base",
6 "hidden_dim": 256,
7 "dropout": 0.1,
8 "freeze_encoder": True,
9}
10
11model = Wav2Vec2Model(config)
12state = torch.load("best.pt", map_location="cpu")
13model.load_state_dict(state)
14model.eval()1from transformers import Wav2Vec2FeatureExtractor
2from src.data.audio import load_audio, pad_or_trim
3import torch
4
5extractor = Wav2Vec2FeatureExtractor.from_pretrained("facebook/wav2vec2-base")
6waveform = load_audio("audio.flac", target_sr=16000)
7waveform = pad_or_trim(waveform, 64000)
8
9inputs = extractor(waveform, sampling_rate=16000, return_tensors="pt")
10frames = inputs.input_values.float()
11
12with torch.no_grad():
13 logits = model({"frames": frames})["logits"]
14 pred = logits.argmax(dim=-1).item()
15 # 0 = bonafide, 1 = spooflcnn_v4_cqt (3.5 MB, 3.03% eval EER) is recommended.1@inproceedings{wang2020asvspoof,
2 title = {{ASVspoof} 2019: A Large-Scale Public Database of Synthesized,
3 Converted and Replayed Speech},
4 author = {Wang, Xin and Yamagishi, Junichi and Todisco, Massimiliano and
5 Delgado, H{\'e}ctor and Nautsch, Andreas and Evans, Nicholas and
6 Shim, Md Sahidullah Hector and Kinnunen, Tomi and Lee, Kong Aik and
7 Patino, Jose and others},
8 booktitle = {Computer Speech \& Language},
9 volume = {64},
10 year = {2021},
11}1@inproceedings{baevski2020wav2vec,
2 title = {wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations},
3 author = {Baevski, Alexei and Zhou, Henry and Mohamed, Abdelrahman and Auli, Michael},
4 booktitle = {Advances in Neural Information Processing Systems (NeurIPS)},
5 year = {2020},
6}