ESPHome  2024.10.2
Public Member Functions | Protected Attributes
esphome::micro_wake_word::StreamingModel Class Referenceabstract

#include <streaming_model.h>

Inheritance diagram for esphome::micro_wake_word::StreamingModel:
esphome::micro_wake_word::VADModel esphome::micro_wake_word::WakeWordModel

Public Member Functions

virtual void log_model_config ()=0
 
virtual bool determine_detected ()=0
 
bool perform_streaming_inference (const int8_t features[PREPROCESSOR_FEATURE_SIZE])
 
void reset_probabilities ()
 Sets all recent_streaming_probabilities to 0. More...
 
bool load_model (tflite::MicroMutableOpResolver< 20 > &op_resolver)
 Allocates tensor and variable arenas and sets up the model interpreter. More...
 
void unload_model ()
 Destroys the TFLite interpreter and frees the tensor and variable arenas' memory. More...
 

Protected Attributes

uint8_t current_stride_step_ {0}
 
float probability_cutoff_
 
size_t sliding_window_size_
 
size_t last_n_index_ {0}
 
size_t tensor_arena_size_
 
std::vector< uint8_t > recent_streaming_probabilities_
 
const uint8_t * model_start_
 
uint8_t * tensor_arena_ {nullptr}
 
uint8_t * var_arena_ {nullptr}
 
std::unique_ptr< tflite::MicroInterpreter > interpreter_
 
tflite::MicroResourceVariables * mrv_ {nullptr}
 
tflite::MicroAllocator * ma_ {nullptr}
 

Detailed Description

Definition at line 16 of file streaming_model.h.

Member Function Documentation

◆ determine_detected()

virtual bool esphome::micro_wake_word::StreamingModel::determine_detected ( )
pure virtual

◆ load_model()

bool esphome::micro_wake_word::StreamingModel::load_model ( tflite::MicroMutableOpResolver< 20 > &  op_resolver)

Allocates tensor and variable arenas and sets up the model interpreter.

Parameters
op_resolverMicroMutableOpResolver object that must exist until the model is unloaded
Returns
True if successful, false otherwise

Definition at line 26 of file streaming_model.cpp.

◆ log_model_config()

virtual void esphome::micro_wake_word::StreamingModel::log_model_config ( )
pure virtual

◆ perform_streaming_inference()

bool esphome::micro_wake_word::StreamingModel::perform_streaming_inference ( const int8_t  features[PREPROCESSOR_FEATURE_SIZE])

Definition at line 101 of file streaming_model.cpp.

◆ reset_probabilities()

void esphome::micro_wake_word::StreamingModel::reset_probabilities ( )

Sets all recent_streaming_probabilities to 0.

Definition at line 134 of file streaming_model.cpp.

◆ unload_model()

void esphome::micro_wake_word::StreamingModel::unload_model ( )

Destroys the TFLite interpreter and frees the tensor and variable arenas' memory.

Definition at line 90 of file streaming_model.cpp.

Field Documentation

◆ current_stride_step_

uint8_t esphome::micro_wake_word::StreamingModel::current_stride_step_ {0}
protected

Definition at line 35 of file streaming_model.h.

◆ interpreter_

std::unique_ptr<tflite::MicroInterpreter> esphome::micro_wake_word::StreamingModel::interpreter_
protected

Definition at line 46 of file streaming_model.h.

◆ last_n_index_

size_t esphome::micro_wake_word::StreamingModel::last_n_index_ {0}
protected

Definition at line 39 of file streaming_model.h.

◆ ma_

tflite::MicroAllocator* esphome::micro_wake_word::StreamingModel::ma_ {nullptr}
protected

Definition at line 48 of file streaming_model.h.

◆ model_start_

const uint8_t* esphome::micro_wake_word::StreamingModel::model_start_
protected

Definition at line 43 of file streaming_model.h.

◆ mrv_

tflite::MicroResourceVariables* esphome::micro_wake_word::StreamingModel::mrv_ {nullptr}
protected

Definition at line 47 of file streaming_model.h.

◆ probability_cutoff_

float esphome::micro_wake_word::StreamingModel::probability_cutoff_
protected

Definition at line 37 of file streaming_model.h.

◆ recent_streaming_probabilities_

std::vector<uint8_t> esphome::micro_wake_word::StreamingModel::recent_streaming_probabilities_
protected

Definition at line 41 of file streaming_model.h.

◆ sliding_window_size_

size_t esphome::micro_wake_word::StreamingModel::sliding_window_size_
protected

Definition at line 38 of file streaming_model.h.

◆ tensor_arena_

uint8_t* esphome::micro_wake_word::StreamingModel::tensor_arena_ {nullptr}
protected

Definition at line 44 of file streaming_model.h.

◆ tensor_arena_size_

size_t esphome::micro_wake_word::StreamingModel::tensor_arena_size_
protected

Definition at line 40 of file streaming_model.h.

◆ var_arena_

uint8_t* esphome::micro_wake_word::StreamingModel::var_arena_ {nullptr}
protected

Definition at line 45 of file streaming_model.h.


The documentation for this class was generated from the following files: