Saw and Order: Tackling Illegal Logging with tinyML

Illegal logging is a global problem that continues to ravage forests and cause significant environmental and economic damage. A recent report by the United Nations estimates that illegal logging accounts for up to 30% of the global timber trade, causing economic losses of tens of billions of dollars annually. The scope of the problem is vast, with heavy illegal logging operations being conducted in many parts of the world, including Southeast Asia, Latin America, and Africa.

Local communities who rely on forests for their livelihoods suffer the most, as illegal logging often leads to deforestation, which destroys habitats and ecosystems, making it difficult for them to even survive in some cases. Governments also lose out on revenue as illegal logging operators avoid paying the taxes and fees that are associated with legitimate logging enterprises.

Legitimate businesses that rely on timber products suffer as well, as illegal logging operations flood the market with cheap, illegally sourced timber products. This not only harms their profits but also undermines their efforts to operate sustainably and responsibly.​​

Nordic Thingy:53 device deployed in the wild

Despite the best efforts of governments and non-governmental organizations to combat illegal logging, the problem persists. Clearly we are in desperate need of better, more effective solutions that can be deployed far and wide to address the vast scope of the problem. To be practical, any such solution would need to be cost-effective, highly scalable, and sufficiently ruggedized to survive extreme climates and inclement weather.

It seems that when the engineers at Zalmotek hear about a problem, they only see another use case for machine learning that has not been discovered yet. While considering this particular problem, they reasoned that most illegal logging takes place in remote areas. As such, certain sounds, like those made by a passing truck, would not normally be expected to be heard, and would be a strong indicator that an illegal operation was in process.

Keeping the guiding principles of cost-effectiveness, scalability, and ruggedization in mind, they set about to create a device, powered by an intelligent algorithm developed with Edge Impulse Studio, that can be placed throughout a forest and detect the sound of a running truck. A neural network classifier that has been trained to recognize the difference between normal forest sounds and the sound of a running truck would fit the bill nicely.

Exploring the training data in Edge Impulse Studio

To serve as the hardware platform, the powerful Nordic Thingy:53 multi-protocol IoT prototyping platform was selected. With a high performance 128 MHz Arm Cortex-M33 application core, 1 MB of flash storage, and 512 KB of RAM, the Thingy:53 is quite capable of running advanced machine learning algorithms on the edge. It also comes standard with a slew of sensors, including the microphone that is needed for this project.Multiple wireless communication protocols, including Bluetooth LE, Bluetooth mesh, Thread, and Zigbee are also available to communicate its findings to remote systems.

With the basic plan sketched out, Zalmotek needed to collect some sample audio clips to be used in training the model. Capturing a diverse dataset could be a bit of a chore, but fortunately, we have a wealth of data available to us via the Internet these days, and as it turns out, publicly available forest background sound and truck noise datasets already exist. These were downloaded and split into three second segments before uploading them to an Edge Impulse Studio project with the data acquisition tool.  Just over an hour of audio data was uploaded in total.

Next, the Thingy:53 was linked to the Edge Impulse Studio project — this makes it simple to deploy completed machine learning analysis pipelines to the board, and also enables it to be used for data collection when necessary. With the prerequisites out of the way, the team got to work designing the impulse. Using the slick web interface, a series of blocks were defined to specify how data flows through the processing pipeline, all the way from raw sensor data to a prediction from the model.

Defining an impulse for audio classification

The preprocessing steps of the impulse split the incoming sensor data into two second segments, then run a Mel-filterbank energy calculation to determine what the most relevant features are in the input data. This can help to eliminate uninformative components of the data, and as a result, reduce the amount of computational resources that are needed downstream. Finally, a neural network classifier was added to the impulse so that it could learn the difference between normal forest sounds, and the sound of a running truck.

The default training settings were retained, then the training process was kicked off with a button click. After a short time, the results were displayed, and it was found that the training classification accuracy had reached 100%. That is obviously an excellent result, as long as it is not the result of overfitting the model to the training data, that is. The Data Explorer tool showed good separation between the classes, which gives credibility to the 100% result, but Zalmotek wanted more confidence that the model was performing that well, so they used the more stringent model testing tool.

The model testing tool operates using solely data that was excluded from the training process. It revealed that an average classification accuracy of 99.47% had been achieved, so the model was ready for real-world use. By issuing a command with the Edge Impulse CLI, the model was deployed to the Thingy:53 and was ready for use. Running some tests with the completed device showed it to be working well, as would be expected from the test results.

Good separation between classes in the training data

By leveraging Edge Impulse and the Nordic Thingy:53, Zalmotek had no problem meeting their goal of developing a cost-effective, scalable, and ruggedized device. There is more work yet to be done, however.

The wireless communications capabilities of the Thingy:53 should be utilized, for example, to allow the device to communicate with remote systems, such that a network of these detectors could be installed in a forest and report to a single monitoring system. There is also room for detecting more types of suspicious sounds, like chainsaws. If you would like to be part of the solution to this problem, read up on the project documentation to get up to speed, then clone the public Edge Impulse Studio project to get a jumpstart on creating your own intelligent device.


Want to see Edge Impulse in action? Schedule a demo today.

Comments

Subscribe

Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

Subscribe to our newsletter