arduino-audio-tools
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
audio_tools::TfLiteMicroSpeechRecognizeCommands Class Reference

This class is designed to apply a very primitive decoding model on top of the instantaneous results from running an audio recognition model on a single window of samples. It applies smoothing over time so that noisy individual label scores are averaged, increasing the confidence that apparent matches are real. To use it, you should create a class object with the configuration you want, and then feed results from running a TensorFlow model into the processing method. The timestamp for each subsequent call should be increasing from the previous, since the class is designed to process a stream of data over time. More...

#include <TfLiteAudioStream.h>

Inheritance diagram for audio_tools::TfLiteMicroSpeechRecognizeCommands:
audio_tools::TfLiteAbstractRecognizeCommands

Classes

struct  Result
 

Public Member Functions

bool begin (TfLiteConfig cfg) override
 Setup parameters from config. More...
 
virtual TfLiteStatus getCommand (const TfLiteTensor *latest_results, const int32_t current_time_ms, const char **found_command, uint8_t *score, bool *is_new_command) override
 
virtual bool begin (TfLiteConfig cfg)=0
 
virtual TfLiteStatus getCommand (const TfLiteTensor *latest_results, const int32_t current_time_ms, const char **found_command, uint8_t *score, bool *is_new_command)=0
 

Protected Member Functions

int categoryCount ()
 Determines the number of categories.
 
void deleteOldRecords (int32_t limit)
 Removes obsolete records from the queue.
 
TfLiteStatus evaluate (const char **found_command, uint8_t *result_score, bool *is_new_command)
 Finds the result.
 
int resultCategoryIdx (int8_t *score)
 finds the category with the biggest score
 
TfLiteStatus validate (const TfLiteTensor *latest_results)
 Checks the input data.
 

Protected Attributes

TfLiteConfig cfg
 
int32_t current_time_ms =0
 
int previous_cateogory =-1
 
int32_t previous_time_ms =0
 
Vector< Resultresult_queue
 
int32_t time_since_last_top =0
 

Detailed Description

This class is designed to apply a very primitive decoding model on top of the instantaneous results from running an audio recognition model on a single window of samples. It applies smoothing over time so that noisy individual label scores are averaged, increasing the confidence that apparent matches are real. To use it, you should create a class object with the configuration you want, and then feed results from running a TensorFlow model into the processing method. The timestamp for each subsequent call should be increasing from the previous, since the class is designed to process a stream of data over time.

Member Function Documentation

◆ begin()

bool audio_tools::TfLiteMicroSpeechRecognizeCommands::begin ( TfLiteConfig  cfg)
inlineoverridevirtual

Setup parameters from config.

Implements audio_tools::TfLiteAbstractRecognizeCommands.

◆ getCommand()

virtual TfLiteStatus audio_tools::TfLiteMicroSpeechRecognizeCommands::getCommand ( const TfLiteTensor *  latest_results,
const int32_t  current_time_ms,
const char **  found_command,
uint8_t *  score,
bool *  is_new_command 
)
inlineoverridevirtual

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