Want to up your robotics game and give it the ability to detect objects? Maybe implement a security camera that can see and identify certain items? Now that the Raspberry Pi is fast enough to do machine learning, adding these features is fairly straightforward.
This guide will show you the steps to get TensorFlow 2 installed on your Raspberry Pi 4 and perform some object detection using the TensorFlow Lite Python Interpreter, which is faster than the full TensorFlow interpreter.
There are two main setup paths to choose from. The first option is with a PiTFT if you want to have a larger display.
To start with, you will need a Raspberry Pi 4. Since TensorFlow object detection is processing intensive, you should use at least the 4GB model.
You really need a Pi 4 or better, TensorFlow vision recognition will not run on anything slower!
This guide was originally written for Raspberry Pi OS Buster, with the original Picamera library. When Raspberry Pi released Bullseye, they did so with a promise that eventually there would be a new Picamera2 library that was built on top of the libcamera subsystem. While it was possible to install Picamera2, it was a very involved process that was not friendly to the average user and still highly experimental.
Nearly a year later, they started including Picamera2 with Raspberry Pi OS by default, so it was time for a guide update. At this time, Picamera2 is still in beta, so the installation path that this updated guide uses is designed to make it as easy as possible for you to get a Raspberry Pi up and running with TensorFlow.
The overall installation path will be to using the 64-bit version of the Raspberry Pi Desktop because recent versions of TensorFlow are no longer compiling for the 32-bit OS and the QT OpenGL graphics drivers are installed by default on the Desktop version.