Skip to content

Error While creating and using custom wake word #50

Open
@rpatapa

Description

Hi,

I installed EfficientWord-Net in Python 3.9 environment on windows laptop.

There have been few issues during installation which got resolved as mentioned below (for your information):

======================Installation=======================================================
Installed in venv: (env_p39)
This env was created with Python 3.9 uisng the command:
conda create -n env_p39 python=3.9

To overcome the PyAudio issue when "pip install EfficientWord-Net" is issued,
PyAudio was installed using the following commands:

  • pip install pipwin
  • pipwin install pyaudio

import eff_word_net reported a tflite_runtime missing.
This got fixed when following command is issued:
python -m eff_word_net.engine

====================================================================================

After installation, the following default wakeword code worked without errors:

image

Now, I got down to create a custom wakeword 'eye_square'.

Issue1:

I was able to create the reference json file when I used --model-type first_iteration_siamese
image
The created reference json file is attached below for reference:
eye_square_ref.json

But when I was trying to use the same in the code, I run into an error saying model file missing.

`import os
from eff_word_net.streams import SimpleMicStream
from eff_word_net.engine import HotwordDetector

from eff_word_net.audio_processing import First_Iteration_Siamese, ModelRawBackend, Resnet50_Arc_loss

from eff_word_net import samples_loc

#base_model = baseModel()

mycroft_hw = HotwordDetector(
hotword="eye_square",
reference_file=os.path.join(samples_loc, "eye_square_ref.json"),
threshold=0.7,
relaxation_time=2
)

mic_stream = SimpleMicStream(
window_length_secs=1.5,
sliding_window_secs=0.75,
)

mic_stream.start_stream()

print("Say Mycroft ")
while True :
frame = mic_stream.getFrame()
result = mycroft_hw.scoreFrame(frame)
if result==None :
#no voice activity
continue
if(result["match"]):
print("Wakeword uttered",result["confidence"])`

The error I get is :

runfile('C:/Users/rpratapa/Documents/Code Base/SW/audio-similarity-main/audio_similarity/untitled0.py', wdir='C:/Users/rpratapa/Documents/Code Base/SW/audio-similarity-main/audio_similarity')
Traceback (most recent call last):

File ~\anaconda3\envs\env_p39\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)

File c:\users\rpratapa\documents\code base\sw\audio-similarity-main\audio_similarity\untitled0.py:18
mycroft_hw = HotwordDetector(

TypeError: init() missing 1 required positional argument: 'model'

Issue 2:

When I try to create the custom wakeword reference json using --model-type resnet_50_arc, i get AssertionError as captured in the screenshot below:
image

Questions:

  1. Due to the above two issues, I am not able to create custom wakeword and use it on windows laptop. I am hoping that I get some help from you on both these issues and get successful in running the custom wakeword on my windows laptop
  2. I see that the resnet_50_arc may require about ~90 MB RAM. Do you think this I will be able to run these wakewords on Raspberry Pi zero? Alternatively, can we generate customwake word using 'first_iteration_siamese' and be able to run it on the Pi Zero as this model apparently requires less RAM? Please clarify.

Thanks!!

Update:

I could resolve Issue1 with the following edits:

from eff_word_net.audio_processing import First_Iteration_Siamese, ModelRawBackend, Resnet50_Arc_loss

base_model = First_Iteration_Siamese()

print('cwd: ', os.getcwd())
mycroft_hw = HotwordDetector(
hotword="eye-square",
model = base_model,
reference_file=os.path.join(samples_loc, "eye-square_ref.json"),
threshold=0.7,
relaxation_time=2
)

Issue2 & Question2 remain to be addressed.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions