Eugene.Devhello@eugene.dev
All articles

Edge AI, Audio ML, YAMNet, Raspberry Pi, Conservation

EchoForest: Listening for Chainsaws in Ghana's Forests

The full story of EchoForest, an acoustic machine-learning system that runs on Raspberry Pi sensor nodes and alerts rangers to illegal logging, from a 2021 hackathon win to my final-year project.

Eugene Sewor

18 November 2026, 6 min read

Illegal logging is quiet in the way that matters most: it happens far from anyone who could stop it. Forest reserves are large, rangers are few, and by the time a felled tree is discovered on foot, the truck carrying it is long gone.

But logging is not acoustically quiet. A chainsaw is one of the loudest, most distinctive sounds a forest ever hears. That observation is the whole premise of EchoForest: put small listening devices in the forest, teach them to recognise the sounds of logging, and tell the people who can respond, while it is still happening.

Where it started: DAMS (2021)

EchoForest grew out of an earlier project called DAMS, an AI acoustic monitoring system for illegal-logging detection. DAMS, which I co-developed, won the Hacklab Foundation Hackathon in 2021. DAMS proved the core idea: a sound classifier built on transfer learning could tell chainsaw activity apart from ordinary forest noise, and a web platform could put those detections in front of field officers.

Hackathon projects are built to convince judges in a weekend. I wanted to rebuild the idea properly as my final-year BTech project at Ho Technical University, with real hardware at the edge, a proper device and alert model, and a portal rangers could actually use. That rebuild is EchoForest.

The system end to end

Five-stage diagram: sensor node listens, YAMNet classifies on-device, the label is interpreted, a Django REST API records devices, deployments and alerts, and a Next.js portal shows them to rangers.
EchoForest end to end. Classification happens on the Raspberry Pi, where the sound is recorded.

EchoForest has three parts, split across two repositories:

  1. The sensor node (echopi): a Raspberry Pi with a microphone, running the sound classifier and a small Django service.
  2. The API: devices, deployments and alerts, exposed over Django REST Framework with Swagger documentation.
  3. The control portal (echoforest): a Next.js dashboard for monitoring alerts, managing deployments on a map, and checking device health.

Teaching a model what a forest sounds like

Why YAMNet

Training an audio classifier from scratch needs a huge labelled dataset that doesn't exist for Ghanaian forests. Instead I started from YAMNet, a model Google trained on the AudioSet corpus to recognise hundreds of everyday sound events. YAMNet already knows a lot about what sound is. The job is to teach a new classification head what sounds matter here.

The fine-tuned model is exported to TensorFlow Lite, which brings it down to about 14 MB: small enough to run comfortably on a Raspberry Pi with no GPU and no connection to the cloud.

Why 27 classes and not 2

The most tempting design is a binary classifier: chainsaw or not chainsaw. It is also the design most likely to fail in the field. A forest is loud. Rain on leaves, wind, insects, a distant generator and a passing motorbike all carry energy in frequency bands that overlap with a saw. A model that only knows "chainsaw" and "everything else" learns a blurry boundary.

So the EchoForest model learns 27 classes, and most of them exist specifically to describe what is not a threat:

Group Classes
Logging Chainsaw, Axe, Handsaw, WoodChop, TreeFalling
Human presence Gunshot, VehicleEngine, Generator, Helicopter, Footsteps, Speaking, Whistling, Clapping
Weather and environment Rain, Wind, Thunderstorm, WaterDrops, Fire, Firework, Silence
Wildlife BirdChirping, Insect, Frog, Squirrel, WingFlaping, Lion, WolfHowl

Teaching the model what rain, wind and birds sound like is what keeps it from crying "chainsaw" all day. It also gives rangers richer context: a gunshot or vehicle engine near a reserve at night is worth knowing about even when no saw is running.

Inference on the device

The classifier runs as an endpoint on the Pi. Audio is loaded and resampled to 16 kHz mono (what YAMNet expects), padded with silence to a whole number of seconds, and passed through the TFLite interpreter, which is resized to fit each clip. The response carries the top class plus the full score vector, so downstream logic can apply its own confidence thresholds rather than trusting a single label.

waveform, sr = librosa.load(file_path, sr=16000)
if waveform.shape[0] % 16000 != 0:
    waveform = np.concatenate([waveform, np.zeros(16000 - waveform.shape[0] % 16000)])

model.resize_tensor_input(input_details[0]['index'], (1, len(waveform)))
model.allocate_tensors()
model.set_tensor(input_details[0]['index'], waveform[None].astype('float32'))
model.invoke()

class_scores = model.get_tensor(output_details[0]['index'])
predicted_class = classes[class_scores.argmax()]

Why classify at the edge? Forest reserves have weak or no connectivity. Streaming raw audio to a server would need bandwidth and power that a remote node simply doesn't have. Classifying where the sound is recorded means the network only has to carry small JSON messages about what was heard.

Modelling the real world: devices, deployments, alerts

A detection is only useful if someone knows where it came from and who to call. The backend models three things:

  • Device: a physical node, identified by MAC address, with its GPS position, status, power level, temperature, uptime and IP address. Battery and heat matter a lot for hardware left in a tropical forest.
  • Deployment: a device placed in a named forest reserve, with its coordinates and the contact number of the ranger or officer responsible.
  • Alert: a report tied to a device and a deployment, with a status of Pending, Resolved or False alarm.

That last status is deliberate. Every false alarm a ranger marks becomes a labelled example of a sound the model got wrong, which is exactly the data needed to retrain it. The workflow closes the loop between the field and the model.

The API is token-authenticated and fully documented with Swagger and ReDoc, so the portal and future field apps share one contract.

The control portal

EchoForest alerts dashboard showing total, active and resolved alert counts, a bar chart of the top regions by alerts, a seven-day alert trend, and a table of recent alerts with a Manage button.
The alerts dashboard, shown with demo data. Rangers see active versus resolved alerts, which regions are hottest, how activity is trending, and can act on each alert.

The portal is built with Next.js, Tailwind CSS, Recharts and React-Leaflet. It has four areas:

  • Overview: device count, reserves covered and alert trends at a glance.
  • Alerts: totals, a breakdown by region, a seven-day trend and a table of recent alerts to manage.
  • Deploy: every deployed device on a map of Ghana, searchable by device or alert number, with a form to deploy a new node.
  • Devices: health of each node in the field.

The design goal was that a ranger glancing at a phone should be able to answer three questions in seconds: Is something happening? Where? Who is closest?

What I learned

The hard part of field ML is not the model. Fine-tuning YAMNet is a well-trodden path. The hard questions are about the world around it: what happens when the battery runs low, how to tell a ranger where a node is, how to stop false alarms eroding trust, and how to get feedback from the field back into training.

Negative classes are features. Most of the 27 classes exist to say "this is fine." That is where robustness comes from.

Design the data model around the response, not the detection. Contact numbers on deployments and a false-alarm status on alerts did more for usefulness than another point of accuracy would have.

Where EchoForest goes next

EchoForest is the project I care most about, and I intend to build it into a product. The roadmap from here:

  • Field data collection in Ghanaian reserves, to retrain on local recordings rather than general datasets.
  • Wireless sensor networks between nodes, so a detection can be passed hop-by-hop to a node that has connectivity, and nearby nodes can roughly triangulate a sound.
  • Low-power hardware and solar, because a node that needs a battery swap every week will not survive in a real reserve.
  • SMS and push alerts to the deployment's contact number, for rangers who aren't watching a dashboard.
  • Evaluation in the field: precision and recall measured on real forest audio, which is the only number that matters for this problem.

It's also the reason I'm studying intelligent computing systems now. The next version of EchoForest needs better models, better embedded engineering and better evaluation, and that is exactly what I'm working on.

The portal and the Raspberry Pi service are both on GitHub.