Exporting the SavedModel

The first step is to export your shiny new model in SavedModel format. This makes it easy to transfer all of the files needed to the Pi, since it comes in a zip file.

Click Export Model in the Preview box.

In the dialog that appears, choose TensorFlow and be sure the SavedModel button is selected, as shown below.

Then, click Download my model. After a minute or two, your browser will save a converted_savedmodel.zip file.

Running the model on the Pi

When you clicked the Download my model button in the last step, your browser should have saved a file called converted_savedmodel.zip. Now you need to place this on your Raspberry Pi.

You can transfer the model to the Raspberry Pi using scp:

$ scp <<PATH_TO_DOWNLOADS>>/converted_savedmodel.zip [email protected]:~

NOTE: You might need to adjust the first path in the command above to point to your Downloads folder.

Now, SSH to your Pi and run:

$ cd rpi-vision
$ sudo bash
# source .venv/bin/activate
# python3 tests/pitft_teachablemachine.py ../converted_savedmodel.zip

It will take some time to load the model into memory. During this time, you'll see the BrainCraft logo appear on the display. Afterwards, point your rpi camera and try it out!

This guide was first published on Jan 27, 2020. It was last updated on Jan 27, 2020.

This page (Running on the Pi) was last updated on Apr 14, 2021.

Text editor powered by tinymce.