Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix keyword spotting. #1689

Merged
merged 13 commits into from
Jan 20, 2025
Merged

Fix keyword spotting. #1689

merged 13 commits into from
Jan 20, 2025

Conversation

csukuangfj
Copy link
Collaborator

@csukuangfj csukuangfj commented Jan 6, 2025

See also #1417

Fixes #1417

CC @codepubs @brekov


I think there is a bug in keyword spotting.

After the keyword is detected, the result.num_trailing_blanks of subsequent calls with Decode() is always 0.

This PR resets the stream after detecting a keyword to avoid that (Users should call it manually).

Also, it resets the stream automatically after detecting 1.5 seconds of silence.

@csukuangfj
Copy link
Collaborator Author

also, fixes #1235 @carcloudfly @yuyun2000

@yuyun2000
Copy link

This is cool, we recently discovered the blank parameter issue, but haven’t confirmed it yet.

@brekov
Copy link

brekov commented Jan 6, 2025

cool! please supplement the API for JNI / Java / Kotlin. thanks.

brekov added a commit to brekov/sherpa-onnx that referenced this pull request Jan 6, 2025
@codepubs
Copy link

codepubs commented Jan 9, 2025

Windowsd demo已经解决,wasm场景还未解决问题,使用的是 https://github.com/csukuangfj/sherpa-onnx/tree/fix-kws 分支编译的,结果如下

0: {"start_time":0,"keyword":"小爱同学","timestamps":[40.96,41.32,41.6,49.32,49.36,49.52,49.56],"tokens":["x","iǎo","ài","t","óng","x","ué"]}
1: {"start_time":0,"keyword":"军哥牛逼","timestamps":[57.6,57.72,57.92,58,65,65.08,65.28,65.36],"tokens":["j","ūn","g","ē","n","iú","b","ī"]}

@csukuangfj csukuangfj merged commit 8b989a8 into k2-fsa:master Jan 20, 2025
158 of 210 checks passed
@csukuangfj csukuangfj deleted the fix-kws branch January 20, 2025 08:41
@csukuangfj
Copy link
Collaborator Author

Windowsd demo已经解决,wasm场景还未解决问题,使用的是 https://github.com/csukuangfj/sherpa-onnx/tree/fix-kws 分支编译的,结果如下

0: {"start_time":0,"keyword":"小爱同学","timestamps":[40.96,41.32,41.6,49.32,49.36,49.52,49.56],"tokens":["x","iǎo","ài","t","óng","x","ué"]}
1: {"start_time":0,"keyword":"军哥牛逼","timestamps":[57.6,57.72,57.92,58,65,65.08,65.28,65.36],"tokens":["j","ūn","g","ē","n","iú","b","ī"]}

可否帮忙再测试下? wasm 例子,应该也修复了。

@codepubs

@csukuangfj
Copy link
Collaborator Author

cool! please supplement the API for JNI / Java / Kotlin. thanks.

@brekov Done. Please re-try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

唤醒词不同部分间隔时间超过10s仍能唤醒
4 participants