particle-iot / snowflake

Particle Snowflake
Apache License 2.0
6 stars 7 forks source link

Integrate the Edge Impluse SDK #2

Closed YutingYou closed 10 months ago

YutingYou commented 10 months ago

Introduction

This PR integrates the Edge Impluse SDK and provides a voice recognition demo.

Step to test

  1. Say "sparkle" towards the microphone
  2. RGB turns green as long as sparkle is recognized correctly

Step to calibrate Edge Impulse model

Method 1

Add more samples to train the model.

  1. Click the Data acquisition tab on Edge Impulse website
  2. Provide more 1s samples with the correct label, sparcle, unknown..
  3. Click the Retrain model tab to retrain the model
  4. Click the Deployment tab to re-generate the SDK and replace the SDK in the snowflake firmware

Method 2

Performance calibration can help you to set the model parameter to make the model more strict or more lenient.

  1. Click the Performance calibration tab on Edge Impulse website
  2. Find the Select and save a config part, and select the new config
  3. Click the Deployment tab to re-generate the SDK and replace the SDK in the snowflake firmware

Method 3

Set proper threshold in the firmware.

// Indicate the recognition result
// classification,  0: "sparkle", 1: "unknown"
// FIXME: The threshold value is set to 0.5 for now.
if (result.classification[0].value > 0.5) {
    RGB.color(0, 255, 0); // green
} else {
    RGB.color(255, 255, 255); // white
}

Issues

Due to the threshold being set quite loosely, the touch button sound of the Snowflake board is mistakenly recognized as "sparkle".