#WioTerminal – Training an πŸ—£οΈ audio recognition module. Edge Impulse for Arduino step-by-step and optimizations

Hi !

2nd post, to achive a simple goal:

Use Wio Terminal microphone to recognize wake up words and open or close the Azure IoT Door πŸšͺ

So, let’s start.

Edge Impulse

As I mentioned, I’ll use Edge Impuse, to to train the voice recognition module. Based on my previous posts, I recorded 30 audio data samples, 3 seconds each, for my 3 labels

  • background
  • closedoor
  • opendoor
audio data samples 90 seconds and 30 files per label

Each Edge Impulse project is very easy to follow. For this one, I’m not going to share all the steps, I’ll mostly focus on the C++ code. However, here are some tips.

Project type: Audio.

edge impulse audio project

We can import our files here:

edge impulse audio project import existing data

These are small files, so the process is a fast one.

edge impulse audio project import existing data for background label

I repeat the upload process for the 3 labels. And, I let Edge Impulse to perform the split between train and test data.

On the Edge Impulse definition, I change the window size to 3 seconds. Note: More details on this later.

Next steps, MFCC, NN Classifier are straight forward. The last steps is where we train the DNN, and this is a good time for a coffee.

With my default values, I got a very low accuracy. So, I made some changes to my Edge Impulse

  • Increase the Audio Window to 4000 (4 seconds)
  • Increase the number of training cycles to 200
  • Keep the learning rate at 0.005
  • Enable the Data Augmentation

With these changes, my model was almost at 80% of accuracy. Good enough for my tests.

edge impulse audio project trained, accuracy at 78

Next steps is to configure the model generation for our specific processor and device. In the Eon tuner section, I choose Wio Terminal.

eon tuner for Wio Terminal

Important: this process takes a lot of time. So this is another coffee or walk away moment.

Once the EON Tuner step is complete, we need to retrain the model with the specific parameters from the EON Tuner step.

Once the model is trained, we can start the test activities.

1st one worked great for me, 98% if accuracy on a CLOSE DOOR audio sample.

close door live sampling correct

And we are ready to export our model to the specific platform for Wio Terminal: Arduino.

deploy to arduino

And we can also check the EON Tuner optimizations values.

model export including EON Tuner optimizations

This post is long enough to include the changes to make it work for the Wio Terminal. I’ll draft and post these activities in the next post.

Happy coding!

Greetings

El Bruno


References

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: