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

NumHotwords() incorrect #381

Closed
NicoHood opened this issue Feb 25, 2018 · 4 comments
Closed

NumHotwords() incorrect #381

NicoHood opened this issue Feb 25, 2018 · 4 comments

Comments

@NicoHood
Copy link

NicoHood commented Feb 25, 2018

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
Copy link
Author

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

I found this note:

// CAVEAT: a personal model only contain one hotword, but an universal model
// may contain multiple hotwords. It is your responsibility to figure
// out the index of the hotword. For example, if your model string is
// "foo.pmdl,bar.umdl", where foo.pmdl contains hotword x, bar.umdl
// has two hotwords y and z, the indices of different hotwords are as
// follows:

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
Copy link

moham96 commented Mar 24, 2018

same problem here

@moham96
Copy link

moham96 commented Mar 29, 2018

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
Copy link
Collaborator

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

Closing this.

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

No branches or pull requests

3 participants