Conservation on the Edge — Tiny Machine Learning for Big Animals
The incredible potential of TinyML in the world of conservation.
Sensors and software are the basis of many of the biggest conservation projects on our planet, and they are forever improving. Now more than ever big satellites, big data sets, and big computers have enabled citizens worldwide to use powerful tools in the cloud. With all of this power at their fingertips, the interpretation of natural world datasets has been vastly sped up by machine learning (ML), but all of that happens after the data is collected. When scientists are home from the field and begin excavating meaning from their digital sample collections, that’s when ML is typically applied. The impact of the newest frontier in ML is bigger than anything that’s come before, because it’s tiny. This article explores the benefits of an up-and-coming application of ML in conservation, TinyML.
The Challenge
Within the broad field of machine learning there are a few universal challenges: internet bandwidth is finite, power is expensive, and time is important. Add to this the complexity of data collection in the wild, where internet bandwidth is minuscule, power is limited to the life of batteries, and the time available to act on the data can be critically short.
Let’s say your data collection device listens to jungle sounds and uploads them to the cloud via a tiny satellite modem all day long. Your ML model running remotely determines that there is suspicious activity nearby, there may be poachers lurking! Networking devices like the satellite modem are power hungry, and constantly streaming data to the cloud wears down batteries quickly. The upload will also take time, since bandwidth limits the upload speed. The cloud based model runs its calculations and only then can it finally take action and send an automated text message to ‘Ranger Rick’ to drive out to the site and catch the poachers red handed. All of this means that the effectiveness of this neat ML model is limited by three major factors, power consumption, bandwidth bottlenecks, and latency. There must be another way!
Enter TinyML
Machine Learning often brings to mind visions of artificially intelligent software programs performing thought processes like humans. What it doesn’t usually evoke are images of the hardware those thoughts are processed on. As processing power increases seemingly inversely to the shrinking of hardware, impressive computing power now exists on small microcontrollers. This makes the application of ML to remote field projects realistic. Lightweight models can run continuously on microcontrollers embedded in situ, solving the three major challenges of running ML models remotely.
A signal, transmitted to a network, creates a connection to that network called an entry point. Thermal sensors, acoustic microphones, and video cameras are all examples of fieldwork devices that can be outfitted with a network connection. Anything that takes a signal and uploads it to a network is termed an ‘edge device.’ The data collected by these edge devices have traditionally provided the intake data for machine learning models running on remote servers. It’s what these models output that is the goal of machine learning, the action item at the end of a million little 1’s and 0’s.
Processed on microcontrollers, like an Arduino or Raspberry Pi, a TinyML model is fed data direct from the sensors and outputs a concise interpretation. Only this output is uploaded to the cloud, or transmitted by radio in Ranger Rick’s case, saving wattage by sparingly running the network device, rather than constantly streaming data. In one use case, this single change increased battery life from weeks to years. It also avoids living at the mercy of bandwidth limitations, decreasing time it takes to get into action. If this wasn’t an article about conservation, a fitting colloquialism about TinyML might be that it ‘kills 2 birds with 1 stone,’ but let’s just say it solves some problems.
Here Be Giants — Anti-poaching in the Congo Rainforest
A demand for ivory on the black market sustains ongoing poaching of rainforest elephants. Their tusks are an enticing source of income for people without many other job opportunities in the tough economies of Congo Basin countries, and the park rangers have impossibly large zones to monitor for illegal activity. Hiding in the foliage, the forest giants are invisible to overhead monitoring by drone. Machine learning may be a key player in protecting the elusive forest elephant, using sound, camera traps and movement tracking. However time is of the essence, poachers can sneak in quickly.
The ‘ElephantEdge Tracker,’ is a custom collar which contains several embedded devices, including a microphone and an accelerometer, to help monitor and protect this threatened species. Two ML models, developed by ElephantAI, source their input data from the collar, but the models themselves are run remotely from this data stream. One final model, in the form of TinyML, runs on the collar itself.
- The first uses microphone data and a trained Convolutional Neural Network (CNN) model to detect the presence of humans in an area, classifying sounds as ‘human,’ ‘elephant,’ or ‘other.’ A ‘human’ signal will alert rangers by long range radio if there are people where they should not be.
- The second model uses accelerometer data for elephant activity monitoring. This Fully Connected Neural Network takes in time series data and outputs classifications of ‘Standing,’ ‘Walking,’ or ‘other,’ helping rangers monitor the elephant’s behaviors.
3. Now we get into the cool future tech part of the discussion. The third model runs in situ. Still a prototype, this model runs in the collar itself. Developed by Sara Olsson in Sweden, it combines TinyML and and an Internet of Things (IoT) dashboard to monitor camera traps and watering holes. Here’s how it works.
- An Elephant Edge collar comes into the network zone of a camera trap at a watering hole.
- This signals the camera trap to fire.
- A TinyML model running in collar reviews the recently triggered camera trap image of the nearby elephant, and classifies it as “Standing, Walking, or other.” This much smaller piece of data can be uploaded to the cloud using significantly less resources and in real time.
If implemented, this kind of innovation is what will allow the collars to run for up to 8 years before the battery is depleted and for behaviors to be monitored in real time.
So what are some ways you can get started with TinyML for conservation, and where can you apply them?
Your Backyard — Prototype your first lightweight ML Framework
On tiny hardware, storage is at a premium. The frameworks for ML are often bloated with unused packages and extra libraries. On our desktop computers or cloud connected storage, that’s not problem, but in TinyML projects, a framework loaded with algorithms will just slow everything down. That’s where Tensorflow Lite comes in. With a subcategory developed specifically for microcontrollers, Google’s Tensorflow Lite framework was one of the first light weight frameworks in-use on TinyML projects.
With this framework, you can run ML models on edge devices, like your own backyard camera trap. A camera trap is simply a camera, triggered to capture an image, the typical trigger is when an IR sensor detects movement. These images often number in the thousands so processing and classifying them is regularly tasked to ML. As an introductory step into TinyML for conservation, here’s a tutorial to learn a lightweight framework and apply it to backyard animal tagging. Combining your hardware and software skills to see what lurks in your backyard sounds like a good weekend project to me!
Recognizing Roars — Train Your own TinyML model
Limited to a microcontroller, it’s still possible to train a model using a surprisingly small amount of RAM. Instead of using the Tensorflow Lite Framework from the backyard example, another option is the new Edge Impulse EON. In this tutorial, build a tiny model trained on lion roars which is the kind of work a conservationist would use to study lion behavior in the wild.
Conclusion
At the intersection of machine learning and embedded IoT devices, TinyML has found its way into a tracking collar for elephants, a microphone recording roars on the African Savannah, and the homemade camera traps of curious and capable backyard citizen scientists. Where will you use it?
Try your hand at conservation modeling! Here are some datasets and resources:
TinyML Book — O’Reilly