personal-vad 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- personal_vad-0.1.0/LICENSE +176 -0
- personal_vad-0.1.0/PKG-INFO +478 -0
- personal_vad-0.1.0/README.md +444 -0
- personal_vad-0.1.0/personal_vad/__init__.py +64 -0
- personal_vad-0.1.0/personal_vad/configs.py +335 -0
- personal_vad-0.1.0/personal_vad/dataset.py +448 -0
- personal_vad-0.1.0/personal_vad/eval_lib.py +398 -0
- personal_vad-0.1.0/personal_vad/frontend.py +242 -0
- personal_vad-0.1.0/personal_vad/inference.py +436 -0
- personal_vad-0.1.0/personal_vad/layers.py +574 -0
- personal_vad-0.1.0/personal_vad/loss.py +334 -0
- personal_vad-0.1.0/personal_vad/model.py +542 -0
- personal_vad-0.1.0/personal_vad/online_percentile.py +121 -0
- personal_vad-0.1.0/personal_vad/tflite_export.py +284 -0
- personal_vad-0.1.0/personal_vad.egg-info/PKG-INFO +478 -0
- personal_vad-0.1.0/personal_vad.egg-info/SOURCES.txt +29 -0
- personal_vad-0.1.0/personal_vad.egg-info/dependency_links.txt +1 -0
- personal_vad-0.1.0/personal_vad.egg-info/entry_points.txt +6 -0
- personal_vad-0.1.0/personal_vad.egg-info/requires.txt +8 -0
- personal_vad-0.1.0/personal_vad.egg-info/top_level.txt +2 -0
- personal_vad-0.1.0/scripts/__init__.py +1 -0
- personal_vad-0.1.0/scripts/download_mls.py +405 -0
- personal_vad-0.1.0/scripts/evaluate.py +205 -0
- personal_vad-0.1.0/scripts/export_tflite.py +84 -0
- personal_vad-0.1.0/scripts/inference.py +117 -0
- personal_vad-0.1.0/scripts/package_and_upload_hf.py +858 -0
- personal_vad-0.1.0/scripts/prepare_dataset.py +811 -0
- personal_vad-0.1.0/scripts/run_benchmarks.py +749 -0
- personal_vad-0.1.0/scripts/train.py +337 -0
- personal_vad-0.1.0/setup.cfg +4 -0
- personal_vad-0.1.0/setup.py +52 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: personal-vad
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Personal VAD: Speaker-Conditioned Target Voice Activity Detection
|
|
5
|
+
Home-page: https://github.com/wq2012/personal_vad
|
|
6
|
+
Author: Quan Wang, Shaojin Ding, Ignacio Lopez Moreno
|
|
7
|
+
Author-email: quanw@google.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: numpy>=1.21.0
|
|
17
|
+
Requires-Dist: scipy>=1.7.0
|
|
18
|
+
Requires-Dist: scikit-learn>=1.0.0
|
|
19
|
+
Requires-Dist: matplotlib>=3.5.0
|
|
20
|
+
Requires-Dist: tensorflow>=2.11.0
|
|
21
|
+
Requires-Dist: safetensors>=0.4.0
|
|
22
|
+
Requires-Dist: huggingface_hub>=0.20.0
|
|
23
|
+
Requires-Dist: soundfile>=0.12.0
|
|
24
|
+
Dynamic: author
|
|
25
|
+
Dynamic: author-email
|
|
26
|
+
Dynamic: classifier
|
|
27
|
+
Dynamic: description
|
|
28
|
+
Dynamic: description-content-type
|
|
29
|
+
Dynamic: home-page
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
Dynamic: summary
|
|
34
|
+
|
|
35
|
+
# Personal VAD (Speaker-Conditioned Voice Activity Detection)
|
|
36
|
+
|
|
37
|
+
[](https://github.com/wq2012/personal_vad/actions/workflows/pythonapp.yml)
|
|
38
|
+
[](https://huggingface.co/spaces/wq2012/personal_vad)
|
|
39
|
+
[](https://huggingface.co/wq2012/personal-vad-v2-conformer-film-dvector-cos)
|
|
40
|
+
[](https://pypi.org/project/personal-vad/)
|
|
41
|
+
[](https://pypi.org/project/personal-vad/)
|
|
42
|
+
[](https://www.pepy.tech/projects/personal-vad)
|
|
43
|
+
|
|
44
|
+
**This is not an officially supported Google product.**
|
|
45
|
+
|
|
46
|
+
## Introduction
|
|
47
|
+
|
|
48
|
+
This repository provides a standalone, open-source Python reproduction of
|
|
49
|
+
**Personal VAD 1.0** and **Personal VAD 2.0** based on the Odyssey 2020 and
|
|
50
|
+
Interspeech 2022 papers:
|
|
51
|
+
|
|
52
|
+
> **Personal VAD: Speaker-Conditioned Voice Activity Detection**
|
|
53
|
+
> *Shaojin Ding, Quan Wang, Shuo-yiin Chang, Li Wan, Ignacio Lopez Moreno*
|
|
54
|
+
> Paper: [https://arxiv.org/pdf/1908.04284](https://arxiv.org/pdf/1908.04284) | Interactive Demo: [Hugging Face Space (`wq2012/personal_vad`)](https://huggingface.co/spaces/wq2012/personal_vad) | Blog Page: [https://google.github.io/speaker-id/publications/PersonalVAD/](https://google.github.io/speaker-id/publications/PersonalVAD/)
|
|
55
|
+
|
|
56
|
+
> **Personal VAD 2.0: Optimizing Personal Voice Activity Detection for On-Device Speech Recognition**
|
|
57
|
+
> *Shaojin Ding, Rajeev Rikhye, Qiao Liang, Yanzhang He, Quan Wang, Arun Narayanan, Tom O'Malley, Ian McGraw*
|
|
58
|
+
> Paper: [https://arxiv.org/pdf/2204.03793](https://arxiv.org/pdf/2204.03793) | Pretrained Models: [Hugging Face Hub (`wq2012`)](https://huggingface.co/wq2012)
|
|
59
|
+
|
|
60
|
+
> [!NOTE]
|
|
61
|
+
> **Open-Source Reproduction Notice**: This library is an independent
|
|
62
|
+
> open-source reproduction of the published papers above. It does **not** use
|
|
63
|
+
> the original internal codebase used in the papers, which relied on Google's
|
|
64
|
+
> proprietary software infrastructure (including internal acoustic frontends,
|
|
65
|
+
> proprietary room simulators, a proprietary 4.88M-parameter 3-layer GE2E LSTM
|
|
66
|
+
> speaker verification d-vector model trained on vendor-collected datasets,
|
|
67
|
+
> and internal streaming on-device ASR evaluation pipelines). Instead, all
|
|
68
|
+
> modules, training scripts, evaluation suites, speaker embedding extractors,
|
|
69
|
+
> and pretrained checkpoints in this repository are newly implemented from
|
|
70
|
+
> scratch using open-source [`lingvo`](https://github.com/tensorflow/lingvo),
|
|
71
|
+
> `tensorflow`, and `numpy`/`scipy`, and trained on the open-source 8-language
|
|
72
|
+
> **Multilingual LibriSpeech (MLS)** corpus (`de`, `en`, `es`, `fr`, `it`,
|
|
73
|
+
> `nl`, `pl`, `pt`).
|
|
74
|
+
|
|
75
|
+
**Personal VAD** detects frame-level voice activity of a specific **target
|
|
76
|
+
speaker** in multi-speaker and noisy acoustic environments, serving as a
|
|
77
|
+
lightweight on-device gatekeeper before downstream speech recognition (ASR).
|
|
78
|
+
Unlike standard VAD, which classifies each audio frame into two classes
|
|
79
|
+
(`Speech` vs. `Silence`), Personal VAD classifies each frame into three classes:
|
|
80
|
+
|
|
81
|
+
- **`0`: `SPEECH` (`tss`)** — Target Speaker Speech
|
|
82
|
+
- **`1`: `SILENCE` (`ns`)** — Non-Speech / Silence
|
|
83
|
+
- **`2`: `SPEECH_FROM_NON_TARGET_SPEAKER` (`ntss`)** — Non-Target Speaker Speech
|
|
84
|
+
|
|
85
|
+
<p align="center">
|
|
86
|
+
<img src="resources/pvad_conventional.png" alt="Fig. 1: Conventional Personal VAD System Overview" width="440" />
|
|
87
|
+
|
|
88
|
+
<img src="resources/speaker_verification_dvector.png" alt="Fig. 2: Utterance-level d-vector Speaker Verification System" width="440" />
|
|
89
|
+
</p>
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Architecture & Features
|
|
94
|
+
|
|
95
|
+
### 1. Personal VAD 1.0 Conditioning Architectures (`SC`, `ST`, `ET`, `SET`)
|
|
96
|
+
|
|
97
|
+
<p align="center">
|
|
98
|
+
<img src="resources/pvad1_architectures.png" alt="Four Personal VAD 1.0 Architectures: SC, ST, ET, SET" width="760" />
|
|
99
|
+
</p>
|
|
100
|
+
|
|
101
|
+
- **`SC` (Score Combination Baseline)**: Runs a standard 2-class VAD and
|
|
102
|
+
frame-level speaker verification independently, rescaling the cosine
|
|
103
|
+
similarity score via online 5th/95th histogram percentiles
|
|
104
|
+
(`OnlinePercentileValue`) to split speech probability into `tss` and `ntss`.
|
|
105
|
+
- **`ST` (Score-Conditioned Training)**: Concatenates 40-D log-Mel features and
|
|
106
|
+
frame-level speaker verification cosine similarity `[x_t, s_t]` (41-D input)
|
|
107
|
+
into a 2-layer 64-unit unidirectional LSTM.
|
|
108
|
+
- **`ET` (Embedding-Conditioned Training)**: Concatenates 40-D log-Mel features
|
|
109
|
+
and the 256-D enrolled target speaker d-vector `[x_t, e_target]` (296-D input)
|
|
110
|
+
into a 2-layer 64-unit unidirectional LSTM (`129,795` parameters, `262 KB`
|
|
111
|
+
quantized TFLite), eliminating the runtime speaker verification network.
|
|
112
|
+
- **`SET` (Score and Embedding Conditioned Training)**: Concatenates acoustic
|
|
113
|
+
features, target d-vector, and frame-level cosine score
|
|
114
|
+
`[x_t, e_target, s_t]` (297-D input).
|
|
115
|
+
- **Weighted Pairwise Loss (`WPL`)**: Prioritizes `<tss, ns>` and `<tss, ntss>`
|
|
116
|
+
decision boundaries (`weight = 1.0`) over `<ns, ntss>` (`weight = 0.1`).
|
|
117
|
+
|
|
118
|
+
<p align="center">
|
|
119
|
+
<img src="resources/wpl_weight_ablation.png" alt="Weighted Pairwise Loss Weight Ablation" width="440" />
|
|
120
|
+
</p>
|
|
121
|
+
|
|
122
|
+
### 2. Personal VAD 2.0 Conformer, FiLM Modulation & Speaker Pre-Net (`B1`, `B2`, `B0`, `E0`, `E1`, `E2`, `E3`, `E5`)
|
|
123
|
+
|
|
124
|
+
<p align="center">
|
|
125
|
+
<img src="resources/pvad2_film_prenet.png" alt="Personal VAD 2.0 FiLM and Speaker Pre-Net Conditioning" width="680" />
|
|
126
|
+
</p>
|
|
127
|
+
|
|
128
|
+
- **Stacked Log-Mel Acoustic Frontend**: Extracts 128-dimensional log-Mel
|
|
129
|
+
filterbank energies (32ms window, 10ms step), stacks 4 contiguous frames
|
|
130
|
+
(3 left-context frames + current frame = 512-D), and subsamples by a factor
|
|
131
|
+
of 3 (30ms output frame step).
|
|
132
|
+
- **Causal Streaming Conformer Backbone**: 4-layer causal Conformer
|
|
133
|
+
(`model_dim=64`, `num_heads=8`, `left_context=31`, `right_context=0`,
|
|
134
|
+
depthwise conv `kernel_size=7`, `ffn_multiplier=8`), supporting both
|
|
135
|
+
full-sequence training and stateful frame-by-frame streaming inference
|
|
136
|
+
(`stream_step`).
|
|
137
|
+
- **Advanced Speaker Conditioning**:
|
|
138
|
+
- `FILM_DVECTOR` (**Architecture E1**): Feature-wise Linear Modulation (FiLM)
|
|
139
|
+
after the Conformer backbone using affine scale and shift parameters
|
|
140
|
+
generated from the target speaker d-vector `e_target`.
|
|
141
|
+
- `FILM_COS` (**Architecture E2**): A 2-layer Conformer **Speaker Pre-Net**
|
|
142
|
+
predicts frame-level speaker embeddings `e_prenet`, computes cosine
|
|
143
|
+
similarity `s_t = cos(e_prenet, e_target)`, and modulates the main
|
|
144
|
+
Conformer output via FiLM.
|
|
145
|
+
- `FILM_DVECTOR_COS` (**Architecture E3**): Concatenates both
|
|
146
|
+
`[e_target, s_t]` and feeds the combined vector into the FiLM generator.
|
|
147
|
+
- **Unified Enrolled & Enrollment-Less Training (Algorithm 1, Architecture E5)**:
|
|
148
|
+
During training, with probability `p_0 = 0.2`, replaces `e_target` with a
|
|
149
|
+
zero vector `0` and maps `ntss` labels to `tss`, allowing a single on-device
|
|
150
|
+
model to operate as both a speaker-conditioned Personal VAD and an
|
|
151
|
+
enrollment-less Standard VAD.
|
|
152
|
+
|
|
153
|
+
### 3. Speaker Embedding (`d-vector`) Extractor Design & Transparency (`speaker_subspace.npz`)
|
|
154
|
+
|
|
155
|
+
In the original Personal VAD 1.0 and 2.0 papers, target speaker embeddings
|
|
156
|
+
(`e_target`) and frame-level verification scores (`s_t`) were extracted using
|
|
157
|
+
Google's internal 3-layer LSTM speaker verification model (`4.88M` parameters)
|
|
158
|
+
trained with Generalized End-to-End (`GE2E`) loss ([Wan et al., ICASSP 2018](https://arxiv.org/pdf/1710.10467))
|
|
159
|
+
on proprietary vendor-collected datasets across 8 languages.
|
|
160
|
+
|
|
161
|
+
Because that internal speaker verification model and its training corpora are
|
|
162
|
+
proprietary—and to keep this open-source package 100% self-contained in pure
|
|
163
|
+
TensorFlow/NumPy with zero external PyTorch/SpeechBrain/JAX runtime
|
|
164
|
+
dependencies—**we trained our own lightweight, open-set 256-D speaker embedding
|
|
165
|
+
extractor (`OpenSetSpeakerSubspace`, serialized as `speaker_subspace.npz`, ~370 KB)
|
|
166
|
+
from scratch on the 98 training speakers of the 8-language Multilingual
|
|
167
|
+
LibriSpeech (MLS) dataset**:
|
|
168
|
+
|
|
169
|
+
1. **Multi-Resolution Voiced Acoustic Summary (360-D)**:
|
|
170
|
+
- Over voiced speech frames (or over a 31-frame / ~310 ms causal sliding
|
|
171
|
+
window when computing frame-level embeddings `e_t` and cosine scores `s_t`
|
|
172
|
+
for Personal VAD 1.0 `SC`, `ST`, and `SET`), the extractor computes a
|
|
173
|
+
360-dimensional acoustic statistic vector combining 40-D log-Mel
|
|
174
|
+
`[mean, std, 10th-percentile, 90th-percentile, delta_std]` (200-D) with
|
|
175
|
+
high-resolution 80-D log-Mel `[mean, std]` (160-D).
|
|
176
|
+
2. **Regularized LDA + Orthogonal PCA Subspace Projection (256-D)**:
|
|
177
|
+
- Fitted strictly on the **98 MLS training speakers** (`922` utterances
|
|
178
|
+
across `de`, `en`, `es`, `fr`, `it`, `nl`, `pl`, `pt`), it standardizes
|
|
179
|
+
the 360-D summary vector, solves the regularized **Linear Discriminant
|
|
180
|
+
Analysis (LDA)** generalized eigenvalue problem between inter-speaker and
|
|
181
|
+
intra-speaker scatter matrices, completes the orthogonal basis to 256
|
|
182
|
+
dimensions via PCA on the residual subspace, and L2-normalizes the
|
|
183
|
+
resulting 256-D speaker embedding (`||e||_2 = 1`).
|
|
184
|
+
3. **Open-Set Unseen-Speaker Verification Accuracy**:
|
|
185
|
+
- Evaluated on the **35 held-out unseen test speakers** (`315` utterances,
|
|
186
|
+
zero speaker overlap with training), `speaker_subspace.npz` achieves an
|
|
187
|
+
open-set speaker verification **ROC-AUC of `0.9521`** (mean same-speaker
|
|
188
|
+
cosine similarity **`0.7130`** vs. different-speaker **`-0.0082`**).
|
|
189
|
+
4. **Bring-Your-Own Neural Speaker Encoder**:
|
|
190
|
+
- Both `PersonalVadModel` and `PersonalVadInferenceEngine` accept any
|
|
191
|
+
external 256-D L2-normalized speaker embedding vector directly (e.g., from
|
|
192
|
+
[`FlaxSpeaker`](https://github.com/wq2012/FlaxSpeaker) GE2E/Conformer/ECAPA-TDNN
|
|
193
|
+
models) if you wish to train or run inference with a neural speaker encoder.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Installation
|
|
198
|
+
|
|
199
|
+
Install from PyPI:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pip3 install personal-vad
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Or install from source:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
git clone https://github.com/wq2012/personal_vad.git
|
|
209
|
+
cd personal_vad
|
|
210
|
+
pip3 install -r requirements.txt
|
|
211
|
+
pip3 install -e .
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Quick Start: Pretrained Model Inference (`personal_vad.load_pretrained`)
|
|
217
|
+
|
|
218
|
+
All 13 pretrained models are hosted on Hugging Face Hub under
|
|
219
|
+
[`wq2012`](https://huggingface.co/wq2012) and can be loaded directly by repo ID
|
|
220
|
+
or local directory path:
|
|
221
|
+
|
|
222
|
+
```python
|
|
223
|
+
import personal_vad
|
|
224
|
+
|
|
225
|
+
# 1. Load a pretrained Personal VAD 2.0 model from Hugging Face Hub or local dir
|
|
226
|
+
engine = personal_vad.load_pretrained(
|
|
227
|
+
"wq2012/personal-vad-v2-conformer-film-dvector-cos"
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
# 2. Run speaker-conditioned inference on 16kHz WAV files (or NumPy arrays)
|
|
231
|
+
result = engine.infer_From_files(
|
|
232
|
+
audio_path="conversation_16k.wav",
|
|
233
|
+
enroll_path="target_speaker_enroll_16k.wav",
|
|
234
|
+
threshold=0.5,
|
|
235
|
+
output_filtered_wav="target_speaker_only.wav",
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
print("Frame timestamps (s):", result["frame_times_sec"].shape)
|
|
239
|
+
print("Frame posteriors [tss, ns, ntss]:", result["probabilities"].shape)
|
|
240
|
+
print("Target speech ratio:", result["target_mask"].mean())
|
|
241
|
+
|
|
242
|
+
# 3. Enrollment-less Standard VAD fallback (Architecture E5 with zero d-vector)
|
|
243
|
+
unified_engine = personal_vad.load_pretrained(
|
|
244
|
+
"wq2012/personal-vad-v2-conformer-unified"
|
|
245
|
+
)
|
|
246
|
+
std_vad_result = unified_engine.infer_From_files(
|
|
247
|
+
audio_path="conversation_16k.wav",
|
|
248
|
+
enroll_path=None, # Uses zero vector e_target = 0 (Algorithm 1)
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
# 4. On-device 8-bit Quantized TFLite inference
|
|
252
|
+
tflite_result = engine.infer_From_files(
|
|
253
|
+
audio_path="conversation_16k.wav",
|
|
254
|
+
enroll_path="target_speaker_enroll_16k.wav",
|
|
255
|
+
use_tflite=True,
|
|
256
|
+
quantized=True,
|
|
257
|
+
)
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Or run from the command line using `scripts/inference.py` (or `pvad-inference`):
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
python3 scripts/inference.py \
|
|
264
|
+
--model wq2012/personal-vad-v2-conformer-film-dvector-cos \
|
|
265
|
+
--audio_wav conversation_16k.wav \
|
|
266
|
+
--enroll_wav target_speaker_enroll_16k.wav \
|
|
267
|
+
--output_wav target_speaker_only.wav \
|
|
268
|
+
--output_json predictions.json
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Pretrained Models on Hugging Face Hub (`wq2012`) & Benchmark Results
|
|
274
|
+
|
|
275
|
+
### 1. Original Paper Reference Benchmarks
|
|
276
|
+
|
|
277
|
+
#### Personal VAD 1.0 Reference Results ([arXiv:1908.04284](https://arxiv.org/pdf/1908.04284), Table 1 & Table 2)
|
|
278
|
+
|
|
279
|
+
Average Precision (AP) and micro-averaged mean Average Precision (`mAP`) on
|
|
280
|
+
concatenated LibriSpeech test utterances (clean vs. multistyle training `MTR`
|
|
281
|
+
room reverberation + noise):
|
|
282
|
+
|
|
283
|
+
| Method | Loss | Without MTR `tss` | Without MTR `ns` | Without MTR `ntss` | Without MTR `mAP` | With MTR `tss` | With MTR `ns` | With MTR `ntss` | With MTR `mAP` | Parameters |
|
|
284
|
+
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
285
|
+
| **SC (baseline)** | N/A | 0.886 | 0.970 | 0.872 | 0.900 | 0.777 | 0.908 | 0.768 | 0.801 | 4.88M (SV) + 0.06M (VAD) |
|
|
286
|
+
| **ST** | CE | 0.956 | 0.968 | 0.956 | 0.957 | 0.905 | 0.885 | 0.905 | 0.901 | 4.88M (SV) + 0.06M (PVAD) |
|
|
287
|
+
| **ET** | CE | 0.932 | 0.962 | 0.946 | 0.946 | 0.878 | 0.873 | 0.890 | 0.883 | **0.13M (PVAD)** |
|
|
288
|
+
| **SET** | CE | **0.970** | 0.969 | 0.972 | **0.969** | **0.938** | 0.888 | 0.938 | **0.928** | 4.88M (SV) + 0.13M (PVAD) |
|
|
289
|
+
| **ET** | **WPL** | 0.955 | 0.965 | 0.961 | 0.959 | 0.916 | 0.883 | 0.920 | 0.912 | **0.13M (PVAD)** |
|
|
290
|
+
|
|
291
|
+
Standard VAD task evaluation on non-concatenated LibriSpeech test utterances
|
|
292
|
+
([arXiv:1908.04284](https://arxiv.org/pdf/1908.04284), Table 2):
|
|
293
|
+
|
|
294
|
+
| Method | Loss | Without MTR Speech (`s`) AP | Without MTR Non-Speech (`ns`) AP | With MTR Speech (`s`) AP | With MTR Non-Speech (`ns`) AP |
|
|
295
|
+
| :--- | :---: | :---: | :---: | :---: | :---: |
|
|
296
|
+
| **Standard VAD** | CE | 0.992 | 0.975 | 0.975 | 0.918 |
|
|
297
|
+
| **Personal VAD (ET)** | CE | 0.991 | 0.965 | 0.979 | 0.893 |
|
|
298
|
+
| **Personal VAD (ET)** | WPL | 0.991 | 0.967 | 0.979 | 0.901 |
|
|
299
|
+
|
|
300
|
+
#### Personal VAD 2.0 Reference Results ([arXiv:2204.03793](https://arxiv.org/pdf/2204.03793), Table 1 & Table 2)
|
|
301
|
+
|
|
302
|
+
Downstream streaming ASR Word Error Rate (`WER %`), model size, and FLOPs on
|
|
303
|
+
internal vendor-collected Speech Query (`Non-Concat` and `Concat`) and Voice
|
|
304
|
+
Search (`VS`) test sets:
|
|
305
|
+
|
|
306
|
+
| Exp | Model Architecture | Enrolled Non-Concat WER (%) | Enrolled Concat WER (%) | Enrollment-Less VS WER (%) | Enrollment-Less Non-Concat WER (%) | Size (MB) | FLOPs (M) |
|
|
307
|
+
| :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
308
|
+
| **B1** | LSTM Standard VAD | N/A | N/A | 7.2 | 11.5 | 1.5 | 3.41 |
|
|
309
|
+
| **B2** | Conformer Standard VAD | N/A | N/A | 6.9 | 10.1 | 0.7 | 8.77 |
|
|
310
|
+
| **B0** | Personal VAD 1.0 (3L LSTM Concat) | 17.9 | 41.0 | >= 100.0 | >= 100.0 | 5.8 | 3.54 |
|
|
311
|
+
| **E0** | + 4L Causal Conformer Concat | 15.3 | 31.5 | — | — | 2.8 | 9.51 |
|
|
312
|
+
| **E1** | + FiLM d-vector Modulation | 11.3 | 29.5 | — | — | 2.8 | 9.58 |
|
|
313
|
+
| **E2** | + Speaker Pre-Net (`cos`) FiLM | 11.7 | 27.5 | — | — | 4.0 | 9.51 |
|
|
314
|
+
| **E3** | + FiLM d-vector & Speaker Pre-Net `cos` | 11.5 | 27.6 | — | — | 4.0 | 9.58 |
|
|
315
|
+
| **E4** | + 8-bit Quantization (w/o Alg. 1) | 12.2 | 27.2 | >= 100.0 | >= 100.0 | 1.0 | 9.58 |
|
|
316
|
+
| **E5** | **Personal VAD 2.0 (w/ Alg. 1 + INT8)** | **12.4** | **32.7** | **7.0** | **10.1** | **1.0** | **9.58** |
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
### 2. Open-Source Reproduction Results on 8-Language Multilingual LibriSpeech (MLS)
|
|
321
|
+
|
|
322
|
+
All 13 open-source pretrained models were trained and evaluated on the
|
|
323
|
+
open-source 8-language **Multilingual LibriSpeech (MLS)** dataset (`de`, `en`,
|
|
324
|
+
`es`, `fr`, `it`, `nl`, `pl`, `pt`; `1,323` utterances across `142` speakers in
|
|
325
|
+
disjoint speaker splits: `98` train speakers / `315` unseen test utterances
|
|
326
|
+
across `35` unseen test speakers). As detailed in
|
|
327
|
+
[Section 3 above](#3-speaker-embedding-d-vector-extractor-design--transparency-speaker_subspacenpz),
|
|
328
|
+
rather than using the original papers' proprietary 4.88M-parameter 3-layer GE2E
|
|
329
|
+
LSTM speaker encoder, all models below use our self-contained open-set 256-D
|
|
330
|
+
regularized LDA+PCA speaker subspace extractor (`speaker_subspace.npz`) trained
|
|
331
|
+
from scratch on the 98 MLS training speakers, which achieves an unseen-speaker
|
|
332
|
+
verification **ROC-AUC of `0.9521`** (mean positive cosine similarity `0.7130`
|
|
333
|
+
vs. negative `-0.0082`).
|
|
334
|
+
|
|
335
|
+
Every model repository on Hugging Face Hub includes:
|
|
336
|
+
- `model.safetensors`: SafeTensors FP32 checkpoint
|
|
337
|
+
- `model.weights.h5`: Keras 3 weights checkpoint
|
|
338
|
+
- `model_fp32.tflite`: FP32 TensorFlow Lite FlatBuffer
|
|
339
|
+
- `model_quantized.tflite`: 8-bit dynamic-range quantized TensorFlow Lite model
|
|
340
|
+
- `model_config.json` & `speaker_subspace.npz`: Full model configuration and
|
|
341
|
+
trained 256-D open-set LDA+PCA speaker d-vector projection matrix
|
|
342
|
+
- `evaluation_metrics.json`: Full evaluation metrics with 95% non-parametric
|
|
343
|
+
bootstrap confidence intervals
|
|
344
|
+
|
|
345
|
+
#### A. Personal VAD 1.0 Open-Source Pretrained Models (MLS Concatenated Multi-Speaker Test Set)
|
|
346
|
+
|
|
347
|
+
| Hugging Face Repository | Arch | Loss | Params | INT8 `.tflite` | Concat `tss` AP | Concat `ns` AP | Concat `ntss` AP | Concat `mAP` (95% Bootstrap CI) | INT8 `.tflite` `mAP` |
|
|
348
|
+
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
349
|
+
| [`wq2012/personal-vad-v1-sc`](https://huggingface.co/wq2012/personal-vad-v1-sc) | `SC` | CE | 64,194 | 196.4 KB | **0.9435** | **0.9604** | **0.7848** | **0.9161** (`[0.9056, 0.9277]`) | **0.9090** |
|
|
350
|
+
| [`wq2012/personal-vad-v1-st-ce`](https://huggingface.co/wq2012/personal-vad-v1-st-ce) | `ST` | CE | 64,515 | 197.4 KB | 0.9394 | 0.9336 | 0.7550 | 0.8834 (`[0.8668, 0.9014]`) | 0.8804 |
|
|
351
|
+
| [`wq2012/personal-vad-v1-et-ce`](https://huggingface.co/wq2012/personal-vad-v1-et-ce) | `ET` | CE | 129,795 | 262.4 KB | 0.9362 | 0.9536 | 0.7817 | 0.8665 (`[0.8460, 0.8897]`) | 0.8609 |
|
|
352
|
+
| [`wq2012/personal-vad-v1-set-ce`](https://huggingface.co/wq2012/personal-vad-v1-set-ce) | `SET` | CE | 130,051 | 262.7 KB | 0.9385 | 0.9510 | 0.7725 | 0.8469 (`[0.8237, 0.8712]`) | 0.8521 |
|
|
353
|
+
| [`wq2012/personal-vad-v1-et-wpl`](https://huggingface.co/wq2012/personal-vad-v1-et-wpl) | `ET` | **WPL** | 129,795 | 262.4 KB | **0.9432** | 0.9433 | 0.7695 | 0.8652 (`[0.8467, 0.8853]`) | **0.8691** |
|
|
354
|
+
|
|
355
|
+
*Note on Personal VAD 1.0 Reproduction*: Consistent with Paper 1, training the
|
|
356
|
+
lightweight `ET` model (`129.8K` parameters, `262 KB` quantized TFLite, no
|
|
357
|
+
runtime speaker verification model) with **Weighted Pairwise Loss (`WPL`,
|
|
358
|
+
`w_<ns,ntss> = 0.1`)** improves target speaker speech (`tss`) Average Precision
|
|
359
|
+
from `0.9362` (`CE`) to **`0.9432`** (`WPL`) and improves quantized INT8 TFLite
|
|
360
|
+
`mAP` from `0.8609` to **`0.8691`**.
|
|
361
|
+
|
|
362
|
+
#### B. Personal VAD 2.0 Open-Source Pretrained Models (MLS Multi-Speaker & Single-Speaker Test Sets)
|
|
363
|
+
|
|
364
|
+
| Hugging Face Repository | Exp | Backbone & Conditioning | Params | INT8 `.tflite` | Non-Concat `mAP` | Concat `tss` AP | Concat `ns` AP | Concat `ntss` AP | Concat `mAP` (95% Bootstrap CI) | INT8 `.tflite` Concat `mAP` |
|
|
365
|
+
| :--- | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
366
|
+
| [`wq2012/personal-vad-v2-lstm-concat`](https://huggingface.co/wq2012/personal-vad-v2-lstm-concat) | **B0** | 3L LSTM (256d) + Input Concat | 1,775,107 | 2007.9 KB | 0.7006 | 0.7464 | 0.9378 | 0.3172 | 0.8088 (`[0.7875, 0.8308]`) | 0.8092 |
|
|
367
|
+
| [`wq2012/personal-vad-v2-conformer-concat`](https://huggingface.co/wq2012/personal-vad-v2-conformer-concat) | **E0** | 4L Conformer (64d) + Input Concat | 699,907 | 898.3 KB | 0.7408 | 0.8336 | 0.9678 | 0.5071 | 0.8502 (`[0.8323, 0.8688]`) | 0.8329 |
|
|
368
|
+
| [`wq2012/personal-vad-v2-conformer-film-dvector`](https://huggingface.co/wq2012/personal-vad-v2-conformer-film-dvector) | **E1** | 4L Conformer + FiLM `d-vector` | 716,419 | 917.0 KB | 0.9025 | 0.9370 | 0.9710 | 0.7709 | 0.9060 (`[0.8933, 0.9196]`) | 0.9009 |
|
|
369
|
+
| [`wq2012/personal-vad-v2-conformer-film-cos`](https://huggingface.co/wq2012/personal-vad-v2-conformer-film-cos) | **E2** | 4L Conformer + Speaker Pre-Net `cos` FiLM | 1,058,499 | 1364.0 KB | **0.9207** | **0.9492** | 0.9739 | **0.8172** | 0.9153 (`[0.9024, 0.9277]`) | 0.9086 |
|
|
370
|
+
| [`wq2012/personal-vad-v2-conformer-film-dvector-cos`](https://huggingface.co/wq2012/personal-vad-v2-conformer-film-dvector-cos) | **E3** | 4L Conformer + Pre-Net & `d-vector` FiLM | 1,091,267 | 1397.8 KB | 0.9158 | 0.9476 | **0.9776** | 0.8169 | **0.9222** (`[0.9106, 0.9333]`) | **0.9127** |
|
|
371
|
+
| [`wq2012/personal-vad-v2-conformer-unified`](https://huggingface.co/wq2012/personal-vad-v2-conformer-unified) | **E5** | 4L Conformer + Pre-Net & `d-vector` FiLM + Alg. 1 | 1,091,267 | 1397.8 KB | 0.8574 | 0.9250 | 0.9644 | 0.7558 | 0.9092 (`[0.8956, 0.9216]`) | 0.8939 |
|
|
372
|
+
|
|
373
|
+
*Note on Personal VAD 2.0 Ablation Trajectory*: Our open-source reproduction on
|
|
374
|
+
8-language MLS reproduces every architectural finding from Table 1 of
|
|
375
|
+
Personal VAD 2.0 ([arXiv:2204.03793](https://arxiv.org/pdf/2204.03793)):
|
|
376
|
+
1. **Conformer vs. LSTM (`B0 -> E0`)**: Replacing the 3-layer LSTM (`B0`,
|
|
377
|
+
`2007.9 KB`, Concat `mAP = 0.8088`) with the 4-layer causal Conformer (`E0`,
|
|
378
|
+
`898.3 KB`, Concat `mAP = 0.8502`) improves multi-speaker `mAP` by `+4.14`
|
|
379
|
+
points while cutting model size by more than 55%.
|
|
380
|
+
2. **FiLM & Speaker Pre-Net Modulation (`E0 -> E1 -> E2 -> E3`)**: Moving from
|
|
381
|
+
input concatenation (`E0`, `mAP = 0.8502`) to FiLM d-vector modulation
|
|
382
|
+
(`E1`, `mAP = 0.9060`), Speaker Pre-Net cosine FiLM (`E2`, `mAP = 0.9153`),
|
|
383
|
+
and combined Speaker Pre-Net + d-vector FiLM (`E3`, **`mAP = 0.9222`**,
|
|
384
|
+
`tss AP = 0.9476`) yields monotonic improvements across all classes.
|
|
385
|
+
3. **8-Bit Dynamic Range Quantization (`E4`)**: Quantizing `E3` to 8-bit
|
|
386
|
+
integer TFLite reduces model size from `4422.1 KB` to `1397.8 KB` (3.16x
|
|
387
|
+
compression) while retaining `0.9127` Concat `mAP` (`0.9444` `tss` AP).
|
|
388
|
+
|
|
389
|
+
#### C. Standard VAD Baselines & Enrollment-Less Fallback Evaluation (`e_target = 0`, Algorithm 1)
|
|
390
|
+
|
|
391
|
+
| Hugging Face Repository | Exp | Evaluation Mode | Params | INT8 `.tflite` | Speech AP | Silence (`ns`) AP | `mAP` (95% Bootstrap CI) | INT8 `.tflite` `mAP` |
|
|
392
|
+
| :--- | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
393
|
+
| [`wq2012/personal-vad-v2-lstm-std-vad`](https://huggingface.co/wq2012/personal-vad-v2-lstm-std-vad) | **B1** | Dedicated 3L LSTM Standard VAD | 1,709,314 | 1941.2 KB | 0.9965 | 0.9343 | 0.9927 (`[0.9912, 0.9942]`) | 0.9912 |
|
|
394
|
+
| [`wq2012/personal-vad-v2-conformer-std-vad`](https://huggingface.co/wq2012/personal-vad-v2-conformer-std-vad) | **B2** | Dedicated 4L Conformer Standard VAD | 683,458 | 880.1 KB | **0.9968** | **0.9726** | **0.9937** (`[0.9923, 0.9949]`) | **0.9926** |
|
|
395
|
+
| [`wq2012/personal-vad-v2-conformer-film-dvector-cos`](https://huggingface.co/wq2012/personal-vad-v2-conformer-film-dvector-cos) | **E3 / E4** | Enrollment-Less (`e_target = 0`, w/o Alg. 1) | 1,091,267 | 1397.8 KB | 0.9499 | 0.9760 | 0.8891 (`[0.8801, 0.8993]`) | 0.8884 |
|
|
396
|
+
| [`wq2012/personal-vad-v2-conformer-unified`](https://huggingface.co/wq2012/personal-vad-v2-conformer-unified) | **E5** | **Enrollment-Less (`e_target = 0`, w/ Alg. 1)** | 1,091,267 | 1397.8 KB | **0.9957** | 0.9596 | **0.9522** (`[0.9399, 0.9624]`) | **0.9384** |
|
|
397
|
+
|
|
398
|
+
*Note on Algorithm 1 (`E5` vs. `E3`)*: When no enrolled speaker is present
|
|
399
|
+
(`e_target = 0`), `E5` (trained with Algorithm 1, `p_0 = 0.20`) achieves a
|
|
400
|
+
**`0.9957` Speech AP** and **`0.9522` `mAP`** (`+6.31` points higher `mAP` and
|
|
401
|
+
`+4.58` points higher Speech AP than `E3` trained without Algorithm 1), matching
|
|
402
|
+
the dedicated Standard VAD Speech AP (`0.9968`) while using a single unified
|
|
403
|
+
model for both enrolled and enrollment-less operation.
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
## Reproducing the Full Multilingual LibriSpeech Benchmark Suite
|
|
408
|
+
|
|
409
|
+
### 1. Download 8-Language Multilingual LibriSpeech (MLS) Subset
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
python3 scripts/download_mls.py \
|
|
413
|
+
--output_dir ~/Data/multilingual_librispeech \
|
|
414
|
+
--speakers_per_lang 18 \
|
|
415
|
+
--utterances_per_speaker 10
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### 2. Train, Export & Evaluate All 13 Personal VAD 1.0 & 2.0 Models
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
python3 scripts/run_benchmarks.py \
|
|
422
|
+
--mls_dir ~/Data/multilingual_librispeech \
|
|
423
|
+
--output_dir ~/Data/pvad_MLS_Watch_models \
|
|
424
|
+
--epochs_v1 30 \
|
|
425
|
+
--epochs_v2 35
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### 3. Package Pretrained Checkpoints & Upload to Hugging Face Hub
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
python3 scripts/package_and_upload_hf.py \
|
|
432
|
+
--benchmark_dir ~/Data/pvad_MLS_Watch_models \
|
|
433
|
+
--mls_dir ~/Data/multilingual_librispeech \
|
|
434
|
+
--pretrained_dir pretrained_models \
|
|
435
|
+
--hf_space_dir hf_space \
|
|
436
|
+
--upload
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## Running Unit Tests, Linting & Type Checking
|
|
442
|
+
|
|
443
|
+
To run the full test suite locally:
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
flake8 --indent-size 2 --max-line-length 80 .
|
|
447
|
+
pytype personal_vad/
|
|
448
|
+
bash run_tests.sh
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
## Citations
|
|
454
|
+
|
|
455
|
+
If you use this library or the pretrained models in your research, please cite
|
|
456
|
+
the Personal VAD papers:
|
|
457
|
+
|
|
458
|
+
- **Personal VAD: Speaker-Conditioned Voice Activity Detection** ([arXiv:1908.04284](https://arxiv.org/pdf/1908.04284))
|
|
459
|
+
```bibtex
|
|
460
|
+
@inproceedings{ding2020personal,
|
|
461
|
+
title={Personal {VAD}: Speaker-Conditioned Voice Activity Detection},
|
|
462
|
+
author={Ding, Shaojin and Wang, Quan and Chang, Shuo-yiin and Wan, Li and Moreno, Ignacio Lopez},
|
|
463
|
+
booktitle={Proc. Odyssey The Speaker and Language Recognition Workshop},
|
|
464
|
+
pages={433--439},
|
|
465
|
+
year={2020}
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
- **Personal VAD 2.0: Optimizing Personal Voice Activity Detection for On-Device Speech Recognition** ([arXiv:2204.03793](https://arxiv.org/pdf/2204.03793))
|
|
470
|
+
```bibtex
|
|
471
|
+
@inproceedings{ding2022personal,
|
|
472
|
+
title={Personal {VAD} 2.0: Optimizing Personal Voice Activity Detection for On-Device Speech Recognition},
|
|
473
|
+
author={Ding, Shaojin and Rikhye, Rajeev and Liang, Qiao and He, Yanzhang and Wang, Quan and Narayanan, Arun and O'Malley, Tom and McGraw, Ian},
|
|
474
|
+
booktitle={Proc. Interspeech},
|
|
475
|
+
pages={3744--3748},
|
|
476
|
+
year={2022}
|
|
477
|
+
}
|
|
478
|
+
```
|