|
ESPHome 2026.11.0-dev
|
#include <streaming_model.h>
Public Member Functions | |
| WakeWordModel (const std::string &id, const uint8_t *model_start, size_t model_size, uint8_t default_probability_cutoff, size_t sliding_window_average_size, const std::string &wake_word, size_t tensor_arena_size, bool default_enabled, bool internal_only) | |
| Constructs a wake word model object with compile-time model data. | |
| WakeWordModel (const std::string &id, std::shared_ptr< ModelData > model_data, uint8_t default_probability_cutoff, size_t sliding_window_average_size, const std::string &wake_word, std::vector< std::string > trained_languages, size_t tensor_arena_size) | |
| Constructs a wake word model object with a runtime-downloaded model. | |
| ~WakeWordModel () override | |
| void | log_model_config () override |
| DetectionEvent | determine_detected () override |
| Checks for the wake word by comparing the mean probability in the sliding window with the probability cutoff. | |
| const std::string & | get_id () const |
| const std::string & | get_wake_word () const |
| void | add_trained_language (const std::string &language) |
| const std::vector< std::string > & | get_trained_languages () const |
| void | enable () override |
| Enable the model and save to flash. The next performing_streaming_inference call will load it. | |
| void | disable () override |
| Disable the model and save to flash. The next performing_streaming_inference call will unload it. | |
| bool | get_internal_only () |
Public Member Functions inherited from esphome::micro_wake_word::StreamingModel | |
| virtual | ~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. | |
| bool | is_enabled () const |
| Return true if the model is enabled. | |
| bool | has_model_data () const |
| Return true if the model has usable data. A model without it can never be loaded or run. | |
| 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 Attributes | |
| std::shared_ptr< ModelData > | model_data_ |
| std::string | id_ |
| std::string | wake_word_ |
| std::vector< std::string > | trained_languages_ |
| bool | internal_only_ |
| ESPPreferenceObject | pref_ |
Protected Attributes inherited from esphome::micro_wake_word::StreamingModel | |
| tflite::MicroMutableOpResolver< 20 > | streaming_op_resolver_ |
| bool | loaded_ {false} |
| bool | enabled_ {true} |
| bool | tensor_arena_size_probed_ {false} |
| 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_ {nullptr} |
| size_t | model_size_ {0} |
| RAMUniquePtr< uint8_t[]> | model_copy_ |
| uint8_t * | tensor_arena_ {nullptr} |
| uint8_t * | var_arena_ {nullptr} |
| std::unique_ptr< tflite::MicroInterpreter > | interpreter_ |
| tflite::MicroResourceVariables * | mrv_ {nullptr} |
| tflite::MicroAllocator * | ma_ {nullptr} |
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. | |
| size_t | probe_arena_size_ () |
| Probes the actual required tensor arena size by trial allocation. | |
| bool | register_streaming_ops_ (tflite::MicroMutableOpResolver< 20 > &op_resolver) |
| Returns true if successfully registered the streaming model's TensorFlow operations. | |
Definition at line 111 of file streaming_model.h.
| esphome::micro_wake_word::WakeWordModel::WakeWordModel | ( | const std::string & | id, |
| const uint8_t * | model_start, | ||
| size_t | model_size, | ||
| uint8_t | default_probability_cutoff, | ||
| size_t | sliding_window_average_size, | ||
| const std::string & | wake_word, | ||
| size_t | tensor_arena_size, | ||
| bool | default_enabled, | ||
| bool | internal_only ) |
Constructs a wake word model object with compile-time model data.
| id | (std::string) identifier for this model |
| model_start | (const uint8_t *) pointer to the start of the model's TFLite FlatBuffer |
| model_size | (size_t) size of the compiled-in model data |
| default_probability_cutoff | (uint8_t) probability cutoff for acceping the wake word has been said |
| sliding_window_average_size | (size_t) the length of the sliding window computing the mean rolling probability |
| wake_word | (std::string) Friendly name of the wake word |
| tensor_arena_size | (size_t) Size in bytes for allocating the tensor arena |
| default_enabled | (bool) If true, it will be enabled by default on first boot |
| internal_only | (bool) If true, the model will not be exposed to HomeAssistant as an available model |
Definition at line 292 of file streaming_model.cpp.
| esphome::micro_wake_word::WakeWordModel::WakeWordModel | ( | const std::string & | id, |
| std::shared_ptr< ModelData > | model_data, | ||
| uint8_t | default_probability_cutoff, | ||
| size_t | sliding_window_average_size, | ||
| const std::string & | wake_word, | ||
| std::vector< std::string > | trained_languages, | ||
| size_t | tensor_arena_size ) |
Constructs a wake word model object with a runtime-downloaded model.
| id | (std::string) identifier for this model |
| model_data | (std::shared_ptr<ModelData>) owning handle to the downloaded model buffer; must be valid |
| default_probability_cutoff | (uint8_t) probability cutoff for acceping the wake word has been said |
| sliding_window_average_size | (size_t) the length of the sliding window computing the mean rolling probability |
| wake_word | (std::string) Friendly name of the wake word |
| trained_languages | (std::vector<std::string>) Languages the model was trained on |
| tensor_arena_size | (size_t) Size in bytes for allocating the tensor arena |
Definition at line 322 of file streaming_model.cpp.
|
inlineoverride |
Definition at line 143 of file streaming_model.h.
|
inline |
Definition at line 155 of file streaming_model.h.
|
overridevirtual |
Checks for the wake word by comparing the mean probability in the sliding window with the probability cutoff.
Implements esphome::micro_wake_word::StreamingModel.
Definition at line 374 of file streaming_model.cpp.
|
overridevirtual |
Disable the model and save to flash. The next performing_streaming_inference call will unload it.
Reimplemented from esphome::micro_wake_word::StreamingModel.
Definition at line 367 of file streaming_model.cpp.
|
overridevirtual |
Enable the model and save to flash. The next performing_streaming_inference call will load it.
Reimplemented from esphome::micro_wake_word::StreamingModel.
Definition at line 360 of file streaming_model.cpp.
|
inline |
Definition at line 152 of file streaming_model.h.
|
inline |
Definition at line 164 of file streaming_model.h.
|
inline |
Definition at line 156 of file streaming_model.h.
|
inline |
Definition at line 153 of file streaming_model.h.
|
overridevirtual |
Implements esphome::micro_wake_word::StreamingModel.
Definition at line 16 of file streaming_model.cpp.
|
protected |
Definition at line 171 of file streaming_model.h.
|
protected |
Definition at line 175 of file streaming_model.h.
|
protected |
Definition at line 169 of file streaming_model.h.
|
protected |
Definition at line 177 of file streaming_model.h.
|
protected |
Definition at line 173 of file streaming_model.h.
|
protected |
Definition at line 172 of file streaming_model.h.