Deploying Teachable Machine Model to Arduino Nano BLE 33

I’m trying to use the TFLite Person Detection example project as a template and insert my own model that I’ve created using Teachable Machine. However, it’s not working as expected, and giving a “Invoke Failed()” error in the serial monitor when I run the script on my Nano 33 BLE. Can someone please take a look and tell me what I did wrong?

Here is how I approached it:

  1. Create a model with Teachable Machine
  2. Download my model as a keras file
  3. Convert from Keras model to tflite model, and then integer quantize the model using the code here: Google Colaboratory
  4. Convert from tflite to .cc using : xxd -i converted_model.tflite > model_data.cc
  5. Replace value of g_person_detect_model_data_len with new value from my model_data.cc
  6. Replace model_data with new model data from my model_data.cc
  7. Use https://netron.app/ to visualize the network and see what MicroOpsResolvers need to be included. Include as necessary.

The only two files in the project that I touch at all are person_detection.ino and person_detection_model_data.cpp. Please help me figure out why it’s not working!!!

Has anyone deployed a teachable machine model to Arduino Nano BLE 33? If so, how did you do it?!

Hi, I have successfully deployed a model to my Arduino Nano BLE 33 device by using the teachable machine. Basically, I just followed the instruction on the website. Because you mentioned your model is based on Person Detection, I guess your model was trained for vision-related application, which might be similar to mine. First, I connected my Arduino and ran the sketch(TM_Uploader) that provided by the teachable machine on the device. Second, I ran another sketch(TM_connector) on my PC. I used the IDE called Processing 3.5.4 to run the file. These two steps can make your device connected with the teachable machine, and you can start to use the camera on Arduino board to collect your data. After your training process is finished, you can download the whole model and deploy it to Arduino. Make sure you choose to download the model for the microcontroller.

Here is the reference for you.

1 Like