How to use Tensorflow Lite on Seeed Studio Xiao nRF52840?

Hi everyone, I have done the model training according to the article Speech Recognition | Seeed Studio Wiki. I have 1 I2C OLED Display. Can someone help me write a program where every time I say “yes” or “no” the word will be printed on the screen?

Sure, Can You Post your code ?
GL :slight_smile:
PJ :ok_hand:

Here is my code.
I’m a newbie so I just know how to do Tensorflow lite model training
follow this link Speech Recognition | Seeed Studio Wiki ,
I don’t know how to use it. I don’t know how to execute my project. Can you help me?

#include <TensorFlowLite.h>
#include<Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
#include "tensorflow/lite/micro/micro_error_reporter.h"
#include "tensorflow/lite/micro/micro_interpreter.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "micro_features_micro_model_settings.h"
#include "micro_features_model.h"

// OLED display setup
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// TensorFlow Lite model setup
tflite::MicroErrorReporter micro_error_reporter;
const tflite::Model* model = tflite::GetModel(g_micro_model_data);
tflite::MicroInterpreter interpreter(model, micro_error_reporter);
TfLiteTensor* input = interpreter.input(0);
TfLiteTensor* output = interpreter.output(0);

void setup() {
  Serial.begin(115200);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
  display.setTextColor(SSD1306_WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println("Voice Recognition");
  display.display();
  delay(2000);
  display.clearDisplay();
}

void loop() {
  // Perform voice recognition
  // You need to replace this with your actual voice recognition code
  // Get the result and store it in the 'result' variable
  // Example: String result = performVoiceRecognition();

  String result = "yes"; // Replace with your voice recognition result

  // Display the result on the OLED screen
  display.clearDisplay();
  display.setCursor(0, 0);
  display.println(result);
  display.display();

  delay(2000); // Delay before clearing the display and processing the next loop
  display.clearDisplay();
}

TensorFlow Lite is typically used on more powerful devices like Raspberry Pi or dedicated machine learning hardware. However, you can still perform some basic machine learning tasks on the Xiao nRF52840 with TensorFlow Lite, as long as you have a small and optimized model.