Error generating MEX PIL due to missing header file for deployment of TFLite model to Raspberry Pi
Hi!
I am encountering a problem when I am trying to deploy a TFLite mode for semantic segmentation on Raspberry Pi. I was following this example by following openExample(‘deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample’)
Before running this example, I have installed the TFLite library on both the local Windows computer directly under "C:tensorflow-2.15.0" following this link:
https://www.mathworks.com/matlabcentral/answers/1631265-matlab-coder-how-do-i-build-tensorflow-lite-for-deep-learning-c-code-generation-and-deployment
and Raspberry Pi 4b (buster; 32bit OS) under "/home/pi/tensorflow/tensorflow/" following this:
https://qengineering.eu/install-tensorflow-2-lite-on-raspberry-pi-4.html
Additionally, the environment variables are set on both the local and raspi machines according to:
https://www.mathworks.com/help/deeplearning/ug/prerequisites-for-deep-learning-with-tensorflow-lite-models.html
While I had no problem with generating the MEX file on the local Windows computer with this section of codes in the example:
cfg = coder.config(‘mex’);
cfg.TargetLang = ‘C++’;
codegen -config cfg tflite_semantic_predict -args ones(257, 257,3,’single’)
I encountered errors when I tried to generate the MEX PIL function through
cfg = coder.config(‘lib’,’ecoder’,true);
cfg.TargetLang = ‘C++’;
cfg.VerificationMode = ‘PIL’;
hw = coder.hardware(‘Raspberry Pi’);
cfg.Hardware = hw;
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
I have attached the entire error message in the txt file. Part of the error message reads:
fatal error: kernels/register.h: No such file or directory
#include "kernels/register.h"
However, when I searched the directories indicated by the environment variables, I could find the kernels/register.h file on both the Windows and RPi machines under the PATH (in Windows) or LD_LIBRARY_PATH (in RPi) variables. Please see the attached screenshots.
Here is how I set the environmental variables. On RPI, I executed:
export TFLITE_PATH="/home/pi/tensorflow/tensorflow"
export LD_LIBRARY_PATH="/home/pi/tensorflow/tensorflow/tensorflow/lite"
export TFLITE_MODEL_PATH="/home/pi"
and on Windows, I directly edited the environmental variable TFLITE_PATH and amended Path variable.
I’d appreciate any advice on how to resolve this missing header file issue by MATLAB coder.
Thank you all!Hi!
I am encountering a problem when I am trying to deploy a TFLite mode for semantic segmentation on Raspberry Pi. I was following this example by following openExample(‘deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample’)
Before running this example, I have installed the TFLite library on both the local Windows computer directly under "C:tensorflow-2.15.0" following this link:
https://www.mathworks.com/matlabcentral/answers/1631265-matlab-coder-how-do-i-build-tensorflow-lite-for-deep-learning-c-code-generation-and-deployment
and Raspberry Pi 4b (buster; 32bit OS) under "/home/pi/tensorflow/tensorflow/" following this:
https://qengineering.eu/install-tensorflow-2-lite-on-raspberry-pi-4.html
Additionally, the environment variables are set on both the local and raspi machines according to:
https://www.mathworks.com/help/deeplearning/ug/prerequisites-for-deep-learning-with-tensorflow-lite-models.html
While I had no problem with generating the MEX file on the local Windows computer with this section of codes in the example:
cfg = coder.config(‘mex’);
cfg.TargetLang = ‘C++’;
codegen -config cfg tflite_semantic_predict -args ones(257, 257,3,’single’)
I encountered errors when I tried to generate the MEX PIL function through
cfg = coder.config(‘lib’,’ecoder’,true);
cfg.TargetLang = ‘C++’;
cfg.VerificationMode = ‘PIL’;
hw = coder.hardware(‘Raspberry Pi’);
cfg.Hardware = hw;
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
I have attached the entire error message in the txt file. Part of the error message reads:
fatal error: kernels/register.h: No such file or directory
#include "kernels/register.h"
However, when I searched the directories indicated by the environment variables, I could find the kernels/register.h file on both the Windows and RPi machines under the PATH (in Windows) or LD_LIBRARY_PATH (in RPi) variables. Please see the attached screenshots.
Here is how I set the environmental variables. On RPI, I executed:
export TFLITE_PATH="/home/pi/tensorflow/tensorflow"
export LD_LIBRARY_PATH="/home/pi/tensorflow/tensorflow/tensorflow/lite"
export TFLITE_MODEL_PATH="/home/pi"
and on Windows, I directly edited the environmental variable TFLITE_PATH and amended Path variable.
I’d appreciate any advice on how to resolve this missing header file issue by MATLAB coder.
Thank you all! Hi!
I am encountering a problem when I am trying to deploy a TFLite mode for semantic segmentation on Raspberry Pi. I was following this example by following openExample(‘deeplearning_shared/SemanticSegmentationUsingTFLiteModelOnHostAndRasPiExample’)
Before running this example, I have installed the TFLite library on both the local Windows computer directly under "C:tensorflow-2.15.0" following this link:
https://www.mathworks.com/matlabcentral/answers/1631265-matlab-coder-how-do-i-build-tensorflow-lite-for-deep-learning-c-code-generation-and-deployment
and Raspberry Pi 4b (buster; 32bit OS) under "/home/pi/tensorflow/tensorflow/" following this:
https://qengineering.eu/install-tensorflow-2-lite-on-raspberry-pi-4.html
Additionally, the environment variables are set on both the local and raspi machines according to:
https://www.mathworks.com/help/deeplearning/ug/prerequisites-for-deep-learning-with-tensorflow-lite-models.html
While I had no problem with generating the MEX file on the local Windows computer with this section of codes in the example:
cfg = coder.config(‘mex’);
cfg.TargetLang = ‘C++’;
codegen -config cfg tflite_semantic_predict -args ones(257, 257,3,’single’)
I encountered errors when I tried to generate the MEX PIL function through
cfg = coder.config(‘lib’,’ecoder’,true);
cfg.TargetLang = ‘C++’;
cfg.VerificationMode = ‘PIL’;
hw = coder.hardware(‘Raspberry Pi’);
cfg.Hardware = hw;
codegen -config cfg tflite_semantic_predict -args ones(257,257,3,’single’)
I have attached the entire error message in the txt file. Part of the error message reads:
fatal error: kernels/register.h: No such file or directory
#include "kernels/register.h"
However, when I searched the directories indicated by the environment variables, I could find the kernels/register.h file on both the Windows and RPi machines under the PATH (in Windows) or LD_LIBRARY_PATH (in RPi) variables. Please see the attached screenshots.
Here is how I set the environmental variables. On RPI, I executed:
export TFLITE_PATH="/home/pi/tensorflow/tensorflow"
export LD_LIBRARY_PATH="/home/pi/tensorflow/tensorflow/tensorflow/lite"
export TFLITE_MODEL_PATH="/home/pi"
and on Windows, I directly edited the environmental variable TFLITE_PATH and amended Path variable.
I’d appreciate any advice on how to resolve this missing header file issue by MATLAB coder.
Thank you all! tflite, raspberry pi, deploy, semantic segmentation MATLAB Answers — New Questions