Run "Object Detection with TensorFlow Lite Model Maker" in Raspberry PI

Greetings to the whole community.

I have successfully run the object detector (examples/lite/examples/object_detection/raspberry_pi at master · tensorflow/examples · GitHub) on a Raspberry PI 3B with OS Buster.

Now I try to run the model trained in the Object Detection lesson with TensorFlow Lite Model Maker (Object Detection with TensorFlow Lite Model Maker) but it throws a segmentation error. Reviewing the lesson it is specified that “The model can be integrated into an Android or iOS application”, but it does not indicate what to do for its execution in a Raspberry PI.

Can anyone point me to the additional steps to run the model on a Raspberry PI?


i suffer from same problem

I think you are using an older version of TFLite (e.g. 2.5.0). Please update your tflite-runtime to the latest version (2.7.0 at the time of this post) by running pip install tflite-runtime --upgrade.


Indeed, I am using tflite-maker 2.5.0 on Raspberry OS Buster, but when I try to upgrade, it is not possible (apparently there is no installer for this version).

If I use Raspberry OS Bullseye it is possible to install tflite-maker 2.7.0, but in this distribution the OS does not recognize the camera. I have already done the relevant steps for its configuration, but it is still not recognized.

Based on your comments, I opted to try converting the model using tflite-maker version 0.3.1, instead of version 0.3.4 which is installed by default. To do so, I modify the original line of the Object Detection with TensorFlow Lite Model Maker example (Object Detection with TensorFlow Lite Model Maker)

!pip install -q --use-deprecated=legacy-resolver tflite-model-maker

Adding the version I want to install (0.3.1)

!pip install -q --use-deprecated=legacy-resolver tflite-model-maker==0.3.1

Once trained and exported the model with this version, the model runs correctly (on the Raspberry OS Buster)