Class anira::TFLiteProcessor¶
-
class TFLiteProcessor : public anira::BackendBase¶
Inheritance diagram for anira::TFLiteProcessor:
Collaboration diagram for anira::TFLiteProcessor:
TensorFlow Lite-based neural network inference processor.
The TFLiteProcessor class provides neural network inference capabilities using Google’s TensorFlow Lite C API. It offers lightweight, efficient inference optimized for mobile and embedded devices with parallel processing support.
Warning
This class is only available when compiled with USE_TFLITE defined
Public Functions
-
TFLiteProcessor(InferenceConfig &inference_config)¶
Constructs a TensorFlow Lite processor with the given inference configuration.
Initializes the TensorFlow Lite processor and creates the necessary number of parallel processing instances based on the configuration’s num_parallel_processors setting.
- Parameters:
inference_config – Reference to inference configuration containing model path, tensor shapes, and processing parameters
-
~TFLiteProcessor() override¶
Destructor that properly cleans up TensorFlow Lite resources.
Ensures proper cleanup of all TensorFlow Lite interpreters, models, and allocated memory. All processing instances are safely destroyed with proper resource deallocation.
-
virtual void prepare() override¶
Prepares all TensorFlow Lite instances for inference operations.
Loads the TensorFlow Lite model into all parallel processing instances, allocates input/output tensors, and performs warm-up inferences if specified in the configuration.
Processes input buffers through the TensorFlow Lite model.
Performs neural network inference using TensorFlow Lite, converting audio buffers to TensorFlow Lite tensors, executing the model, and converting results back to audio buffers.
- Parameters:
input – Vector of input buffers containing audio samples or parameter data
output – Vector of output buffers to receive processed results
session – Shared pointer to session element providing thread-safe instance access
-
TFLiteProcessor(InferenceConfig &inference_config)¶