AI-based Pilgrim counter

Xabier Crespo

Before going into the details of our latest project, let me put you into context. SC Robotics is based in a northwest region of Spain called Galicia. Many of you may have heard of Santiago de Compostela, the capital of Galicia. Compostela’s cathedral is among the most important pilgrimage destinations in Europe. Every year, thousands of people arrive here following the Camiño de Santiago (the Way of Saint James).

Santiago de Compostela cathedral – Photo by Jimmy Fotografía on Unsplash

Public administrations know how many pilgrims reach Compostela every day, they also know which of the routes they’ve followed (Original, Portuguese, French…). However, it’s not easy to track how many people have gone through each village, the peak times, and even more difficult, which path through each town they followed.

We have been working on a project to use Computer Vision and Artificial Intelligence to count how many people cross through any one of the individual sub-routes, gathering statistical information with two main goals:

  • Give more information to local governments so they can take decisions to improve pilgrims’ experience based on more accurate data
  • Highlight the value of this kind of tourism and its potential impact for local economies

Edge computing

The core of the project is a Google Coral Dev Board. This board costs around 150€ and it features an Edge TPU, an ASIC designed by Google to provide high-performance ML inference at the edge, that is, without depending on high power server infrastructure and Internet connectivity to run AI algorithms. The advantages of this approach are huge: reduced latency, reduced bandwidth, and something really important in this case (as we will be explaining later), better privacy.

The Coral is one of the most recent additions to the growing edge computing and edge AI industries, but in the recent years we’ve seen a lot of new hardware, software and conferences exploring this area. SC Robotics designs embedded systems, and AI can shape the future of our industry like it did for software products in the past 5 years.

The design process of an AI algorithm to run on the Edge TPU is similar to the one we would follow for any other application. We also use Tensorflow, but there are mainly two differences:

  • We use the TensorFlow Lite interpreter instead of the full-fledged version
  • The model has to be compiled specifically for this hardware. The compiler will optimize as many operations as possible to run on the ASIC, the rest of them will be executed by the CPU.
Workflow to create a TF model for a TPU (credits to Google)

The result of all this process, given we have gathered enough training data, would look like the following image:

SC Robotics’ pilgrims detection model in action

Privacy concerns

Privacy is very important for us. By no means we think recording images of the street should be something businesses can use without regulation, but thanks to recent advances in electronics, it’s now possible to develop this project without needing to send any information to the cloud. We take advantage of edge computing platforms, which allow us to do all the image processing inside the device and send just the results to the cloud. In our case we just send the number of Pilgrims that have been detected and other meta information like timestamps.

Since the images do not ever leave the TPU, the only way to access them is by logging in to the device. This is a more classical security problem, and to reduce the odds of being hacked we’ve set different security measurements such as VPN connection or passwordless logins.

Artificial Intelligence at SC Robotics

During the last years we’ve seen how Artificial Intelligence combined with the availability of powerful machines at a very low price has created many new business opportunities. We think Edge AI can also open many doors for us hardware creators, so we are investing a lot of resources in researching about AI techniques for embedded systems.

In future entries we will talk about other projects we are working on, some of them use even less powerful machines like Cortex M microcontrollers. Stay tuned for more updates!

Cover photo by Jorge Luis Ojeda Flota on Unsplash


Leave a Reply

More great articles

Debugging a Cortex-M microcontroller

When I started working with ARM microcontroles, I found myself lost among large amounts of information about how to program…

Read Story
on the edge

Using TF Lite for microcontrollers to monitor battery status

I am not going to be the first (or last) person to discuss the benefits associated with the current trend…

Read Story

Booting Linux on an Olimex board. Part 1: The Bootloaders

In this series of posts I'm going to explore in detail how to boot Linux in an Olimex A20-OLinuXino-LIME2 board.…

Read Story