silero-vad README

The project's README from github.com/snakers4/silero-vad. As one markdown file: README.md.

Mailing list : test Mailing list : test License: CC BY-NC 4.0 downloads

Open In Colab Test Package Pypi version Python version

header


Silero VAD


Silero VAD - pre-trained enterprise-grade Voice Activity Detector (also see our STT models).


Real Time Example

https://user-images.githubusercontent.com/36505480/144874384-95f80f6d-a4f1-42cc-9be7-004c891dd481.mp4

Please note, that video loads only if you are logged in your GitHub account.


Fast start


Dependencies

System requirements to run python examples on x86-64 systems:

  • python 3.8+;
  • 1G+ RAM;
  • A modern CPU with AVX, AVX2, AVX-512 or AMX instruction sets.

Dependencies:

  • torch>=1.12.0;
  • torchaudio>=0.12.0 (for I/O only);
  • onnxruntime>=1.16.1 (for ONNX model usage).

Silero VAD uses torchaudio library for audio I/O (torchaudio.info, torchaudio.load, and torchaudio.save), so a proper audio backend is required:

  • Option №1 - FFmpeg backend. conda install -c conda-forge 'ffmpeg<7';
  • Option №2 - sox_io backend. apt-get install sox, TorchAudio is tested on libsox 14.4.2;
  • Option №3 - soundfile backend. pip install soundfile.

If you are planning to run the VAD using solely the onnx-runtime, it will run on any other system architectures where onnx-runtume is supported. In this case please note that:

  • You will have to implement the I/O;
  • You will have to adapt the existing wrappers / examples / post-processing for your use-case.

Using pip: pip install silero-vad

from silero_vad import load_silero_vad, read_audio, get_speech_timestamps
model = load_silero_vad()
wav = read_audio('path_to_audio_file')
speech_timestamps = get_speech_timestamps(
  wav,
  model,
  return_seconds=True,  # Return speech timestamps in seconds (default is samples)
)

Using torch.hub:

import torch
torch.set_num_threads(1)

model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad', model='silero_vad')
(get_speech_timestamps, _, read_audio, _, _) = utils

wav = read_audio('path_to_audio_file')
speech_timestamps = get_speech_timestamps(
  wav,
  model,
  return_seconds=True,  # Return speech timestamps in seconds (default is samples)
)

Key Features



Typical Use Cases



Links



Get In Touch


Try our models, create an issue, start a discussion, join our telegram chat, email us, read our news.

Please see our wiki for relevant information and email us directly.

Citations

@misc{Silero VAD,
  author = {Silero Team},
  title = {Silero VAD: pre-trained enterprise-grade Voice Activity Detector (VAD), Number Detector and Language Classifier},
  year = {2024},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/snakers4/silero-vad}},
  commit = {insert_some_commit_here},
  email = {[email protected]}
}

Examples and VAD-based Community Apps


silero-vad (snakers4/silero-vad)

Searching Database…

这是什么东西?Silero VAD 是一个预训练的、达到企业级水准的语音活动检测(VAD)模型:一个紧凑的小模型,能告诉你音频流里哪些片段包含人说话的声音。
它是一个能直接运行的应用,还是一个需要我自己接入代码的模型?它是一个带 Python 封装的模型,不是面向最终用户的应用——没有图形界面。你需要在自己的代码里调用它,把音频片段喂进去,它会返回这段音频里有没有人说话的判断。
我怎么把它装到我的项目里?用 'pip install silero-vad' 安装 Python 包,或者通过 torch.hub 加载模型,然后对你的音频运行它即可。
它还需要同时安装哪些东西?需要 Python 3.8+,以及 torch>=1.12.0 和 torchaudio>=0.12.0 用于音频输入输出(还需要像 FFmpeg 这样的后端);只有在使用 ONNX 模型时才需要额外安装 onnxruntime>=1.16.1。
它在任何机器上都能跑吗,还是对硬件有要求?在 x86-64 上,它需要支持 AVX、AVX2、AVX-512 或 AMX 指令集的新式 CPU,外加 1 GB 以上的内存——不带 AVX 的非常老的 CPU 是跑不了的。
大家一般用它来做什么?常见用途包括:IoT/边缘设备/移动端的语音活动检测、数据清洗和通用语音检测、电话和呼叫中心自动化、语音机器人和语音交互界面。
能在 Python 之外用吗,比如从 C++、Rust 调用,或者在浏览器里用?可以——除了 Python,它还提供 ONNX 版本,社区里有 C++、Rust、Go、Java 和 C# 的示例,也可以通过 ONNX Runtime Web 在浏览器里使用。凡是 PyTorch 或 ONNX 运行时能跑的地方,它都能跑。
如果把它做进产品里发布,许可协议上有什么坑吗?没有——它采用 MIT 许可证,完全没有附加条件:没有遥测、不需要密钥、不用注册、没有内置有效期、也不存在厂商锁定。
模型本身有多大?非常小——JIT 模型大约只有两兆字节,这也是它能用在边缘设备和移动端的原因之一。
它支持哪些采样率?两种:8000 Hz 和 16000 Hz,所以音频必须先重采样到其中一种采样率,才能进行检测。
它能把我说的内容转成文字吗?不能,它只检测有没有人说话,不识别具体内容。要转写文字的话,你需要另外搭配一个 STT(语音转文字)模型——同一个团队也发布了这类模型。
Creator
snakers4
Size
120.5 MB
Stars
10.5K
Age
5y
Commits · 90 Days