How to Develop AI on a Raspberry Pi With Google Colaboratory

Engineers, researchers, and makers don't need high-powered computing to develop machine learning applications. Google's open-source Colaboratory makes it easy to explore machine learning on a simple Raspberry Pi.

Last year Google partnered with the Raspberry Pi Foundation to survey users on what would be most helpful in bringing Google's artificial intelligence and machine learning tools to the Raspberry Pi. Now those efforts are paying off.

Thanks to Colaboratory – a new open-source project from Google – engineers, researchers, and makers can now build and run machine learning applications on a simple single-board computer. Google has officially opened up its machine learning and data science workflow – making learning about machine learning or data analytics as easy as using a notebook and a Raspberry Pi.

Google's Colaboratory is a research and education tool that can easily be shared via Google’s Chrome web browser. Goole initiated the project for the exploration of algorithmic based tool for machine learning development. Colaboratory’s infrastructure is based on an open-source coding project called Jupyter that allows for sharing documents that contain live code and other data. Jupyter was created to develop an open-source software, open standards, and service platform for interactive computing across dozens of programming languages.

Colaboratory is open notebook platform for exploring machine learning used by researchers, engineers, and makers. (image source: Google)

Machine learning researchers, engineers, and makers can easily share their work using the Jupyter notebooks and the desktop version of Chrome. Since it's all web-based, Colaboratory has low computing power overhead and the development environment is free. This method of storing and sharing computational based algorithms and experimental code removes a massive overhead of expensive computing engine processors and machines for machine learning development, research, and education initiatives.

Colaboratory Basics

Colaboratory is maintained through a virtual machine (VM) created by Google. Programming languages supported by kernels that are included within Project Jupyter include: Python, MicroPython, scilab, MATLAB, Numpy, Pandas, TensorFlow, and TCL.

There are several key points regarding Colaboratory:

  • It's great for machine learning, and data analysis researchers, engineers, and makers.
  • Users have access to the tool anywhere and anytime.
  • You can easily store notebooks on Google Drive.
  • No need to use pip|conda instructions to use analytical tools.
  • It has a great and thriving support community.
  • Python packages are supported within the notebook environment

All Colaboratory notebooks are stored in Google Drive. The computational based interactive documents can be shared with others via email just like any other Google documents.

The programming languages (kernels) are supported by Jupyter team members. The main core to Colaboratory – Jupyter based notes is the iPython kernel operation. (image source: Project Jupyter)

Exploring Machine Learning Concepts Using a Raspberry Pi

Building computation models in Colaboratory is quite intuitive and can be developed using a Raspberry Pi 3 B+. The Raspberry Pi 3 B+ has enough processing and wireless capabilities available to easily manage the machine learning applications built in Colaboratory: a 1.4GHz, 64-Bit quad-core ARM Cortex – A53 processor; dual-band wireless Local Area Network (LAN); and Bluetooth 4.2/ BLE features.

Implementing and testing Python code within Colaboratory is quite intuitive and fun to do. (image source: Don Wilcher)

There are two toolbars in Colaboratory that provide the functionality features of the notebook. The first toolbar consists of File, Edit, View, Insert, Runtime, Tools, and Help. The second toolbar located below the first one has Code, Text, Cell(up), and Cell(down). The Hello Colaboratory website has a variety of example interactive notebooks to explore programming concepts, functions, and features. New code and text notebooks can be created by selecting these keywords in the second toolbar.

Upon selection of the document type, a blank notebook will be created and display on your computer monitor’s screen. I created a simple Python counter using the “for-loop” instruction. Also, a method of displaying or printing a range of numbers from the Python counter using the “list” instruction was implemented within Colaboratory notebook.

With the support of the iPython kernel supporting a variety of programming languages, data plots can be implemented by importing the matplotlib library. Python or a supporting programming language complements the graphical plotting feature.

In addition, machine learning experiments can easily be implemented within Colaboratory. The online computational notebook reduces general/graphics processing unit (GPU) overhead tremendously. A Google VM provides the computing engine to support such mathematical intensive analysis. Thus, TensorFlow-based machine learning applications can be developed using the online computational notebook.

Data analysis and machine learning training results can be displayed easily within a Colaboratory notebook. (image source: Don Wilcher)


TensorFlow functionality is part of the machine learning tools available using Colaboratory. (image source: Google Colaboratory)

With such tools available to researchers, engineers, and makers, machine learning algorithms can easily be developed and used to implement AI applications in a variety of products and services. Additional information on Colaboratory can be obtained from the website. A first- time simple registration is required to have access to Colaboratory. Project Jupyter’s website provides materials and example code to use within Colaboratory. The full technical specs of the Raspberry Pi 3 B+ can be obtained from the Raspberry Pi Foundation's website.

Don is a passionate teacher of electronics technology and an electrical engineer with 26 years of industrial experience. He has worked on industrial robotics systems, automotive electronic modules and systems, and embedded wireless controls for small consumer appliances. He's currently developing 21st century educational products focusing on the Internet of Things for makers, engineers, technicians, and educators. He is also a Certified Electronics Technician with ETA International and a book author.

One of the major hassles of Deep Learning is the need to fully retrain the network on the server every time new data becomes available in order to preserve the previous knowledge. This is called "catastrophic forgetting," and it severely impairs the ability to develop a truly autonomous AI (artificial intelligence). This problem is solved by simply training on the fly — learning new objects without having to retrain on the old. Join Neurala’s Anatoly Gorshechnikov at ESC Boston, Wednesday, April 18, at 1 pm, where he will discuss how state-of-the-art accuracy, as well as real-time performance suitable for deployment of AI directly on the edge, moves AI out of the server room and into the hands of consumers, allowing for technology that mimics the human brain.

Comments (0)

Please log in or register to post comments.
  • Oldest First
  • Newest First
Loading Comments...