Run your new network

Now you can run a neural network trained specifically on your environment with a single command:

python run.py example/model.h5 

Wave your hands in the air. Does it cheer? Even if your audio is not configured, the console will print the class predicted and display either:

  • 0: Cheering!
  • 1: Sitting in view but not cheering.
  • 2: Random behaviors such as standing, being out of the picture, unexpected lighting conditions and so on.

There is a lot more that can be done than cheering! You can replace the files in the folder named "sounds" and train a model to recognise completely different gestures, objects or situations. For example, you can teach a Pi to:

  • Greet you by name.
  • Set off an alarm when someone is in view. For example, try hiding beneath a cardboard box or behind a cushion and sneaking up on it.
  • Shout "THE COFFEE IS READY" when the coffee is ready.
  • Tell the dog to get off the sofa when the dog gets on the sofa.

With a little python programming, you can also make your Pi do more interesting things in response to camera input such as setting GPIO pins, sending alerts and emails. The applications are limited only by your imagination!

How did you get on?

Tell us about your successes, failures, and your own machine learning projects. Email us at: ml@arm.com to start the conversation.

This is the first guide in a series of training your own gesture recognition on the Raspberry Pi using machine learning. Although fun, you will quickly see some of the limitations of this approach:
  • Changes location, background and even clothing can throw detection off.
  • Recording longer example videos can cause out of memory errors during training.
  • Training networks to recognise subtle gestures that don't cause a lot of visual change in the image is difficult.

You can easily extend the example code by modifying the classifier network and by changing the actions that are performed when each category is detected. If you are already familiar with neural networks I recommend adding data augmentation techniques and exploring different feature extraction networks such as larger MobileNets and the Inception family.

Coming soon

We will explore new topics in future guides, so look out for guides on:

  • Enhancing gesture recognition - training networks to recognise gestures in many situations and how to use larger datasets.
  • Teachable Pi - a set of tools for building gesture recognition into Pi-based projects, with installation and usage instructions.
Train a network