Skip to content

Custom Keyword Spotting Model Deployment Fails (3-5-18-TrainingKeywordSpotting.ipynb) #33

@tjpeter

Description

@tjpeter

I am attending the HarvardX TinyML3 class and tried to deploy a custom KWS to the Arduino Nano 33, which failed.

Steps to Reproduce

  1. Ran the Colab notebook 3-5-18-TrainingKeywordSpotting.ipynb with the following parameters:

    • Keywords: "yes,no"
    • Model architecture: MODEL_ARCHITECTURE='tiny_conv'
  2. Downloaded the quantized .tflite model and processed it using 4-5-18-KWS-FavoriteKeywords.ipynb to prepare it for deployment.

  3. Copied the micro_speech example (which works as expected with the default setup) and modified the following in micro_features_model.cpp:

    • Replaced the HEX code with the custom model’s HEX representation.
    • Updated the g_model_len value to match the length of my custom model.

Issue 1: Serial Monitor Error

The example compiled successfully, but upon deployment, the serial monitor displayed the following error message:

Requested feature_data_ size 536907080 doesn't match 1960

Troubleshooting Steps

To resolve this, I made the following changes:
Added support for Conv2D in the example’s main file:

if (micro_op_resolver.AddConv2D() != kTfLiteOk) {
    return;
}

Increased the number of operations in the resolver from 4 to 5:
static tflite::MicroMutableOpResolver<5> micro_op_resolver(error_reporter);

Issue 2: No Output on Serial Monitor

After these changes, the example compiles and deploys successfully. However, the serial monitor no longer displays any output.

Expected Behavior

The modified example should:
1. Run inference with the custom model.
2. Display results on the serial monitor as expected.

Request for Help

Can anyone provide guidance on:
1. Why the serial monitor stops displaying output after these modifications?
2. Whether additional changes are required to make the example work with the custom model?

Any help would be greatly appreciated!

Metadata

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