ONNX Model Zoo

Heehobino/nihao-zhenzhen-kws

By Heehobino · ↓ 3 · ♥ 0 · Updated 2026-02-04

What's in this repo

This page lists the files in Heehobino/nihao-zhenzhen-kws, including decoder.onnx, encoder.onnx, joiner.onnx and more.

  • 6 ONNX models (.onnx files)
  • 17 files, including 6 .onnx, 5 .txt, 2 .py, 1 .md, 1 .json
  • Last updated 2026-02-04

ONNX files

File Size Download
model/decoder.onnx — Download
model/encoder.onnx — Download
model/joiner.onnx — Download
model_int8/decoder.onnx — Download
model_int8/encoder.onnx — Download
model_int8/joiner.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

你好真真 - 中文关键词检测模型

中文唤醒词/关键词检测模型,用于检测 "你好真真" (Ni Hao Zhen Zhen) 关键词。

模型变体

提供FP32和INT8两个版本:

版本 大小 阈值 F1 FAR FRR RTF
FP32 (默认) 13MB 0.52 89.47% 5.64% 2.30% 0.0185
INT8 5MB 0.46 89.01% 5.96% 2.30% 0.0140
  • FP32: 精度更高,推荐用于服务器端
  • INT8: 体积小62%,速度快24%,推荐用于嵌入式/移动端

安装

pip install -r requirements.txt

或手动安装依赖:

pip install sherpa-onnx sounddevice soundfile numpy

快速开始

实时麦克风检测

cd examples
python realtime_detection.py

运行后对着麦克风说 "你好真真" 即可看到检测结果。

Python API

from inference import load_model

# 加载FP32模型(默认)
detector = load_model()

# 或加载INT8模型(更小更快)
detector = load_model(variant="int8")

# 检测音频文件
result = detector.detect("path/to/audio.wav")
print(f"检测到关键词: {result['detected']}")
print(f"关键词: {result['keyword']}")

流式检测

import numpy as np
from inference import load_model

detector = load_model()
stream = detector.create_stream()

# 模拟流式音频输入
chunk_size = 1600  # 100ms @ 16kHz
audio_data = np.random.randn(chunk_size).astype(np.float32)

stream.accept_waveform(16000, audio_data.tolist())
while detector._kws.is_ready(stream):
    detector._kws.decode_stream(stream)

result = detector._kws.get_result(stream)
print(result)

目录结构

nihao-zhenzhen-kws/
├── model/                    # FP32模型 (13MB)
│   ├── encoder.onnx
│   ├── decoder.onnx
│   ├── joiner.onnx
│   ├── tokens.txt
│   └── keywords.txt
├── model_int8/               # INT8模型 (5MB)
│   ├── encoder.onnx
│   ├── decoder.onnx
│   ├── joiner.onnx
│   ├── tokens.txt
│   └── keywords.txt
├── examples/
│   └── realtime_detection.py
├── config.json
├── inference.py
├── requirements.txt
└── README.md

性能指标

在406个真实人声测试样本上的评估结果(63个正样本 "你好真真",28个相似词 "你好珍珍/娟娟",315个负样本):

FP32模型

  • F1分数: 89.47%
  • 准确率: 95.07%
  • 误报率 (FAR): 5.64%
  • 漏检率 (FRR): 2.30%
  • RTF: 0.0185

INT8模型

  • F1分数: 89.01%
  • 准确率: 94.33%
  • 误报率 (FAR): 5.96%
  • 漏检率 (FRR): 2.30%
  • RTF: 0.0140

License

MIT License

致谢

Model info

audio-classification sherpa-onnx
sherpa-onnx onnx keyword-spotting wake-word speech-recognition zipformer streaming int8 quantization audio-classification zh license:mit
↓ 3 ♥ 0

Created: 2026-02-03

Updated: 2026-02-04

View on Hugging Face

Files (17)

.gitattributes
LICENSE
README.md
config.json
examples/realtime_detection.py
inference.py
model/decoder.onnx ONNX
model/encoder.onnx ONNX
model/joiner.onnx ONNX
model/keywords.txt
model/tokens.txt
model_int8/decoder.onnx ONNX
model_int8/encoder.onnx ONNX
model_int8/joiner.onnx ONNX
model_int8/keywords.txt
model_int8/tokens.txt
requirements.txt

Related models