Tensorflow的VGGish嵌入模型的PyTorch端口。
项目描述
Torch VGGish
A PyTorch端口VGGish1,用于音频分类模型的特征嵌入前端。权重直接从tensorflow模型迁移,因此使用torchvggish
创建的嵌入将是相同的。
快速开始
有两种选择:您可以从PyPI安装最新稳定版本,或者克隆此存储库并安装。
# optional: create virtual env
cd torchvggish && python3 -m venv .env
source activate .env/bin/activate
pip install -i https://test.pypi.org/simple/ torchvggish==0.1
# OR get the latest version
git clone git@github.com:harritaylor/torchvggish.git
pip install -r requirements.txt
用法
从example
wav文件创建嵌入的简单示例
from torchvggish import vggish, vggish_input
# Initialise model and download weights
embedding_model = vggish()
embedding_model.eval()
example = vggish_input.wavfile_to_examples("example.wav")
embeddings = embedding_model.forward(example)
1. S. Hershey et al.,《大规模音频分类的CNN架构》,在2017年国际声学、语音和信号处理会议(ICASSP)中,可获取:https://arxiv.org/abs/1609.09430,https://ai.google/research/pubs/pub45611