• Stars
    star
    278
  • Rank 147,759 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 4 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Explore the basics of machine learning by building your own teachable object at home.

Alto - a little teachable object


Say hello to Alto, a little teachable object! Alto is designed to demonstrate the most basic aspects of machine learning (ML) by building a machine you can teach yourself. Alto uses the Coral USB Accelerator and Raspberry Pi to help show how you can easily add machine learning to your next hardware project.

This repository contains all of the instructions and files required to build an Alto of your own from scratch. Best of all, Alto is completely open source! Anyone can fork the code, schematics, and case designs to create a little teachable object of their own.

To find out more about what else you can do with the Edge TPU in the USB Accelerator, and get inspiration for your own projects, head to Coral's Examples page.

alto hero image

What you’ll find in this document

This document has five chapters:

  • User guide - Explaining Alto’s interface and the ways Alto can be used.

  • Make your own Alto - A visual guide to constructing your own Alto, covering setting up the software, soldering your circuitry and constructing Alto’s cardboard body.

  • Experiment with Alto - A set of simple experiments to help understand how Alto works, and how you can use Alto to introduce some of the basic concepts of machine learning to others.

  • Remixing Alto - A brief introduction to how you can hack your Alto to look and behave differently to fit your own application.

  • Technical overview - A more detailed overview of Alto’s software and electronics and how they function.


User guide

Machine learning at its simplest

Alto has a camera on its front, and an arm and button on each side. Alto uses the camera to observe the world around it. The buttons are used to start learning, and Alto will point with its arm when it sees something it has learned to recognise.

about alto animated gif

Alto can learn two classes of things. When Alto recognises one of them, it will point with its corresponding arm. Alto demonstrates machine learning at its most basic level: what you teach it to recognise is up to you!

alto points at fruit

Teaching Alto

To teach Alto to recognise an object, place the object in front of it, and press one of the buttons on the side. As Alto takes images to learn about the object, its arm will slowly raise. When Alto’s arm is stretched out horizontally, the learning process has finished. Now, when the same object is placed in front of it, Alto will point at the object.

The more you teach Alto about the same object, the better it will become at recognising that thing. You can teach Alto as many times as you like! Try teaching Alto more about an object by rotating the object to show different angles and place it at various distances, pressing the same button each time.

It's important to try and balance the amount of learning that Alto does on each side. If it learns about one object 5 times, but only once about another, then it is likely to be much better at recognising the one that it has seen more often.

alto points at red apples

Recognising objects

Start by teaching Alto to recognise a different object for each arm, for example, to teach Alto the difference between types of fruit, teach it about a red apple on one side, and a banana on the other.

alto points at a red apple

Recognising classes

Beyond recognising individual objects, you can teach Alto to recognise classes of objects. Building on what it has learned about red apples, could you teach it to recognise red objects in general, rather than just apples? Once Alto has learned to recognise two classes, can it correctly recognise a new red object that it hasn’t seen before?

alto points at red objects

Forgetting

If you want to teach Alto something new, you can clear its memory by holding down both buttons simultaneously for 3 seconds. This will erase everything Alto was taught on both sides, and can’t be undone.

To learn about any of these processes in more detail, take a look at the Experiment with Alto section below.

alto forgets

Make your own Alto

The following steps will guide you through the process of assembling your own Alto: setting up the Raspberry Pi, soldering the electronics, and assembling a case to house all the components. To read a more detailed explanation of each step, click on the links in each section to go to the individual instruction pages.

soldering overhead

1.0: Set up the software

The first step is to setup the software environment for Alto, and then load the Python code that makes Alto function. The Software & OS section outlines the process in full, starting with setting up the Raspberry Pi Zero, flashing the SD card and installing the Alto application software.

terminal output installing software

2.0: Build the electronics

The electronics for Alto have been designed to be as simple and hackable as possible. You only need a few common components and basic soldering skills to assemble everything. A full step-by-step guide, with schematics and a bill of materials, is included in the Electronics directory in this repository.

overhead shot of some electronics

3.1: Making the electronics casing

The inner structure of Alto is made from folded cardboard, and held together with staples. All the components of Alto are held in this structure: the servos, LEDs, camera, and the internal electronics package are all mounted in the cardboard layers.

To begin, you will need to print out the PDF template and stick it to your materials. This will be your guide for cutting the cardboard into the correct shape. All the labels are printed on the template itself.

You can accomplish this step using hand tools (e.g. a craft knife) which will take around 45 minutes, or a laser cutter if you have access to one, which will be significantly quicker.

For more detailed instructions on this stage of constructing your Alto, refer to the electronics casing instructions.

cutting out and assembling paper parts

3.2: Making Alto's outer casing

The outer structure of Alto is made from card, and is designed to fit around and fold into the seams of Alto’s inner structure. The process is similar to before, outlined in full detail on the outer case build directory.

The white card makes up most of Alto’s outer structure, and hides some of its components and electronics. We provide printable coloured card accessories that highlight the yellow eye (camera), the red ears (buttons) and the blue arms (servo motor arms).

You can also customise the visual style at this stage to make your Alto unique!

assembling alto's casing

4.0: Teach!

You should now have a completed Alto unit – the next stage is to teach it!

Grab some objects, plug Alto into a power source, and start exploring what you can teach Alto to recognise. If you need a bit of inspiration to get going, take a look at the Experimenting with Alto section below.

alto standing alone

Experiment with Alto

Alto is a great way to understand the basics of machine learning. This section contains a number of experiments to help understand how Alto works, and introduce the basics of machine learning to others.

Covering aspects from simple object recognition, to introducing k-nearest neighbor (kNN) algorithms, these experiments give practical ways to bring the concepts behind Alto to life. Head to the Experiments with Alto page to read on.

alto pointed at a red apple

Remixing Alto for your projects

All the hardware and software for Alto was created with hacking and remixing in mind: the case design can be made from different materials, or refactored entirely; the electronics can be adapted to use whatever components you have available; the servos can be substituted for any type of actuator; and the software is written in a high level language (Python) that is easy to modify.

Here are just some of the ways you can hack your own Alto:

different alto form factors

Hacking the software

Small tweaks to the existing code can be made to change Alto’s confidence level or behaviours.

changing alto's code

Hacking the hardware

Go beyond servos, to explore new ways for Alto to show its recognised something.

alto with LED confidence meter

Hacking the casing

The casing for Alto can easily be changed to fit whatever application you might have in mind. Whether that’s simple aesthetic changes to modify Alto’s look, or changes to the design of the arms or body that might let Alto do new things.

different alto form factors and designs

Hacking Alto is a great step towards building your own machine learning projects. If you come up with anything cool using the Coral USB Accelerator, show us! Submit your machine learning experiment to the Experiments with Google platform here.

Technical Overview

There are three main elements to Alto: a Raspberry Pi Zero single-board computer with a camera attachment; a Coral USB Accelerator for accelerating on-device machine learning; and some simple electronics for its user interface.

OS & compute

The Raspberry Pi Zero runs Raspberry Pi OS. It is responsible for interfacing with the user’s connected hardware (connected via GPIO), the camera module, and the Coral Edge TPU (connected via USB). The OS starts automatically, and acts as host for the software application that runs Alto.

The system accelerates all ML inferencing (and some of the learning) by delegating ML graph execution to the Edge TPU on the Coral USB Accelerator. The Edge TPU is a machine learning coprocessor that enables low-powered computers like the Raspberry Pi to run advanced ML workloads at a much greater level of performance than if they were run on CPU. All of the ML tasks performed by Alto are done on-device (offline) using the Edge TPU.

Although the Coral software for the Edge TPU does not officially support the Raspberry Pi Zero (because it has an ARMv6 chipset, but Coral officially requires ARMv8), the Coral software for the Edge TPU Runtime is open sourced and has been successfully compiled for the Raspberry Pi Zero.

You can find out more about Coral and the Edge TPU hardware on the Coral website.

Software

The Alto software application is written in Python. It receives input from the Raspberry Pi camera module, prepares it for classification by the Edge TPU module, and interfaces with the electronics interface. The application uses a k-nearest neighbor classifier model (k-NN) to identify the proximity of a given image to others in its learned dataset.

When Alto is learning, it calculates the embedding of the incoming data from the image sensor in its model and assigns it a label - in the case of Alto, this label is either its left or right arm. When Alto is in recognition mode, the embeddings of data frames from the image sensor are determined and their proximity to other known embeddings is calculated; if these are within a certain distance of a labelled embedding, then Alto has recognised something, and will point at it with its corresponding arm.

Electronics

The electronics for Alto are designed to be as flexible and hackable as possible. It is based around a single through-hole prototyping board which can be assembled easily by hand. This board connects to the GPIO pins of the Raspberry Pi Zero, and breaks out headers for the other component parts of Alto: two servos, two buttons, and one LED.

Each of these items are common and easy to get, or you might even have them in your hacking space already. Alternatively, they can easily be substituted for other parts, for example if you have different servos or LEDs available. The design and Bill of Materials (BOM) includes a prefabricated USB breakout board, which includes a discrete power regulation circuit that will ensure smooth delivery of adequate power to Alto during normal operation.

You can find more information about the electronics in the electronics directory, and the bill of materials is available here as a downloadable spreadsheet.

Notes

This is a collaborative effort between Google Creative Lab and our partners at RRD Labs. This is not an official Google product.

We encourage open sourcing projects as a way of learning from each other. Please respect our and other creators’ rights, including copyright and trademark rights when present when sharing these works and creating derivative work. If you want more info on Google's policy, you can find it here. To contribute to the project, please refer to the contributing document in this repository.

More Repositories

1

anypixel

A web-friendly way for anyone to build unusual displays
C
6,437
star
2

quickdraw-dataset

Documentation on how to access and use the Quick, Draw! Dataset.
6,092
star
3

teachable-machine-v1

Explore how machine learning works, live in the browser. No coding required.
JavaScript
3,848
star
4

coder

A simple way to make web stuff on Raspberry Pi
JavaScript
2,425
star
5

open-nsynth-super

Open NSynth Super is an experimental physical interface for the NSynth algorithm
C++
2,419
star
6

chrome-music-lab

A collection of experiments for exploring how music works, all built with the Web Audio API.
JavaScript
2,127
star
7

aiexperiments-ai-duet

A piano that responds to you.
JavaScript
1,631
star
8

teachablemachine-community

Example code snippets and machine learning code for Teachable Machine
TypeScript
1,488
star
9

paper-signals

Build your own voice controlled object.
C++
742
star
10

aiexperiments-drum-machine

Thousands of everyday sounds, organized using machine learning.
JavaScript
736
star
11

Sprayscape

Sprayscape is a perfectly imperfect VR-ish camera. It is an open source Android app released on the Android Experiments platform.
Objective-C
568
star
12

teachable-machine-boilerplate

Boilerplate code for Teachable Machine
JavaScript
504
star
13

aiexperiments-giorgio-cam

Take a picture to make music with the computer.
JavaScript
481
star
14

aiexperiments-bird-sounds

Thousands of bird sounds visualized using machine learning.
JavaScript
474
star
15

ar-drawing-java

A simple AR drawing experiment build in Java using ARCore.
Java
415
star
16

inside-music

Inside Music lets you step inside of a song, seeing its individual pieces to give you a closer look at how music is made.
JavaScript
384
star
17

meter

Meter is a data-driven wallpaper that displays your battery, wireless signal and notifications
Java
362
star
18

digital-wellbeing-experiments-toolkit

Code components for starting your own Digital Wellbeing experiments
Kotlin
341
star
19

giantemoji

JavaScript
313
star
20

creatability-components

Web components for making creative tools more accessible.
TypeScript
287
star
21

morse-learn

A fun little web app to help you learn Morse code on Gboard.
JavaScript
284
star
22

aiexperiments-sound-maker

Make unusual new sounds with machine learning.
JavaScript
255
star
23

justaline-android

The first cross-platform collaborative AR app (for doodling)
Java
252
star
24

shadercam

Simple OpenGL Shaders with the camera2 apis in Android 5.0+
Java
240
star
25

posenet-sketchbook

PoseNet Sketchbook is a collection of open source, interactive web experiments designed to allude to the artistic possibilities of using PoseNet (running on tensorflow.js) to create a relationship between movement and machine.
JavaScript
207
star
26

arexperiments-portal-painter

Doodle new worlds onto your own, with Google ARCore.
C#
198
star
27

beat-blender

Blend beats using machine learning to create music in a fun new way.
JavaScript
190
star
28

coder-projects

Fun projects and sneakily educational things that can all be made with Coder and Rasberry Pi.
CSS
188
star
29

landmarker

Orientation, GPS, and Places enabled Android Experiment
Java
180
star
30

webvr-musicalforest

Join users from around the world in a musical forest. A WebVR Experiment.
JavaScript
164
star
31

balloon-pop

A multiplayer geospatial experience
C#
163
star
32

melody-mixer

A fun way to explore music using machine learning.
JavaScript
153
star
33

lipswap

Replace sections of a photo with your own recorded video.
Java
142
star
34

norman-ar

Decorate your world with AR animations.
C++
136
star
35

justaline-ios

The first cross-platform collaborative AR app (for doodling)
Swift
120
star
36

quickdraw-component

Use any of the of the 50 million Quick, Draw! doodles in your web-based project with one line of markup
JavaScript
104
star
37

creatability-seeing-music

Experience music visually.
JavaScript
101
star
38

semi-conductor

Semi-Conductor allows you to conduct a virtual orchestra using only your web browser & webcam.
JavaScript
100
star
39

tunnelvision

Distort your surroundings through a collection of transformative filters
Java
93
star
40

lines-of-play

Design domino art creations that interact with the real world using the ARCore Depth API.
C#
89
star
41

project-oasis

A voice controlled terrarium that recreates outside weather inside a box
JavaScript
89
star
42

access-mars

JavaScript
82
star
43

tiny-motion-trainer

Train and test machine learning models for your Arduino Nano 33 BLE Sense in the browser.
JavaScript
79
star
44

mystery-animal

A new spin on the classic 20-questions game.
JavaScript
79
star
45

mix-lab

MixLab is an experiment that makes it easier for anyone to create music, using simple voice commands.
TypeScript
71
star
46

sounds-in-space

An interactive audio experience, where the virtual sounds you hear change depending on your physical location.
C#
70
star
47

tf4micro-motion-kit

Arduino Sketch and a Web Bluetooth API for loading models and running inference on the Nano Sense 33 BLE device.
C++
66
star
48

obvi

A Polymer 3+ webcomponent / button for doing speech recognition
JavaScript
57
star
49

finger-user-interface

Control connected devices with the wave of a finger.
C
54
star
50

xyfi

Xyfi: BYO pointing device at a physical installation
JavaScript
48
star
51

morse-speak-demo

Text-to-Speech (TTS) demo web app that converts written text into spoken words via Morse code
JavaScript
44
star
52

aog-canvas-quiz

Canvas Quiz is a starter kit for developers to make custom, voice-enabled question-answer games for the Google Assistant.
JavaScript
40
star
53

air-snare

Play drums in the air.
Svelte
40
star
54

webvr-speaktogo

Explore the world with your voice.
JavaScript
34
star
55

norman-sketch-player

Embed Norman animated sketches on the web
JavaScript
29
star
56

pattern-radio

Code for patternradio.withgoogle.com
JavaScript
27
star
57

things-with-firebase-at-io2017

The Android Things projects used in the Experiments Tent at Google I/O 2017
Java
22
star
58

astrowand

Draw shapes in the sky to form constellations with TensorFlow and a microcontroller.
JavaScript
19
star
59

visual-alarm-clock

Get up in the morning by striking a pose to stop your alarm from ringing.
C++
10
star
60

dat.fire

JavaScript
6
star
61

.allstar

2
star
62

.github

1
star