This guide provides a walkthrough for getting a Lobe TensorFlow model onto the Raspberry Pi 4.*
It is assumed you are starting with a Pi in a remote headless configuration already enabled with SSH, Remote Desktop or VNC, and WiFi access.
*Note that this procedure will work for a Pi 3, however it is unlikely the model will run successfully.
- Raspberry Pi 4
- SD Card with Raspbian (desktop version recommended)
- USB-C Power Supply (5.1V, 3A)
- Pi Camera
- Case (optional but recommended)
- Pi Camera Mount (optional but recommended)
- WinSCP (or other remote file transfer program)
- Remote Desktop or VNC
- Carefully plug in your Pi Camera module. Instructions can be found here.
- Power up your Pi and log in to the desktop view.
- On the Pi, open a terminal window and create a directory where you want to store your Lobe model and code. For example, in the /home/pi folder:
mkdir Lobe - Navigate into your Lobe directory, and install the lobe-python package:
cd Lobe wget https://raw.githubusercontent.com/lobe/lobe-python/master/scripts/lobe-rpi-install.sh sudo ./lobe-rpi-install.sh
Note: you can also use a USB drive to transfer the files
-
On your PC or Mac, open WinSCP (or your preferred remote file transfer method) and connect to the Pi.
-
On the Pi side navigate to the Lobe directory and create a new folder called "model".
-
Select and the Lobe TensorFlow model files on your PC or Mac into the model folder on the Pi.
Note: You should have two files -- "saved_model.pb" and "signature.json" -- as well as a folder named "variables" with two files inside.
- On the Pi, open the rpi_quickstart.py file with your favorite Python editor.
- In line 4, update the model path to point to the folder with your Lobe TF model files. Hint: if you created the directory with the same name as above you don't need to change anything.
- Run your python program with Python 3: ''' python3 rpi_quickstart.py '''
- Check that the Pi power light is bright red. A dim red light indicates insufficient power.
- Be sure you're installing and running your TF code using Python 3.
- If you're using multiple components, be sure they are all connected to the same common ground.