TFLite MicroInterpreter() never returns on Arduino Nano BLE 33 Sense

Open
#26 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
arduino, jupyter-notebook, keras, tensorflow

Research direction

Start at the IMU_Classifier example's setup() and the shown tflite::MicroInterpreter initialization on the Arduino Nano BLE 33 Sense. Check the model, 8 KB tensor arena, and stated dependencies to determine why initialization never returns. Done means the cause is identified and the punch-classification example can complete setup without blocking.

Written by the indexing model from the issue text.

Description

I am trying out the gesture recognization example using the IMU_Classifier example for detecting a "punch" gesture.
I see that the Arduino setup() code is kind of blocked when trying to initialize a MicroInterpreter() instance as below.

// Create a static memory buffer for TFLM, the size may need to
// be adjusted based on the model you are using
constexpr int tensorArenaSize = 8 * 1024;

byte tensorArena[tensorArenaSize];

tfLiteInterpreter = new tflite::MicroInterpreter(tfLiteModel,tfLiteOpsResolver, tensorArena, tensorArenaSize, &tfLiteErrorReporter);

Could you please share if this could be due to model size or any other dependency not being met? I gave it a try by shrinking model layers to reduce the model size as below but I still see an issue. Here, I am only trying to classify the punch gesture.

`# build the model and train it
model = tf.keras.Sequential()
model.add(tf.keras.layers.Dense(16, activation='relu'))
model.add(tf.keras.layers.Dense(8, activation='relu'))
model.add(tf.keras.layers.Dense(NUM_GESTURES, activation='sigmoid')) # softmax is used, because we only expect one gesture to occur per input
model.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])
history = model.fit(inputs_train, outputs_train, epochs=600, batch_size=1, validation_data=(inputs_validate, outputs_validate))
`
Dominant language
Jupyter Notebook
Stars
269
Forks
122
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from arduino/ArduinoTensorFlowLiteTutorials

All issues in arduino/ArduinoTensorFlowLiteTutorials

Similar issues

More Embedded & IoT issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.