#include <streaming_model.h>
|
| | WakeWordModel (const std::string &id, const uint8_t *model_start, 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 () |
| |
| 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) |
| |
|
| 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 106 of file streaming_model.h.
◆ WakeWordModel() [1/2]
| esphome::micro_wake_word::WakeWordModel::WakeWordModel |
( |
const std::string & | id, |
|
|
const uint8_t * | model_start, |
|
|
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.
- Parameters
-
| id | (std::string) identifier for this model |
| model_start | (const uint8_t *) pointer to the start of the model's TFLite FlatBuffer |
| 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 258 of file streaming_model.cpp.
◆ WakeWordModel() [2/2]
| 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.
- Parameters
-
| 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 284 of file streaming_model.cpp.
◆ ~WakeWordModel()
| esphome::micro_wake_word::WakeWordModel::~WakeWordModel |
( |
| ) |
|
|
inlineoverride |
◆ add_trained_language()
| void esphome::micro_wake_word::WakeWordModel::add_trained_language |
( |
const std::string & | language | ) |
|
|
inline |
◆ determine_detected()
| DetectionEvent esphome::micro_wake_word::WakeWordModel::determine_detected |
( |
| ) |
|
|
overridevirtual |
◆ disable()
| void esphome::micro_wake_word::WakeWordModel::disable |
( |
| ) |
|
|
overridevirtual |
◆ enable()
| void esphome::micro_wake_word::WakeWordModel::enable |
( |
| ) |
|
|
overridevirtual |
◆ get_id()
| const std::string & esphome::micro_wake_word::WakeWordModel::get_id |
( |
| ) |
const |
|
inline |
◆ get_internal_only()
| bool esphome::micro_wake_word::WakeWordModel::get_internal_only |
( |
| ) |
|
|
inline |
◆ get_trained_languages()
| const std::vector< std::string > & esphome::micro_wake_word::WakeWordModel::get_trained_languages |
( |
| ) |
const |
|
inline |
◆ get_wake_word()
| const std::string & esphome::micro_wake_word::WakeWordModel::get_wake_word |
( |
| ) |
const |
|
inline |
◆ log_model_config()
| void esphome::micro_wake_word::WakeWordModel::log_model_config |
( |
| ) |
|
|
overridevirtual |
◆ id_
| std::string esphome::micro_wake_word::WakeWordModel::id_ |
|
protected |
◆ internal_only_
| bool esphome::micro_wake_word::WakeWordModel::internal_only_ |
|
protected |
◆ model_data_
| std::shared_ptr<ModelData> esphome::micro_wake_word::WakeWordModel::model_data_ |
|
protected |
◆ pref_
◆ trained_languages_
| std::vector<std::string> esphome::micro_wake_word::WakeWordModel::trained_languages_ |
|
protected |
◆ wake_word_
| std::string esphome::micro_wake_word::WakeWordModel::wake_word_ |
|
protected |
The documentation for this class was generated from the following files: