Arm Community
Arm Community
  • Site
  • User
  • Site
  • Search
  • User
  • Groups
    • Research Collaboration and Enablement
    • DesignStart
    • Education Hub
    • Innovation
    • Open Source Software and Platforms
  • Forums
    • AI and ML forum
    • Architectures and Processors forum
    • Arm Development Platforms forum
    • Arm Development Studio forum
    • Arm Virtual Hardware forum
    • Automotive forum
    • Compilers and Libraries forum
    • Graphics, Gaming, and VR forum
    • High Performance Computing (HPC) forum
    • Infrastructure Solutions forum
    • Internet of Things (IoT) forum
    • Keil forum
    • Morello Forum
    • Operating Systems forum
    • SoC Design and Simulation forum
    • 中文社区论区
  • Blogs
    • AI and ML blog
    • Announcements
    • Architectures and Processors blog
    • Automotive blog
    • Graphics, Gaming, and VR blog
    • High Performance Computing (HPC) blog
    • Infrastructure Solutions blog
    • Innovation blog
    • Internet of Things (IoT) blog
    • Operating Systems blog
    • Research Articles
    • SoC Design and Simulation blog
    • Tools, Software and IDEs blog
    • 中文社区博客
  • Support
    • Arm Support Services
    • Documentation
    • Downloads
    • Training
    • Arm Approved program
    • Arm Design Reviews
  • Community Help
  • More
  • Cancel
Arm Community blogs
Arm Community blogs
Architectures and Processors blog Teaching Scratchy to Walk with Neural Networks
  • Blogs
  • Mentions
  • Sub-Groups
  • Tags
  • Jump...
  • Cancel
More blogs in Arm Community blogs
  • AI and ML blog

  • Announcements

  • Architectures and Processors blog

  • Automotive blog

  • Embedded blog

  • Graphics, Gaming, and VR blog

  • High Performance Computing (HPC) blog

  • Infrastructure Solutions blog

  • Internet of Things (IoT) blog

  • Operating Systems blog

  • SoC Design and Simulation blog

  • Tools, Software and IDEs blog

Tell us what you think
Tags
  • Deep Learning
  • Neural Network
  • Artificial Intelligence (AI)
  • Machine Learning (ML)
  • stmicroelectronics
  • Cortex-M
  • Cortex-M4
Actions
  • RSS
  • More
  • Cancel
Related blog posts
Related forum threads

Teaching Scratchy to Walk with Neural Networks

Hellen Norman
Hellen Norman
February 7, 2018
3 minute read time.

What would you do with a Cortex-M4, a motor or two, some lego and a few cable ties? Well, if you’re Sebastian Förster, an embedded systems developer based in Germany, the answer is a small, four-legged robot that you’d teach to walk using neural networks.

The robot – otherwise known as Scratchy – has four servomotors for legs, an ultrasonic capsule for distance measurement and is controlled by an STM32F407 Discovery board.

So, how did Scratchy do? See for yourself, in Sebastian’s video…

Mark Connor, Arm’s Director of Deep Learning, interviewed Sebastian to find out what led him to create Scratchy, how he went about it and what he learned from the experience.

So, Sebastian, how did you get the idea for Scratchy?

“The thesis I did for my master’s degree was about the suitability of applying machine learning to smaller, Cortex-M processors – looking at concrete examples of neural networks and running performance tests on them. As part of that, I ported the FANN neural network library to the Cortex-M4 and was looking for something less academic and more fun to try it out on. I wanted to work on something tangible, so I decided on a robot. As you can see, I didn’t put a lot of work into it – just connected a few Lego bricks to some motors and an STM32F4 developer board with enough flash and SRAM. 

“The conclusion of my thesis – which is also clearly illustrated by my success with Scratchy – was that it is absolutely possible to run heavy machine learning algorithms on small, Cortex-M-based devices.”

Did you try to program the leg movements yourself?

“No, as far as I’m concerned, that’s what AI is for! Scratchy was constructed in a way that allowed me to train the forward and backward gaits independently, but I must admit that I was surprised that it worked without knee joints. I decided to use Q-learning because Deep Mind had had such success with their Atari Q-learner, and I was able to build on their work to I write the Q-learning agent. The FANN library is developed by others under LGPL; I simply ported it to the Cortex-M4."

How did you decide on the network topology?

“The topology was defined by the limits of the SRAM. The neural network could have been a lot bigger, but I wanted to train it directly on the Cortex-M4 and the additional variables use quite a bit of memory. In my opinion, it doesn’t make much difference whether you use two or three feed-forward layers, although I didn’t compare them directly – I wanted to stress the processor a bit!”

Input to Output

How easy was it to use current neural network research with a microcontroller?

“There are very few bare metal C (not CUDA) frameworks that will even fit into 512Kb flash and 256Kb SRAM. I was lucky to find FANN, but I did have to write a small file system so the library could load the saved network weights directly from flash.”

What would you say to anyone who’s interested in building and training their own robot?

“Whatever you do, don’t give up in your search for features and hyperparameters. If you can imagine something, you can create it!”

German speakers can read Sebastian’s original blog post on Wordpress

Anonymous
Architectures and Processors blog
  • How Arm is making it easier to build platforms that support Confidential Computing

    Mark Knight
    Mark Knight
    With new open-source patches for the Realm Management Extension (RME) now available, this blog explores latest developments and techniques for confidential computing on Arm.
    • April 28, 2023
  • Apache Arrow optimization on Arm

    Yibo Cai
    Yibo Cai
    This blog introduces Arm optimization practices with two solid examples from Apache Arrow project.
    • February 23, 2023
  • Optimizing TIFF image processing using AARCH64 (64-bit) Neon

    Ramin Zaghi
    Ramin Zaghi
    This guest blog shows how 64-bit Neon technology can be used to improve performance in image processing applications.
    • October 13, 2022