Skip to content

Commit a5beb38

Browse files
committed
Added binary data model support for TFLite
1 parent 5efa2d0 commit a5beb38

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/backends/TFLiteProcessor.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,15 @@ void TFLiteProcessor::process(std::vector<BufferF>& input, std::vector<BufferF>&
3636

3737
TFLiteProcessor::Instance::Instance(InferenceConfig& inference_config) : m_inference_config(inference_config)
3838
{
39-
std::string modelpath = m_inference_config.get_model_path(anira::InferenceBackend::TFLITE);
40-
m_model = TfLiteModelCreateFromFile(modelpath.c_str());
39+
if (inference_config.is_model_binary(anira::InferenceBackend::TFLITE)) {
40+
const anira::ModelData* model_data = m_inference_config.get_model_data(anira::InferenceBackend::TFLITE);
41+
assert(model_data && "Model data not found for binary model!");
42+
m_model = TfLiteModelCreate(model_data->m_data, model_data->m_size);
43+
} else {
44+
std::string modelpath = m_inference_config.get_model_path(anira::InferenceBackend::TFLITE);
45+
m_model = TfLiteModelCreateFromFile(modelpath.c_str());
46+
}
47+
4148

4249
m_options = TfLiteInterpreterOptionsCreate();
4350
TfLiteInterpreterOptionsSetNumThreads(m_options, 1);

0 commit comments

Comments
 (0)