8#include "Chirale_TensorFlowLite.h"
14#include "tensorflow/lite/c/common.h"
15#include "tensorflow/lite/experimental/microfrontend/lib/frontend.h"
16#include "tensorflow/lite/experimental/microfrontend/lib/frontend_util.h"
17#include "tensorflow/lite/micro/all_ops_resolver.h"
18#include "tensorflow/lite/micro/kernels/micro_ops.h"
19#include "tensorflow/lite/micro/micro_interpreter.h"
20#include "tensorflow/lite/micro/micro_mutable_op_resolver.h"
21#include "tensorflow/lite/micro/system_setup.h"
22#include "tensorflow/lite/schema/schema_generated.h"
34class TfLiteAudioStreamBase;
35class TfLiteAbstractRecognizeCommands;
70 const unsigned char*
model =
nullptr;
136 return kCategoryCount;
152 int kCategoryCount = 0;
153 const char** labels =
nullptr;
176 float deq = (
static_cast<float>(value) -
zero_point) * scale;
180 static float clip(
float value,
float range){
182 return value > range ? range : value;
184 return -value < -range ? -range : value;
226 if (
cfg.labels ==
nullptr) {
227 LOGE(
"config.labels not defined");
325 LOGE(
"Could not find max category")
354 "The results for recognition should contain %d "
355 "elements, but there are "
356 "%d in an %d-dimensional shape",
363 LOGE(
"The results for recognition should be int8 elements, but are %d",
370 LOGE(
"Results must be in increasing time order: timestamp %d < %d",
431 LOGE(
"setup_recognizer");
545 LOGE(
"audio_samples_size=%d != kMaxAudioSampleSize=%d",
559 LOGE(
"Error generateMicroFeatures");
574 LOGE(
"Invoke failed");
589 LOGE(
"TfLiteMicroSpeechRecognizeCommands::getCommand() failed");
608 Serial.println(
"------------");
630 LOGE(
"frontendPopulateState() failed");
679 static_cast<int32_t>((25.6f * 26.0f) + 0.5f);
747 LOGE(
"invoke_status not ok");
751 LOGE(
"Output type is not kTfLiteInt8");
761 LOGD(
"generate data for channels");
838 LOGI(
"AllocateTensors");
841 LOGE(
"AllocateTensors() failed");
853 LOGE(
"Bad input tensor parameters in model");
861 LOGE(
"p_tensor_buffer is null");
883 LOGE(
"cfg.output is null");
887 int16_t sample_count = len / 2;
888 for (
int j = 0;
j < sample_count;
j++) {
934 virtual bool setModel(
const unsigned char* model) {
936 p_model = tflite::GetModel(model);
939 "Model provided is schema version %d not equal "
940 "to supported version %d.",
#define PI
Definition AudioEffectsSuite.h:27
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define TRACEI()
Definition AudioLoggerIDF.h:32
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define DEFAULT_BUFFER_SIZE
Definition avr.h:20