Vision API on the Raspberry Pi Tutorial

I recently built a Raspberry Pi demo featuring the Vision API showcased at a conference I spoke at in Ireland.. If you want a twist on the Dexter Industries’s Raspian for Robots Vision API demo, but without the whole Go-Pi-Go setup, this is a viable [easy] second option!

End product: you end up with an awesome handheld Raspberry Pi setup with a touch screen that calls the Vision API in real time to do label, logo, and facial detection. Save the photos you take in real time straight to the Raspberry Pi.

Why I built this demo: I used this demo to showcase how our trained APIs can run on even the smallest of edge devices that are low cost and perceived to have low compute with a small form factor to perform a variety of tasks as they relate to the Vision API. The Pi setups included a camera and screen to interface with the Pi, as well as a portable power source.

Hardware needed:

Option 1: The Lazy [normal] way: Flash the SD card (I used Etcher for Mac)

Access the image on Github here. Once complete, skip to Step 5 below.

Option 2: The Homo Logicus Struggle Way

  1. Flash Raspian for Robots on SD card [download here]
  2. When the SD card is flashed, power on the Pi. When the Pi is powered up, repartition the 2nd primary drive to ensure you do not run out of space. Follow directions here.
  3. Install Chromium. You will not be able to install the GCP SDK or log in to your admin console without Chromium. Directions here.
  4. Create or log in to your Google Cloud Platform account (don’t worry, you get 365 days of trial for free!)
  5. Download and install the Google Cloud platform SDK.
  6. Follow these steps to set up a service account API key. Store your key in a GCS bucket in the GCP project you plan on using for this demo.
  7. Navigate to the GCS bucket. Click on the .json file, then move it to /home/pi once it has downloaded.
  8. Follow steps on the tutorial here from the step titled “Set up the hardware.”

*Note: on the section “Make Credentials Permanent” when manipulating the bashrc profile, do not save it as the file path (“/home/pi/serviceaccountkey.json”). Just save it as the file itself:


*Another Note: If you receive an error referring to opentype, run this command to update your pyasn1 module:

sudo apt-get — reinstall install python-pyasn1 python-pyasn1-modules

This has happened occasionally when the winds were blowing the wrong way in our Google office (: