dscripka / openWakeWord

An open-source audio wake word (or phrase) detection framework with a focus on performance and simplicity.
Apache License 2.0
538 stars 46 forks source link

error in patience feature #118

Open lea-xtend-ai opened 4 months ago

lea-xtend-ai commented 4 months ago

I tried using the feature patience, but it wasn't functioning as expected. After some debugging, I believe the issue lies within the following code snippet:

    # Update scores based on thresholds or patience arguments

                        scores = np.array(self.prediction_buffer[mdl])[-patience[parent_model]:]
                        if (scores >= threshold[parent_model]).sum() < patience[parent_model]:
                            predictions[mdl] = 0.0

        # Update prediction buffer
        for mdl in predictions.keys():
            self.prediction_buffer[mdl].append(predictions[mdl])

prediction_buffer always get predictions = 0.0

dscripka commented 4 months ago

Ah, you are right! Thank you for finding this bug. Patience is an older feature that I haven't found much use for in practice, but in some applications it could be beneficial.

I will release a bug fix version soon with this functionality working.