How to set environment variables on Raspberry PI for deployment of TFLite on Pi?

5 views (last 30 days)
Hi!
I am trying to follow some examples for deploying trained Tensorflow Lite models from MATLAB to Raspberry Pi. Here are the pre-requisites I am trying to satisfiy:
At the end of this page, there are some instructions on setting some environment variables. I could do as instructed on the host computer, but I am confused how to set the variables on Raspberry Pi. Specifically, I couldn't find the correct paths for TFLITE_PATH and LD_LIBRARY_PATH. According to the instructions, I should set
  • TFLITE_PATH: Location of the TensorFlow Lite library directory.
  • LD_LIBRARY_PATH: Location of the run-time shared library. For example, TFLITE_PATH/lib/tensorflow/lite.
Here is how I installed TFLite on my Raspberry Pi. I used the command "python3 -m pip install tflite-runtime", which seemed to successfully install TFLite. This can be verified when I excuted the following commands on the Pi terminal:
python3
import tflite_runtime
tflite_runtime.__version__
which then shows '2.5.0'.
When I executed "python3 -m pip show tflite_runtime", this is what I see:
Name: tflite-runtime
Version: 2.5.0
Summary: TensorFlow Lite is for mobile and embedded devices.
Home-page: https://www.tensorflow.org/lite/
Author: Google, LLC
Author-email: packages@tensorflow.org
License: Apache 2.0
Location: /home/pi/.local/lib/python3.7/site-packages
Requires: numpy
Required-by:
I'm not sure if that "site-packages" folder is the correct location for the library. If I set this to be my TFLITE_PATH, there is no such sub-directory as "TFLITE_PATH/lib/tensorflow/lite" which is supposed to be defined as LD_LIBRARY_PATH.
Please let me know if I am missing anything. Thank you!

Answers (1)

Sivsankar
Sivsankar on 11 Feb 2025
Hi @Peng,
You can refer to the following MATLAB answer that explains how to add environment variables on your Raspberry Pi:
Although this answer addresses a different library, I believe that the workflow you need to follow should be similar.
Thanks

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!