Use numpy for average
This commit is contained in:
parent
a586de99c6
commit
e08dc45fb9
1 changed files with 3 additions and 5 deletions
|
@ -143,8 +143,8 @@ class Prediction(threading.Thread):
|
|||
Filter so that a wakeword is only triggered once per utterance.
|
||||
|
||||
When simple moving average (of length `activation_samples`) crosses the `activation_threshold`
|
||||
then trigger Rhasspy. Only "re-arm" the wakeword when the moving average drops below
|
||||
the `deactivation_threshold`.
|
||||
for the first time, then trigger Rhasspy. Only "re-arm" the wakeword when the moving average
|
||||
drops below the `deactivation_threshold`.
|
||||
"""
|
||||
try:
|
||||
self.filters[wakeword]["samples"].append(confidence)
|
||||
|
@ -155,9 +155,7 @@ class Prediction(threading.Thread):
|
|||
),
|
||||
"active": False,
|
||||
}
|
||||
moving_average = (
|
||||
sum(self.filters[wakeword]["samples"]) / config["oww"]["activation_samples"]
|
||||
)
|
||||
moving_average = np.average(self.filters[wakeword]["samples"])
|
||||
activated = False
|
||||
if (
|
||||
not self.filters[wakeword]["active"]
|
||||
|
|
Loading…
Add table
Reference in a new issue