Kitt-AI / snowboy

Future versions with model training module will be maintained through a forked version here: https://github.com/seasalt-ai/snowboy
Other
3.08k stars 997 forks source link

NumHotwords() incorrect #381

Closed NicoHood closed 6 years ago

NicoHood commented 6 years ago

I try to run the Python3 demo2.py (v1.3.0). But it fails saying that I specified 3 models and 2 sensitivity levels.

python demo2.py ../../resources/alexa/alexa-avs-sample-app/alexa.umdl  ../../resources/models/jarvis.umdl
Traceback (most recent call last):
  File "demo2.py", line 30, in <module>
    detector = snowboydecoder.HotwordDetector(models, sensitivity=sensitivity)
  File "/home/arch/hackallthethings/snowboy/examples/Python3/snowboydecoder.py", line 98, in __init__
    "(%d) does not match" % (self.num_hotwords, len(sensitivity))
AssertionError: number of hotwords in decoder_model (3) and sensitivity (2) does not match

I tried to debug the issue and it seems to be caused by the call:

    def NumHotwords(self):
        return _snowboydetect.SnowboyDetect_NumHotwords(self)

Which from my understanding call the .so file, which I cannot debug because it is closed source.

If you specify more than two models the return value is still wrong:

1 -> 1 (OK)
2 -> 3 (Wrong from here)
3 -> 5
4 -> 7
...

Edit: It also happens if you create two HotwordDetector instances, so there is sadly no way to work around this issue within a single python program :( The 2nd instance will the report the error of 2 models and 1 sensitivity.

NicoHood commented 6 years ago

It seems to be only incorrect when I am loading the alexa model + any of the other umdl files.

I found this note: https://github.com/Kitt-AI/snowboy/blob/92d025ab0fbf998007c9a2925f255cce0993da40/include/snowboy-detect.h#L30-L35

Which mean the python code might be wrong or missleading. How can you detect if a model has multiple hotwords? And are those processed with different callback then or not? Maybe I have to add 3 callbacks then for 2 models? It would be nice if you can clarify this.

moham96 commented 6 years ago

same problem here

moham96 commented 6 years ago

It seems to be only incorrect when I am loading the alexa model + any of the other umdl files.

I think this problem occurs in the jarvis model and not the alexa model quoting from the readme file

resources/models/jarvis.umdl: Universal model for the hotword "Jarvis" (https://snowboy.kitt.ai/hotword/29). It has two different models for the hotword Jarvis, so you have to use two sensitivites. Set sensitivities to "0.8,0.80" and ApplyFrontend to true.

chenguoguo commented 6 years ago

Correct, it was caused by jarvis.umdl. As stated in the documentation, you have to provide two separate sensitivities for jarvis.umdl.

Closing this.