ESPHome 2025.5.0
Loading...
Searching...
No Matches
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 DetectionEvent determine_detected ()=0
 
bool perform_streaming_inference (const int8_t features[PREPROCESSOR_FEATURE_SIZE])
 
void reset_probabilities ()
 Sets all recent_streaming_probabilities to 0 and resets the ignore window count.
 
void unload_model ()
 Destroys the TFLite interpreter and frees the tensor and variable arenas' memory.
 
virtual void enable ()
 Enable the model. The next performing_streaming_inference call will load it.
 
virtual void disable ()
 Disable the model. The next performing_streaming_inference call will unload it.
 
bool is_enabled () const
 Return true if the model is enabled.
 
bool get_unprocessed_probability_status () const
 
uint8_t get_default_probability_cutoff () const
 
uint8_t get_probability_cutoff () const
 
void set_probability_cutoff (uint8_t probability_cutoff)
 

Protected Member Functions

bool load_model_ ()
 Allocates tensor and variable arenas and sets up the model interpreter.
 
bool register_streaming_ops_ (tflite::MicroMutableOpResolver< 20 > &op_resolver)
 Returns true if successfully registered the streaming model's TensorFlow operations.
 

Protected Attributes

tflite::MicroMutableOpResolver< 20 > streaming_op_resolver_
 
bool loaded_ {false}
 
bool enabled_ {true}
 
bool unprocessed_probability_status_ {false}
 
uint8_t current_stride_step_ {0}
 
int16_t ignore_windows_ {-MIN_SLICES_BEFORE_DETECTION}
 
uint8_t default_probability_cutoff_
 
uint8_t 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 29 of file streaming_model.h.

Member Function Documentation

◆ determine_detected()

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

◆ disable()

virtual void esphome::micro_wake_word::StreamingModel::disable ( )
inlinevirtual

Disable the model. The next performing_streaming_inference call will unload it.

Reimplemented in esphome::micro_wake_word::WakeWordModel.

Definition at line 50 of file streaming_model.h.

◆ enable()

virtual void esphome::micro_wake_word::StreamingModel::enable ( )
inlinevirtual

Enable the model. The next performing_streaming_inference call will load it.

Reimplemented in esphome::micro_wake_word::WakeWordModel.

Definition at line 47 of file streaming_model.h.

◆ get_default_probability_cutoff()

uint8_t esphome::micro_wake_word::StreamingModel::get_default_probability_cutoff ( ) const
inline

Definition at line 58 of file streaming_model.h.

◆ get_probability_cutoff()

uint8_t esphome::micro_wake_word::StreamingModel::get_probability_cutoff ( ) const
inline

Definition at line 59 of file streaming_model.h.

◆ get_unprocessed_probability_status()

bool esphome::micro_wake_word::StreamingModel::get_unprocessed_probability_status ( ) const
inline

Definition at line 55 of file streaming_model.h.

◆ is_enabled()

bool esphome::micro_wake_word::StreamingModel::is_enabled ( ) const
inline

Return true if the model is enabled.

Definition at line 53 of file streaming_model.h.

◆ load_model_()

bool esphome::micro_wake_word::StreamingModel::load_model_ ( )
protected

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

Returns
True if successful, false otherwise

Definition at line 25 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 110 of file streaming_model.cpp.

◆ register_streaming_ops_()

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

Returns true if successfully registered the streaming model's TensorFlow operations.

Definition at line 260 of file streaming_model.cpp.

◆ reset_probabilities()

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

Sets all recent_streaming_probabilities to 0 and resets the ignore window count.

Definition at line 155 of file streaming_model.cpp.

◆ set_probability_cutoff()

void esphome::micro_wake_word::StreamingModel::set_probability_cutoff ( uint8_t probability_cutoff)
inline

Definition at line 60 of file streaming_model.h.

◆ 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 92 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 74 of file streaming_model.h.

◆ default_probability_cutoff_

uint8_t esphome::micro_wake_word::StreamingModel::default_probability_cutoff_
protected

Definition at line 77 of file streaming_model.h.

◆ enabled_

bool esphome::micro_wake_word::StreamingModel::enabled_ {true}
protected

Definition at line 72 of file streaming_model.h.

◆ ignore_windows_

int16_t esphome::micro_wake_word::StreamingModel::ignore_windows_ {-MIN_SLICES_BEFORE_DETECTION}
protected

Definition at line 75 of file streaming_model.h.

◆ interpreter_

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

Definition at line 88 of file streaming_model.h.

◆ last_n_index_

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

Definition at line 81 of file streaming_model.h.

◆ loaded_

bool esphome::micro_wake_word::StreamingModel::loaded_ {false}
protected

Definition at line 71 of file streaming_model.h.

◆ ma_

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

Definition at line 90 of file streaming_model.h.

◆ model_start_

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

Definition at line 85 of file streaming_model.h.

◆ mrv_

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

Definition at line 89 of file streaming_model.h.

◆ probability_cutoff_

uint8_t esphome::micro_wake_word::StreamingModel::probability_cutoff_
protected

Definition at line 78 of file streaming_model.h.

◆ recent_streaming_probabilities_

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

Definition at line 83 of file streaming_model.h.

◆ sliding_window_size_

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

Definition at line 79 of file streaming_model.h.

◆ streaming_op_resolver_

tflite::MicroMutableOpResolver<20> esphome::micro_wake_word::StreamingModel::streaming_op_resolver_
protected

Definition at line 69 of file streaming_model.h.

◆ tensor_arena_

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

Definition at line 86 of file streaming_model.h.

◆ tensor_arena_size_

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

Definition at line 82 of file streaming_model.h.

◆ unprocessed_probability_status_

bool esphome::micro_wake_word::StreamingModel::unprocessed_probability_status_ {false}
protected

Definition at line 73 of file streaming_model.h.

◆ var_arena_

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

Definition at line 87 of file streaming_model.h.


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