arduino-audio-tools
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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 TfLiteMicroSpeechRecognizeCommands:
TfLiteAbstractRecognizeCommands

Classes

struct  Result
 

Public Member Functions

 TfLiteMicroSpeechRecognizeCommands ()
 
bool begin (TfLiteConfig cfg) override
 Setup parameters from config.
 
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
 

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.

Constructor & Destructor Documentation

◆ TfLiteMicroSpeechRecognizeCommands()

Member Function Documentation

◆ begin()

bool begin ( TfLiteConfig  cfg)
inlineoverridevirtual

Setup parameters from config.

Implements TfLiteAbstractRecognizeCommands.

◆ categoryCount()

int categoryCount ( )
inlineprotected

Determines the number of categories.

◆ deleteOldRecords()

void deleteOldRecords ( int32_t  limit)
inlineprotected

Removes obsolete records from the queue.

◆ evaluate()

TfLiteStatus evaluate ( const char **  found_command,
uint8_t result_score,
bool is_new_command 
)
inlineprotected

Finds the result.

◆ getCommand()

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

◆ resultCategoryIdx()

int resultCategoryIdx ( int8_t score)
inlineprotected

finds the category with the biggest score

◆ validate()

TfLiteStatus validate ( const TfLiteTensor latest_results)
inlineprotected

Checks the input data.

Member Data Documentation

◆ cfg

TfLiteConfig cfg
protected

◆ current_time_ms

int32_t current_time_ms =0
protected

◆ previous_cateogory

int previous_cateogory =-1
protected

◆ previous_time_ms

int32_t previous_time_ms =0
protected

◆ result_queue

Vector<Result> result_queue
protected

◆ time_since_last_top

int32_t time_since_last_top =0
protected

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