Model Card for se-resnet18-feat55-asvspoof2021
A lightweight (~413K parameters) speech anti-spoofing classifier. It labels a speech clip as bonafide (real human speech) or spoof (synthetic, voice-converted or replayed) from a vector of 55 handcrafted acoustic features, using a dense 1-D adaptation of SE-ResNet-18. Trained on ASVspoof 2021 (DF + LA + PA tracks).
⚠️ The reported metrics are in-sample. See Results before citing them.
Model Details Model Description
The model takes a 55-D standardised feature vector (MFCC statistics, spectral shape, spectral contrast, ZCR/RMS, jitter, shimmer, mean F0) computed from a 4-second, 16 kHz clip, and outputs two logits (0 = bonafide, 1 = spoof). Residual blocks use Squeeze-and-Excitation channel recalibration.
Developed by: pulkitbuilds Funded by [optional]: None (personal / academic project) Shared by [optional]: pulkitbuilds Model type: Dense SE-ResNet-18 binary classifier on tabular acoustic features (audio anti-spoofing) Language(s) (NLP): Language-agnostic in design; trained on English speech (ASVspoof 2021 / VCTK-based) License: MIT (change if you prefer another license) Finetuned from model [optional]: None, trained from scratch Model Sources [optional] Repository: https://huggingface.co/pulkitbuilds/se-resnet18-feat55-asvspoof2021 (update to your actual repo path) Paper [optional]: None. Dataset challenge: ASVspoof 2021 (see Citation) Demo [optional]: None Uses Direct Use
Research and education on speech deepfake / spoof detection: scoring a clip's spoof probability, benchmarking against other anti-spoofing baselines, and studying interpretability of handcrafted features (Gradient × Input attributions, SE channel weights, t-SNE of the 64-D latent space).
Inference requires the exact same pipeline as training: 16 kHz mono, pre-emphasis (0.97), silence trimming (top_db 40), 64,000-sample crop/pad, peak normalisation, the 55 features in the documented order, then standardisation with the training feat_mean / feat_std.
Downstream Use [optional]
Can serve as a fast, low-compute baseline or as one component in a larger voice-impersonation or fraud-screening research pipeline. The 64-D latent embedding (extract_latent) can be reused as features.
Out-of-Scope Use Authentication, fraud decisions, forensic or legal evidence, or accusing anyone of using synthetic speech. The model is not validated for these. Attacks, TTS/VC systems or recording conditions newer than or different from ASVspoof 2021. Clips that are very short, very noisy, heavily compressed, or in languages other than English without further validation. Bias, Risks, and Limitations Optimistic evaluation: training used train + dev combined and metrics were measured on the dev part (see Results). Weak on LA: 10.88% EER on the LA track versus 1.05% (DF) and 1.69% (PA). Weakest attacks: A16 (84.41%), A10 (86.85%), A12 (88.89%). Data dependence: the corpus is largely English, with a limited set of attack algorithms and 160 speakers in total; results may not transfer to other speakers, accents, devices or codecs. Class balance: the data is spoof-heavy, so the 0.7461 threshold (the EER point on dev) may not suit deployments with different priors. Feature approximation: jitter, shimmer and F0 use a batched GPU YIN tracker rather than librosa.pyin, and correlate only weakly with the pyin reference (r ≈ 0.35, −0.43, 0.45 on a small check). Misuse risk: false positives could wrongly label genuine speakers as synthetic, and false negatives could give false assurance. Recommendations
Treat outputs as one signal among several, never as sole evidence. Re-evaluate on held-out speakers and on your own target domain before any real use, and calibrate the threshold to your data.
How to Get Started with the Model python import torch, torch.nn as nn, torch.nn.functional as F
class SEBlock(nn.Module): def init(self, channels, reduction=8): super().init() self.fc = nn.Sequential( nn.Linear(channels, max(channels // reduction, 4)), nn.ReLU(), nn.Linear(max(channels // reduction, 4), channels), nn.Sigmoid()) def forward(self, x): return x * self.fc(x)
class ResBlock(nn.Module): def init(self, i, o): super().init() self.body = nn.Sequential( nn.Linear(i, o, bias=False), nn.BatchNorm1d(o), nn.ReLU(), nn.Linear(o, o, bias=False), nn.BatchNorm1d(o)) self.se = SEBlock(o) self.skip = nn.Identity() if i == o else nn.Sequential( nn.Linear(i, o, bias=False), nn.BatchNorm1d(o)) def forward(self, x): return F.relu(self.se(self.body(x)) + self.skip(x))
class SEResNet18(nn.Module): def init(self, in_features=55, num_classes=2, dropout=0.3): super().init() self.stem = nn.Sequential(nn.Linear(in_features, 64, bias=False), nn.BatchNorm1d(64), nn.ReLU()) self.layer1 = nn.Sequential(ResBlock(64, 64), ResBlock(64, 64)) self.layer2 = nn.Sequential(ResBlock(64, 128), ResBlock(128, 128)) self.layer3 = nn.Sequential(ResBlock(128, 256), ResBlock(256, 256)) self.fc_latent = nn.Linear(256, 64) self.head = nn.Sequential(nn.Dropout(dropout), self.fc_latent, nn.ReLU(), nn.Linear(64, num_classes)) def trunk(self, x): return self.layer3(self.layer2(self.layer1(self.stem(x)))) def extract_latent(self, x): return self.fc_latent(self.trunk(x)) def forward(self, x): return self.head(self.trunk(x))
model = SEResNet18() ckpt = torch.load("se_resnet_feat55_2021_best.pth", map_location="cpu", weights_only=False) model.load_state_dict(ckpt["state_dict"]) model.eval()
x: standardised features, shape (1, 55) = (features - feat_mean) / feat_std
with torch.no_grad(): p_spoof = torch.softmax(model(x), dim=1)[0, 1].item() label = "spoof" if p_spoof >= 0.7461 else "bonafide"
The feature extraction code (preprocessing and the 55 features) is in the accompanying notebook research_feat55_2021.ipynb.
Training Details Training Data
ASVspoof 2021 evaluation data from all three tracks: Logical Access (LA), Physical Access (PA) and Speech Deepfake (DF), with labels from each track's trial_metadata.txt. Because 2021 ships only evaluation data, a speaker-disjoint 75/25 split was made (120 train / 40 dev speakers, seed 42, no speaker overlap). After feature extraction: 721,686 train and 244,169 dev utterances (274,582 files were dropped for failed decoding or non-finite features). Dev split contains attacks A07–A19 plus bonafide.
Training Procedure Preprocessing [optional]
16 kHz mono, pre-emphasis (α = 0.97), silence trimming (top_db = 40), crop or wrap-pad to 64,000 samples (random crop in training mode, centre crop otherwise), peak normalisation. 55 features computed with n_fft = 1024, hop = 256 on the GPU, cached once, then standardised.
Feature groups: MFCC 1–13 mean/std (26), centroid/bandwidth/rolloff/flatness mean/std (8), spectral contrast 7 bands mean/std (14), ZCR and RMS mean/std (4), jitter, shimmer, mean F0 (3).
Training Hyperparameters Training regime: fp16 mixed precision (AMP) with GradScaler Loss: Focal loss (α = 0.75, γ = 2.0, label smoothing 0.05) Optimiser: fused AdamW, lr 5e-4 → 1e-6, weight decay 1e-4, gradient clipping 1.0 Schedule: Cosine annealing with warm restarts (T₀ = 5, T_mult = 2), 15 epochs Batch size: 512 Augmentation: feature-space Gaussian noise (σ = 0.05) and random feature masking (p = 0.05), applied to 50% of samples Seed: 42 Note: the training loop shuffled over train + dev combined (965,855 samples) Speeds, Sizes, Times [optional] Feature extraction: about 73 minutes (4,404 s) for all files Training: about 32 s per epoch, roughly 8 minutes for 15 epochs Parameters: 412,658; checkpoint size about 5 MB Evaluation Testing Data, Factors & Metrics Testing Data
The speaker-disjoint dev split of ASVspoof 2021 (244,169 utterances; 25,633 bonafide). Caveat: this split was also included in the training pool, so it is not held out.
Factors
Results are disaggregated by track (DF, LA, PA) and by attack ID (A07–A19).
Metrics
Equal Error Rate (standard anti-spoofing metric, threshold-free), ROC AUC, and accuracy / precision / recall / F1 at the EER threshold (spoof = positive class).
Results Metric Value EER 2.64 % ROC AUC 0.9975 Accuracy @ 0.7461 97.36 % Precision (spoof) 99.68 % Recall (spoof) 97.36 % F1 (spoof) 0.9851 Track Utterances EER (%) AUC DF 54,320 1.05 0.9996 PA 161,198 1.69 0.9988 LA 28,651 10.88 0.9653
Per-attack detection accuracy: A07 93.39, A08 99.56, A09 99.83, A10 86.85, A11 95.96, A12 88.89, A13 98.63, A14 99.31, A15 96.89, A16 84.41, A17 99.18, A18 97.05, A19 95.45; bonafide correctly accepted 97.37.
Summary
On the dev split the model reaches 2.64% EER and 0.9975 AUC, but because the dev data was part of the training pool these are optimistic in-sample estimates, not generalisation to unseen speakers and not comparable to official ASVspoof 2021 leaderboard results. A clean estimate needs training on the train partition only and scoring on held-out speakers.
Model Examination [optional]
Interpretability analyses in the notebook: Cohen's d per feature (class separability), Gradient × Input attribution (top-20 features driving the spoof decision), SE channel-weight distribution in the last residual block, and a t-SNE projection of the 64-D latent space coloured by attack.
Environmental Impact
Carbon emissions were not measured; they can be estimated with the Machine Learning Impact calculator presented in Lacoste et al. (2019).
Hardware Type: Single CUDA GPU (local workstation, Windows); exact model not recorded Hours used: about 1.5 hours (feature extraction plus training) Cloud Provider: None (local) Compute Region: India Carbon Emitted: Not measured Technical Specifications [optional] Model Architecture and Objective
Stem Linear(55→64)+BN+ReLU, then three stages of two SE-residual blocks (64 → 128 → 256 units), then Dropout(0.3) → Linear(256→64) → ReLU → Linear(64→2). Each block is Linear→BN→ReLU→Linear→BN, SE gating (reduction 8), a skip connection, and ReLU. Objective: focal loss for binary bonafide-vs-spoof classification.
Compute Infrastructure
Local machine with a CUDA GPU.
Hardware
Single NVIDIA CUDA GPU (data held on GPU during training), multi-core CPU with up to 4 data-loading workers.
Software
Python, PyTorch (CUDA 12.1 build), librosa, soundfile, scikit-learn, SciPy, TensorFlow (used only for the tf.data audio-loading pipeline with DLPack transfer to PyTorch).
Citation [optional]
BibTeX:
bibtex @inproceedings{yamagishi2021asvspoof, title = {ASVspoof 2021: accelerating progress in spoofed and deepfake speech detection}, author = {Yamagishi, Junichi and Wang, Xin and Todisco, Massimiliano and Sahidullah, Md and Patino, Jose and Nautsch, Andreas and Liu, Xuechen and Lee, Kong Aik and Kinnunen, Tomi and Evans, Nicholas and Delgado, H{'e}ctor}, booktitle = {ASVspoof 2021 Workshop}, year = {2021} }
(This cites the dataset/challenge; the model itself has no paper.)
APA:
Yamagishi, J., Wang, X., Todisco, M., Sahidullah, M., Patino, J., Nautsch, A., Liu, X., Lee, K. A., Kinnunen, T., Evans, N., & Delgado, H. (2021). ASVspoof 2021: Accelerating progress in spoofed and deepfake speech detection. ASVspoof 2021 Workshop.
Glossary [optional] Bonafide: genuine human speech. Spoof: synthetic, voice-converted or replayed speech. EER (Equal Error Rate): the error rate where false-accept and false-reject rates are equal; lower is better. LA / PA / DF: Logical Access (TTS/VC over telephony), Physical Access (replay attacks), Speech Deepfake (compressed deepfake media). SE (Squeeze-and-Excitation): a learned gating that re-weights channels. YIN / pyin: pitch-tracking algorithms used to estimate F0. More Information [optional]
Includes accompanying files: se_resnet_feat55_2021_best.pth (checkpoint), se_resnet_feat55_2021_history.json (per-epoch metrics), the standardisation statistics feat_mean / feat_std (required for inference), and the training notebook.
Model Card Authors [optional]
pulkitbuilds
Model Card Contact
Via the Hugging Face profile or GitHub: pulkitbuilds