Downloads · 30 days
0
Nishchal-29/speaker-conditioned-target-kws
speaker-conditioned-target-kws is a machine learning model from Nishchal-29. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A zero-shot, speaker-aware keyword spotting system that triggers only when the enrolled speaker says the enrolled keyword.
Downloads · 30 days
0
Access
Public
Updated Jun 21, 2026
Repo size
86.1 MB
Likes
0
Public
Click a slice to open those files.
.onnx84.9 MB · 99%
From the Hugging Face model README
A zero-shot, speaker-aware keyword spotting system that triggers only when the enrolled speaker says the enrolled keyword.
Unlike conventional wake-word systems that activate when anyone speaks a trigger phrase, SC-TKWS combines biometric speaker verification and phonetic keyword verification into a single edge-deployable architecture.
The system was designed for:
All inference components are exported to ONNX and optimized for low-latency execution.
Traditional keyword spotting systems solve:
"Was the keyword spoken?"
SC-TKWS solves:
"Was the enrolled keyword spoken by the enrolled user?"
This requires jointly modeling:
while remaining computationally lightweight enough for edge deployment.
Enrollment
┌──────────────────────────────────────────┐
│ │
│ User says custom keyword 3 times │
│ │
└──────────────────────────────────────────┘
│
▼
ECAPA-TDNN Speaker Encoder
│
▼
192-D Speaker Embedding
│
▼
FiLM Generator
│
γ (gamma), β (beta)
│
▼
FiLM-Conditioned TC-ResNet
│
▼
128-D Keyword Template
│
▼
Stored Profile
During inference:
Incoming Audio
│
▼
KWS PCEN Frontend
│
▼
FiLM-TC-ResNet
│
▼
128-D Query Embedding
│
▼
Neural Comparator
│
▼
Accept / Reject
Extracts a 192-dimensional biometric representation.
Input:
Output:
e_s ∈ ℝ¹⁹²
Used only during enrollment.
Transforms the speaker embedding into modulation parameters:
γ, β = G(e_s)
Architecture:
Linear(192 → 128)
ReLU
Linear(128 → 384)
Output:
192 gamma parameters
192 beta parameters
These parameters become a biometric gate controlling the TC-ResNet feature space.
Modified TC-ResNet acoustic encoder.
Structure:
Conv Projection
│
├── Layer 1 (Speaker Independent)
├── Layer 2 (Speaker Independent)
└── Layer 3 (FiLM Conditioned)
FiLM modulation:
F' = γ ⊙ F + β
This allows the network to dynamically amplify acoustic patterns consistent with the enrolled speaker while suppressing competing voices.
Output:
128-D normalized keyword embedding
Instead of a fixed cosine threshold, SC-TKWS uses a learned comparator.
Input:
[target]
[query]
|target - query|
Architecture:
384
↓
Linear(384,32)
↓
ReLU
↓
Linear(32,1)
Output:
P(Accept)
This improves robustness against:
Parameters:
≈ 74K
Parameters:
≈ 286K
Parameters:
≈ 12K
Parameters:
≈ 372K
Excluding the ECAPA-TDNN speaker encoder.
The model was trained in four stages.
Model:
Objective:
Output:
192-D speaker embeddings
Artifacts:
ecapa_tdnn.onnx
ecapa_pcen.json
Model:
Objective:
Dataset:
Output:
128-D keyword embeddings
Artifacts:
conditioned_encoder.onnx
kws_pcen.json
Goal:
Learn speaker-aware acoustic filtering.
Training strategy:
Only:
were trainable.
Goal:
Optimize final verification accuracy.
Training signals:
Correct Speaker
Correct Word
Wrong Speaker
Correct Word
Correct Speaker
Phonetically Similar Word
Loss:
BCE Loss
+
Margin Ranking Loss
Enroll a user with three recordings of the target keyword.
python enroll.py \
accept1.wav \
accept2.wav \
accept3.wav \
Generated profile:
{
"gamma": "...",
"beta": "...",
"template": "..."
}
python inference.py \
--audio query.wav \
--profile profile.json
Output:
Probability: 0.983
Match: True
All inference modules are exported to ONNX.
Artifacts:
ecapa_tdnn.onnx
film_generator.onnx
conditioned_encoder.onnx
neural_comparator.onnx
Advantages:
speaker-conditioned-target-kws/
│
├── enroll.py
├── inference.py
├── model.py
├── requirements.txt
│
├── models/
│ ├── ecapa_tdnn.onnx
│ ├── ecapa_pcen.json
│ ├── film_generator.onnx
│ ├── conditioned_encoder.onnx
│ ├── kws_pcen.json
│ └── neural_comparator.onnx
│
└── enrolled_profile.json