gender cls svm ecapa voxceleb
简介
这是一个基于 ECAPA-TDNN 架构并在 VoxCeleb 数据集上预训练的性别分类模型。它将语音识别中先进的声纹特征提取能力应用于性别判定,能够高效地从音频片段中分辨男女声。对于需要快速集成语音预处理流程的开发者来说,该模型上手难度极低,非常适合作为语音交互系统的前置过滤模块,或用于大规模音频数据集的自动化标签标注,在保证识别准确率的同时,计算开销远低于通用的大型语音模型。
核心亮点
- 基于 ECAPA-TDNN 架构,声纹特征提取精准
- 在 VoxCeleb 大规模数据集上训练,泛化能力强
- 极低推理延迟,适合实时语音预处理场景
- Apache-2.0 协议,方便商业化集成与部署
使用方法
安装依赖
# 安装 Hugging Face transformers
pip install transformers torch
SDK 使用
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("griko/gender_cls_svm_ecapa_voxceleb")
tokenizer = AutoTokenizer.from_pretrained("griko/gender_cls_svm_ecapa_voxceleb")
Hugging Face 下载
我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。
操作指引:在下载前,请先通过如下命令安装 huggingface_hub:
操作指引
pip install -U huggingface_hub
命令行下载
下载完整模型库
下载完整模型库
huggingface-cli download griko/gender_cls_svm_ecapa_voxceleb
下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download griko/gender_cls_svm_ecapa_voxceleb config.json --local-dir ./dir
SDK 下载
SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('griko/gender_cls_svm_ecapa_voxceleb')
Git 下载
请确保 lfs 已经被正确安装
Git 下载
git lfs install
git clone https://huggingface.co/griko/gender_cls_svm_ecapa_voxceleb
如果您希望跳过 lfs 大文件下载,可以使用如下命令
跳过 LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/griko/gender_cls_svm_ecapa_voxceleb
模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。
PyTorch / Transformers 使用
安装 Transformers
安装 Transformers
pip install -U transformers torch
模型加载和推理
模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('griko/gender_cls_svm_ecapa_voxceleb')
tokenizer = AutoTokenizer.from_pretrained('griko/gender_cls_svm_ecapa_voxceleb')
完整文档
来源: HuggingFace
---
language: multilingual
license: apache-2.0
datasets:
- voxceleb2
libraries:
- speechbrain
tags:
- gender-classification
- speaker-characteristics
- speaker-recognition
- audio-classification
- voice-analysis
---
Gender Classification Model
This model combines the SpeechBrain ECAPA-TDNN speaker embedding model with an SVM classifier to predict speaker gender from audio input. The model was trained and evaluated on the VoxCeleb2, Mozilla Common Voice v10.0, and TIMIT datasets
Model Details
- Input: Audio file (will be converted to 16kHz, mono, single channel)
- Output: Gender prediction ("male" or "female")
- Speaker embedding: 192-dimensional ECAPA-TDNN embedding from SpeechBrain
- Classifier: Support Vector Machine optimized through Optuna (200 trials)
- Performance:
- VoxCeleb2 test set: 98.9% accuracy, 0.9885 F1-score
- Mozilla Common Voice v10.0 English validated test set: 92.3% accuracy
- TIMIT test set: 99.6% accuracy
Training Data
The model was trained on VoxCeleb2 dataset:
- Training set: 1,691 speakers (845 females, 846 males)
- Validation set: 785 speakers (396 females, 389 males)
- Test set: 1,647 speakers (828 females, 819 males)
- No speaker overlap between sets
- Audio preprocessing:
- Converted to WAV format, single channel, 16kHz sampling rate, 256 kp/s bitrate
- Applied SileroVAD for voice activity detection, taking the first voiced segment
Installation
You can install the package directly from GitHub:
``
bash
pip install git+https://github.com/griko/voice-gender-classification.git
`
Usage
`python
from voice_gender_classification import GenderClassificationPipeline
Load the pipeline
classifier = GenderClassificationPipeline.from_pretrained(
"griko/gender_cls_svm_ecapa_voxceleb"
)
Single file prediction
result = classifier("path/to/audio.wav")
print(result) # ["female"] or ["male"]
Batch prediction
results = classifier(["audio1.wav", "audio2.wav"])
print(results) # ["female", "male", "female"]
`
Limitations
- Model was trained on celebrity voices from YouTube interviews
- Performance may vary on different audio qualities or recording conditions
- Designed for binary gender classification only
Citation
If you use this model in your research, please cite:
`bibtex
@misc{koushnir2025vanpyvoiceanalysisframework,
title={VANPY: Voice Analysis Framework},
author={Gregory Koushnir and Michael Fire and Galit Fuhrmann Alpert and Dima Kagan},
year={2025},
eprint={2502.17579},
archivePrefix={arXiv},
primaryClass={cs.SD},
url={https://arxiv.org/abs/2502.17579},
}
``