Install libraries

For a Raspian base install the only dependency that you need to add is TensorFlow from Google’s binaries. First, install some TensorFlow prerequisites by entering the following in the command line:

sudo apt-get install libblas-dev liblapack-dev python-dev libatlas-base-dev gfortran python-setuptools python-h5py 

The exact URL of the current TensorFlow build varies between versions. Go to the TensorFlow Raspberry Pi 3 build page or the TensorFlow Raspberry Pi Zero build page to find the current one:

Install Arm's training scripts

Download or clone our ML examples repository from GitHub by entering the following on the command line:

git clone
cd ML-examples/yeah-world

There is nothing special about these scripts, they are designed to be easy to understand and modify. Feel free to explore and hack them with your own changes.

Advanced information

The python source code is designed to be straightforward to follow:

  • captures images from the camera and saves them to disk at the end.
  • loads saved images, converts them to features and trains a classifier on those features.
  • captures images from the camera, converts them to features, classifies them and then plays a random sound if they belong to the first category.

The three helper files are to keep the above three files as readable as possible:

  • initializes the picamera module and optionally fluctuates the exposure and white balance during recording.
  • loads the pretrained MobileNet with TensorFlow and uses it to convert one image at a time into a set of features.
  • uses pygame to play a random sound file from a directory.
Overview Train the AI