ESPHome  2024.9.0
Public Member Functions | Protected Attributes
esphome::micro_wake_word::WakeWordModel Class Referencefinal

#include <streaming_model.h>

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

Public Member Functions

 WakeWordModel (const uint8_t *model_start, float probability_cutoff, size_t sliding_window_average_size, const std::string &wake_word, size_t tensor_arena_size)
 
void log_model_config () override
 
bool determine_detected () override
 Checks for the wake word by comparing the mean probability in the sliding window with the probability cutoff. More...
 
const std::string & get_wake_word () const
 
- Public Member Functions inherited from esphome::micro_wake_word::StreamingModel
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

std::string wake_word_
 
- Protected Attributes inherited from esphome::micro_wake_word::StreamingModel
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 51 of file streaming_model.h.

Constructor & Destructor Documentation

◆ WakeWordModel()

esphome::micro_wake_word::WakeWordModel::WakeWordModel ( const uint8_t *  model_start,
float  probability_cutoff,
size_t  sliding_window_average_size,
const std::string &  wake_word,
size_t  tensor_arena_size 
)

Definition at line 140 of file streaming_model.cpp.

Member Function Documentation

◆ determine_detected()

bool esphome::micro_wake_word::WakeWordModel::determine_detected ( )
overridevirtual

Checks for the wake word by comparing the mean probability in the sliding window with the probability cutoff.

Returns
True if wake word is detected, false otherwise

Implements esphome::micro_wake_word::StreamingModel.

Definition at line 150 of file streaming_model.cpp.

◆ get_wake_word()

const std::string& esphome::micro_wake_word::WakeWordModel::get_wake_word ( ) const
inline

Definition at line 63 of file streaming_model.h.

◆ log_model_config()

void esphome::micro_wake_word::WakeWordModel::log_model_config ( )
overridevirtual

Implements esphome::micro_wake_word::StreamingModel.

Definition at line 14 of file streaming_model.cpp.

Field Documentation

◆ wake_word_

std::string esphome::micro_wake_word::WakeWordModel::wake_word_
protected

Definition at line 66 of file streaming_model.h.


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