ESPHome 2025.5.0
Loading...
Searching...
No Matches
esphome::micro_wake_word::VADModel Class Referencefinal

#include <streaming_model.h>

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

Public Member Functions

 VADModel (const uint8_t *model_start, uint8_t default_probability_cutoff, size_t sliding_window_size, size_t tensor_arena_size)
 
void log_model_config () override
 
DetectionEvent determine_detected () override
 Checks for voice activity by comparing the max probability in the sliding window with the probability cutoff.
 
- 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 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)
 

Additional Inherited Members

- Protected Member Functions inherited from esphome::micro_wake_word::StreamingModel
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 inherited from esphome::micro_wake_word::StreamingModel
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 140 of file streaming_model.h.

Constructor & Destructor Documentation

◆ VADModel()

esphome::micro_wake_word::VADModel::VADModel ( const uint8_t * model_start,
uint8_t default_probability_cutoff,
size_t sliding_window_size,
size_t tensor_arena_size )

Definition at line 226 of file streaming_model.cpp.

Member Function Documentation

◆ determine_detected()

DetectionEvent esphome::micro_wake_word::VADModel::determine_detected ( )
overridevirtual

Checks for voice activity by comparing the max probability in the sliding window with the probability cutoff.

Returns
True if voice activity is detected, false otherwise

Implements esphome::micro_wake_word::StreamingModel.

Definition at line 237 of file streaming_model.cpp.

◆ log_model_config()

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

Implements esphome::micro_wake_word::StreamingModel.

Definition at line 19 of file streaming_model.cpp.


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