This repository has been archived by the owner on May 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add profile for keyword detector model
- Loading branch information
1 parent
d4358e4
commit b1583c1
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/main/java/io/spokestack/spokestack/profile/VADTriggerKeywordASR.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package io.spokestack.spokestack.profile; | ||
|
||
import io.spokestack.spokestack.PipelineProfile; | ||
import io.spokestack.spokestack.SpeechPipeline; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* A speech pipeline profile that uses voice activity detection to activate | ||
* ASR based on keyword detection. | ||
* | ||
* <p> | ||
* The keyword detector requires extra configuration, which must be | ||
* added to the pipeline build process separately from this profile: | ||
* </p> | ||
* | ||
* <ul> | ||
* <li> | ||
* <b>keyword-classes</b> (string): comma-separated ordered | ||
* list of class names for the keywords; the name corresponding to the | ||
* most likely class will be returned in the transcript field when the | ||
* recognition event is raised | ||
* </li> | ||
* <li> | ||
* <b>keyword-filter-path</b> (string): file system path to the | ||
* "filter" Tensorflow-Lite model | ||
* </li> | ||
* <li> | ||
* <b>keyword-encode-path</b> (string): file system path to the | ||
* "encode" Tensorflow-Lite model | ||
* </li> | ||
* <li> | ||
* <b>keyword-detect-path</b> (string): file system path to the | ||
* "detect" Tensorflow-Lite model | ||
* </li> | ||
* </ul> | ||
* | ||
* @see io.spokestack.spokestack.asr.KeywordRecognizer | ||
*/ | ||
public class VADTriggerKeywordASR implements PipelineProfile { | ||
@Override | ||
public SpeechPipeline.Builder apply(SpeechPipeline.Builder builder) { | ||
List<String> stages = new ArrayList<>(); | ||
stages.add("io.spokestack.spokestack.webrtc.AutomaticGainControl"); | ||
stages.add("io.spokestack.spokestack.webrtc.AcousticNoiseSuppressor"); | ||
stages.add("io.spokestack.spokestack.webrtc.VoiceActivityDetector"); | ||
stages.add("io.spokestack.spokestack.webrtc.VoiceActivityTrigger"); | ||
stages.add("io.spokestack.spokestack.ActivationTimeout"); | ||
stages.add("io.spokestack.spokestack.asr.KeywordRecognizer"); | ||
|
||
return builder | ||
.setInputClass("io.spokestack.spokestack.android.MicrophoneInput") | ||
.setStageClasses(stages); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters