DOI : 10.5281/zenodo.22247138
- Open Access

- Authors : Soham Shah
- Paper ID : IJERTV15IS080524
- Volume & Issue : Volume 15, Issue 08 , August – 2026
- Published (First Online): 02-09-2026
- ISSN (Online) : 2278-0181
- Publisher Name : IJERT
- License:
This work is licensed under a Creative Commons Attribution 4.0 International License
Preventing Illegal Logging using Machine Learning
Soham Shah
Round Rock High School
Round Rock, USA
Abstract – Illegal logging is the unregulated harvesting of tim- ber and is a major driver of global deforestation and biodiversity loss. The exploitation of timber resources through illegal logging accounts for up to 30% of the global timber trade. This activity frequently occurs in remote forest regions where monitoring infrastructure, funding, and enforcement resources are limited. As a result, the lack of effective early detection and prevention systems makes it extremely difcult to monitor and respond to illegal logging activities in real time. This project investigates whether machine learning models can detect chainsaw activity through acoustic monitoring as a scalable early-warning system against illegal logging with a recall of more than 90%. I hypothe- sized that a machine learning model, mounted on an economical sensor, could distinguish chainsaw sounds from environmental sounds in audio clips. The goal was to create an audio-based screening tool with a 90 percent recall to support monitoring efforts. The following steps were used to develop the system:
1. Audio clips were obtained from a publicly available Hugging
Face dataset and labeled as chainsaw or environment. 2. Acoustic features, including Mel-Frequency Cepstral Coefcients(MFCCs) and spectral features, were extracted from each clip. 3. The dataset was split into training and test sets, and multiple classiers were trained and compared using cross-validation. 4. A confusion matrix was developed to visualize results and determine how accurately the model is able to detect chainsaws along with environmental sounds. After evaluating three models, MLP achieved the highest performance with a recall score of 91%. 5. The model was deployed on hardware to demonstrate real-time detection of illegal logging. In general, this work demonstrates that machine learning can be used to detect chainsaw activity associated with illegal logging.
-
Introduction
Problem Statement: Illegal logging is the violation of international laws by harvesting, transporting, or selling tim- ber. Despite international regulations, illegal timber accounts for up to 30% of global trade, largely due to the difculty of monitoring remote forest regions in real time. It remains a critical global issue serving as one of the main drivers of deforestation and carbon emissions [1]. 12-20% of greenhouse gas emissions occur through forest clearance and degradation, of which illegal logging is a signicant contributor [2]. Illegal logging also fuels deforestation which endangers the habitats of 80% of the worlds land-based biodiversity with many ecosystems requiring decades to recover [3]. Illegal logging often targets preserved forests, which are generally restricted by larger companies containing permits [4]. These forests embody larger, older trees that require years to grow back to their original forms and thereby release more carbon.
Fig. 1: Example of chainsaw use for deforestation and timber exploitation
Illegal logging also has economical impacts largely due to distorted market prices. These inltrations cause the US to lose over 460 million dollars each year by dropping global timber prices by up to 16% [5]. The US serves as a major importer of timber, some of which are derived illegally, disrupting global markets and facilitating job loss in various factories.
Prevention Challenges: The primary driver of illegal log- ging is the economic value of exploited timber. Illegally-driven activities such as the harvesting of timber is more competitive in markets, as they can be sold for signicantly lower prices [6]. This advantage motivates individuals to engage in illegal logging especially where resources are sparse and preventative abilities are limited. The unfortunate reality behind illegal logging is that many of the worlds most valuable forests lie in isolated and remote areas. Due to these areas remaining inaccessible, illegal loggers are able to continuously operate knowing the chances of being caught are low.
Legally, efforts have been made for the prevention of illegal logging effects. The CBP works with the US and international governmental agencies to enforce environmental and natural resource trade laws [7]. Physical inspections are made at all ports of entry in the US, verifying legality of timber resources. Unlawful exploitation of timber, however, is not continuously monitorable when illegal activity is non-distinctive by the exporting country. Lack of prevention abilities, continuous regulation, and robust monitoring leads to unidentiable in-
dications of illegal timber defying international agencies and distorting market prices.
Problem Scale Illegal logging is strongly linked to chain- saw activity(Figure 1), which is the main use for harvesting wood. Domestic timber production, often through the use of chainsaw milling, ranges from 30-40% in Ghana, DRC and Uganda to 50% in Cameron and Peru and almost 100% in Liberia [8]. The vastness of this activity on top of the lack of knowledge towards prevention leads to the growth of illegal logging without control. The devastating impacts that associate with illegal logging continue to create the need for automated detection.
Existing Solutions: There is some existing research on this issue which tackles the idea of chainsaw audio detection. A paper from the IOP Conference series explores chainsaw location detection based on the traveling of sound waves: This solution detects chainsaw sounds traveling the air and soil using a microphone and geophone [9]. Since sound is travelled faster in the soil, they were able to nd distance based on the difference in time arrival. Alongside the distance, it nds direction by rotating the microphone for maximum magnitude. The distance and direction measurements are then used for tracking the specic location of the chainsaw sound. Our approach is very different which extracts audio features from the sound to detect the logging using machine learning. Another method of preventing illegal logging is found in an Amazon Conservation Project. This project installed recording devices and deployed an existing acoustic machine learning model in the eld to detect chainsaw sounds manually via an application [10]. This process usually happens within seconds and experienced park rangers conrm chainsaws followed by the use of drone and satellite images to record evidence of the illegal activity. Our work focuses on automating the entire process, from receiving the sound signature via a microphone to detection occurring within the controller followed by a text message. This ensures a real-time monitoring system with automated alerting to allow preventative measurements to take
place in identied high-risk areas.
Proposed Solution My project focuses on automated de- tection using sound data. It extracts features such as Mel- Frequency Cepstral Coefcients (MFCCs) and spectral char- acteristics to classify and detect chainsaws based on their distinctive acoustic signatures. The average decibel levels of a chainsaw is 106-120, signicantly higher than the normal human can tolerate [11]. This makes chainsaw sounds dis- tinguishable through machine learning models with the use of extracted acoustic audio features. Audio data contains two main types of features: physical and perceptual. Physical fea- tures, such as cepstral coefcients, fundamental frequencies, and spectrums, create a physical display of the sound in a way where numerical features can be extracted and read by mdels [12]. Perceptual features, such as loudness, pitch and timbre, allow models to perceive the sound similar to how humans do. We can utilize these features to classify audio signatures and build a model to detect chainsaw sounds and prevent illegal logging.
TABLE I: Sample Extracted Audio Features
Class RMSE Centroid Bandwidth Rolloff ZCR
(Hz) (Hz) (Hz) Environment 0.036 4312 2049 6265 0.351
Environment 0.010 3676 1491 5118 0.379
Chainsaw 0.002 1419 1366 2985 0.081
Environment 0.001 2695 1506 4507 0.265
Environment 0.010 3383 1191 4423 0.351
-
Methodology
Software and Tools:
We used open source tools and libraries to build the model. Below is the list of software and tools used for this project.
-
Publicly available Hugging Face dataset for labeled audio clips
-
Google Colab for model training and evaluation
-
Python libraries including NumPy
-
Pandas for data preprocessing
-
Edge Impulse for embedded ML integration
We followed the process shown in gure 2 to build, train, test the model and deploy it on a hardware.
Data Collection:
This dataset was extracted from the Hugging Face library [13], a publicly available dataset that was utilized for the data collection. This dataset include 14K Chainsaw and 20K Environment sound les. Each le consisted of a 3 second audio clip of the respective sound.
Data Processing: Each le was converted into numerical features using various acoustic sound signatures. The main audio feature that was used was Mel-Frequency Cepstral Coef- cients(MFCCs) which divides the audio les into tiny pieces, creating a short-term power spectrum of the sound. It perceives sound similar to those of humans and applies loudness, vocal tracts and timbre for models to do the same. ML models are not built to understand sound the way humans do, but using these audio features they are able to conduct algorithms and form predictions, a method providing the foundation for this project. Two sample les are shown in Figure 3 in an MFCC feature comparison. In this project we extracted 20 different MFCC features particularly because each MFCC coefcient captures unique parts of a sound. The graph showcases clear differences between the two sample les and provided insights into how unique a chainsaw sound truly is.
Table I shows a sample of ve les, of which one is a chainsaw sound and the other four are environmental noises. The differences between these two types of data are clearly shown as per the table. First, the Spectral Centroid of the chainsaw sound in the sample data is lower, which indicates a deeper or louder sound. The Zero Crossing Rate (ZCR) is also signicantly lower for the chainsaw sound in this sample, meaning it crosses the horizontal axis less frequently and is an indication of a smoother sound. Such trends are key indications that machine learning models can learn and this will aid in the classication process. And this will lead to models achieving higher accuracy
Dataset Splitting:
Fig. 2: Procedure of Chainsaw Audio Detection
Fig. 3: MFCC Feature Comparison
The next step was to divide the data into training and test sets to ensure the model does not become too reliant on original data. This is a common machine learning problem known as overtting, where the models performance is poor on unseen data. By dividing our data into training and test sets, it will ensure there is sufcient data for the model to identify patterns while leaving a subset portion to generalize performance on unseen data.
Model Selection & Hyper-Parameter Tuning:
Experiments were conducted with three machine learning models which are architecturally different from each other. KNN, which recognized patterns in data using the distance metric, tree based emsemble model (Random Forest) and neural network based model that is appropriate for capturing non-liner relationships in the data (MLP). In each case, hyper- parameter tuning was conducted and results were reported using 5-fold cross-validation. The set of hyper-parameters resulting in the highest validation performance (accuracy) were selected for quizzing the test dataset.
K-Nearest Neighbors(KNN) was the rst model trained. It uses the distance metric in the feature space to make a prediction. For a new query point, the algorithm searches for the k nearest neighbors and assigns the majority class [14]. This model takes up large amounts of memory, as it works to memorize the whole dataset to identify known values. Our dataset contained over 30,000 audio clips which made KNN highly memory intensive. The hyper-parameter K which controlled the number of neighbors to consult before making a prediction was tuned between 1 and 20.
Random Forest was the second model trained and involved the use of decision trees. Each tree is asked a question such as, Is the frequency greater than 2000 Hz? The questions make up a owchart with the depth of the chart relying on the user input [15]. A higher depth can lead to more complex relationships within the algorithm, yet is prone to overtting
where the model ends up memorizing answers rather than forming predictions. Our hyper-parameters consisted of trees and depths with each tree being asked a certain number of questions based on its depth and the nal prediction relying on the answers provided from the decision trees. The hyper- parameter that controls the number of trees was tuned between 10 and 80. The hyper-parameter that controls the depth of the tree was tuned between 1 to 7.
Multilayer Perceptron(MLP) The nal model that we used in the training phase was the Multilayer Perceptron(MLP) model which serves like a tiny brain. It is an interconnected node of neurons which are utilized for decision processing. Each neuron will contain three layers, an input, hidden and output [16]. The input layer takes in the sound data which is then passed through the hidden layer. The output layer receives the values from the hidden layer and passes it on to the next neuron. The hidden layer consists of a mathematical, nonlinear activation function which are applied to the neurons weighted input sum. This determines whether the neuron should be activated. The neural network architecture consisted of three hidden layers with 200, 100, and 50 neurons respectively. The hyper-parameters that were initialized for the MLP model were epochs and learning. The hyper-parameter that controls the number of echos was tuned between 20 and 200. The hyper- parameter that controls the learning rate was tuned between 0.0001 to 0.05.
Testing of Best Model:
The MLP model received the highest accuracy and carries a simple architecture and math function making it easily deployable on hardware. After the training and validation process, the MLP model was tested with performance metrics being measured through a confusion matrix, and it was chosen to deploy on hardware since it was a light weight model with highest accuracy.
Model Deployment on Hardware:
The model was then deployed on a hardware device using Arduino IDE and Edge Impulse (Figure 4). The components of this model include an ESP32 controller, connecting wires, and LEDs to serve as visual indications (Figure 5). Edge Impulse was used to implement an MLP-based classication model built on MFCC feature extraction, with hyperparameter tuning to ensure optimal performance. The Arduino executed the on- device model and controlled the systems real-time hardware responses. Using EdgeImpulse for training and Arduino for programming the model, we were able to connect the models predictions with visual indications using LEDs. The LED would turn green for an environmental sound and red for a chainsaw. When a chainsaw is detected at hgh risk, a text message is sent to replicate a real-time monitoring system. The total hardware cost of the deployed system was approximately
$52, demonstrating cost-effectiveness and scalability for large- scale deployment. Below components were used to build the hardware:
Hardware materials:
-
ESP32 micro-controller to on-device model deployment
-
RGB LEDs – indicators of Chainsaw
Fig. 4: Prototype of hardware device
Fig. 5: Hardware Infographics
-
LED indicators for visual classication output
-
Jumper wires – connects microcontroller to LEDs
-
Power bank – enables a low-power solution
-
Multimeter – measures electrical properties like voltage, current and resistance
-
Soldering Kit – used to attach microcontroller and LEDs
-
-
Results & Discussion
Results
Three machine learning models were evaluated: K-Nearest Neighbors (KNN), Random Forest, and Multilayer Perceptron (MLP). After continuous trials with consistent tweaking of
Fig. 6: KNN – Accuracy vs k-values:best validation accuracy of 83%
TABLE II: KNN Accuracy per Trial
No. of Neighbors (k)
Accuracy
Precision
Recall
1
0.83
0.83
0.83
2
0.814
0.814
0.814
3
0.8379588944
0.8379588944
0.8379588944
4
0.8294826364
0.8294826364
0.8294826364
5
0.8387526577
0.8387526577
0.8387526577
6
0.8307583274
0.8307583274
0.8307583274
7
0.8368249468
0.8368249468
0.8368249468
8
0.8314103473
0.8314103473
0.8314103473
9
0.8354075124
0.8354075124
0.8354075124
10
0.8307583274
0.8307583274
0.8307583274
11
0.8326009922
0.8326009922
0.8326009922
12
0.8296810773
0.8296810773
0.8296810773
13
0.8310701630
0.8310701630
0.8310701630
14
0.8280935507
0.8280935507
0.8280935507
15
0.8307866761
0.8307866761
0.8307866761
16
0.8271580439
0.8271580439
0.8271580439
17
0.8285187810
0.8285187810
0.8285187810
18
0.8261658398
0.8261658398
0.8261658398
19
0.8267328136
0.8267328136
0.8267328136
20
0.8248051028
0.8248051028
0.8248051028
hyper-parameters, the models proved well-dened accuracies. KNN achieved an 83% accuracy(Figure 6), Random Forest achieved a 90% accuracy(Figure 7), and MLP achieved a 91% accuracy(Figure 8).
A confusion matrix was developed using test data set. Per confusion matrix, KNN achieved 86% recall (Figure 9), Random Forest achieved 92% recall (Figure 10), and MLP achieved 94% recall (Figure 11). MLP achieved the highest recall score when detecting chainsaw sound in both the train- ing and testing sets and was chosen to be deployed on the hardware due to its optimal performance.
Discussion
Depth
10 Trees
20 Trees
30 Trees
40 Trees
1
0.859844082
0.903671155
0.903897944
0.901261516
2
0.873593196
0.902480510
0.901289865
0.902763997
3
0.890942593
0.902820694
0.902905740
0.903529411
4
0.893437278
0.900496102
0.902763997
0.903614457
5
0.898880226
0.902877391
0.901828490
0.901658398
6
0.900949681
0.901063075
0.903274273
0.904096385
7
0.904323175
0.903812898
0.902905740
0.901771793
TABLE III: Random Forest Accuracy per Trial
Fig. 7: Random Forest – Accuracy vs number of trees for different depth (best validation accuracy of 90%)
Fig. 8: MLP – Accuracy v/s epochs for different learning rates (best validation accuracy of 91%)
We conducted in-depth analysis of each model during the project.
K-Nearest Neighbor(KNN)
KNN model was the rst to be trained with 20 different trials. As shown in Figure 6 & Table II, the KNN algo- rithm performs best with an odd-number of neighbors. This is because they resolve tiebreaks that are prone to occur with an even number of neighbors, especially when k is lower. However, an alternative trend indicated in this models´ performance is that the number of neighbors start to become irrelevant and performance plateaued after a certain amount of data points are checked. In KNNs case, the closer data points are typically the most valuable in shaping the prediction. After 5 neighbors were consulted, they started to become irrelevant
TABLE IV: MLP Accuracy per Trial
LR
20
40
60
80
100
120
140
160
180
200
0.05
0.71
0.77
0.64
0.58
0.58
0.58
0.70
0.69
0.70
0.58
0.01
0.88
0.88
0.83
0.90
0.80
0.84
0.89
0.89
0.88
0.89
0.005
0.85
0.88
0.89
0.89
0.91
0.91
0.83
0.83
0.90
0.83
0.001
0.87
0.89
0.88
0.89
0.89
0.89
0.88
0.90
0.88
0.90
0.0005
0.86
0.88
0.85
0.88
0.86
0.84
0.89
0.86
0.88
0.87
0.0001
0.80
0.82
0.87
0.87
0.88
0.88
0.83
0.87
0.86
0.84
Fig. 9: Confusion Matrix of KNN to evaluate performance
which s why we stopped running trials after 20 neighbors.
Random Forest
Random Forest was trained next where we tried different numbers of trees and depths, which were the hyper-parameters. As shown in Figure 7 & Table III, it tends to show better performance with more depth as shallow tree under-ts data. At the same time, beyond 20 decision trees is also not recommended due to vast memory storage. Although, we still tried more than 40 trees to see if performance changes. After around 20 trees were used, the model seemed to develop a clear answer and didnt require the use of more decision trees. Similarly, we observed that increasing tree depth improved accuracy until around a depth of 4, after which additional depth provided little to no improvement in prediction accuracy.
Multilayer Perceptron MLP was the last model trained where we tried different learning rate and epoch values. Epochs dene how many times the model reads the training dataset and the learning rates indicate how fast or slow the weights are updated. As shown in Figure 8 & Table IV, at high learning rate of 0.05, the model was unstable and the accuracy was signicantly lower. The most optimal learning rate was
0.005 that shows a good tradeoff between aggressive and slow learning rate. Also, results suggested that 100-120 Epochs is ideal for model performance and beyond that performance has plateaued. This is because a higher epochs can lead to overtting, where the model memorizes the dataset and a lower epochs, can lead to undertting where the model hasnt received enough information. Ultimately, the MLP model did perform better than the other two models in both training and testing sets and was deployed on a hardware device.
This hardware device is not only accurate, but a cost effective and power efcient method of chainsaw detection. As
Fig. 10: Confusion Matrix of Random Forest to evaluate performance
Fig. 11: Confusion Matrix of MLP to evaluate performance
mentioned earlier, all of the items used remained economical, with a working model costing around 52 dollars (Figure 12). The ESP32 model uses a maximum of 1.725 Wh per hour with economical power banks being able to yield 60-65 hours of power, depending on efciency.
Limitations:
When deployed across different regions, the model may encounter environmental conditionssuch as varying weather
Fig. 12: Hardware Cost
patterns and climatesthat were not represented in its original training data. To address this limitation, our project is designed to remain publicly accessible, enabling users to upload their own localized datasets and retrain or adapt the machine learn- ing model for chainsaw detection in their specic geographic regions.
-
Conclusion
Our engineering goal was to build an accurate model with a 90+% accuracy score that can be deployed on a hardware device in an economical and power efcient way. Not only were we able to accomplish this, but we were able to provide the foundation for AI usage to prevent environmental threats. This project explores the applicable side of machine learning allowing for preventative measures to take place.
Chainsaw audio detection can be applied to the real world through the integration of the rapidly advancing system of machine learning. Alerting park rangers of illegal activity in forests allows action to be taken and patterns to be identied. Environmental value is preserved, ecological habitats are saved and economical loss is condensed. The integration of machine learning for this project advances the robustness of chainsaw detection, sending accurate results within milliseconds.
Future Research: The next steps for the hardware device is to increase the range of detection the model can achieve. There exists some possible solutions of increasing WiFi ranges of ESP32 controllers through the attachment of an external antenna, yet that raises the question of how to receive WiFi in the middle of a forest. Wireless Sensor Networks can be used for this project where a certain number of minor devices are connected in a self-organizing system [17].
A solar-powered power bank is to be used for power conser- vation methods. A device running on solar power is something unique as far as chainsaw detection has seen. This enables a method that is sustainable and can potentially become a self working system. Economical solar powered banks range within 15-20 dollars on vendors such as Amazon, Walmart, etc. with the ability to yield around 65 hours depending on the efciency of the model. A self-sustaining system requires the use of larger solar panels which involve a greater investment,
yet an economical approach will be further researched in the upcoming steps.
Following the procedure of handling the engineering gaps, forest deployment is the next step. There are several different deforestation conservation groups where the idea of Chainsaw Audio Detection can be proposed. TreeFolks [18] is a program in Austin, Texas which works to restore deforestation loss. The Texas A&M Forest Service [19] investigates timber theft, fraud and illegal logging and is a good option for providing an automated system to handle time investment. The Amazon Conservation Association [20] is a nonprot organization which works to conserve the biodiversity of the Amazon basin with new scientic understanding and sustainable approaches. They use satellite imagery to identify illegal logging and an automated detection tool can be a good support for their ongoing research.
In conclusion, this research demonstrates that machine learning-driven acoustic analysis is not only technically feasi- ble but also practically scalable for combating illegal logging. By tackling a real-world environmental issue with effec- tive AI integration, this work contributes a proactive, cost- effective tool to empower further development. With continued validation, collaboration, and eld testing, Chainsaw Audio Detection can evolve from a prototype system into a globally deployable solution that supports sustainable forest manage- ment and strengthens the protection of vulnerable ecosystems.
Acknowledgment
I would like to thank my mentor, Dr. Sindhu for her consistent support both on call and behind the scenes. I truly admire all the work and dedication that she has put in for this project.
References
-
D. Smith, C. Hanson, M. Koehler, J. Molland, and L. Woodberry, Logging is the leading driver of carbon emissions from us forests, Truthout, Apr. 2019.
-
S. M. Piabuo, P. A. Minang, C. J. Tieguhong, D. Foundjem-Tita, and
F. Nghobuoche, Illegal logging, governance effectiveness and carbon dioxide emission in the timber-producing countries of congo basin and asia, Environment, Development and Sustainability, vol. 23, no. 10,
pp. 1417614196, 2021.
-
B. Kurylo, The devastating impact of illegal logging in latin america, 2024. Accessed: 2026-02-28.
-
Environment America, Illegal logging is a major driver of global deforestation, 2024. Accessed: February 28, 2026.
-
Ofce of the United States Trade Representative, Tpp for the trees: Combating illegal logging. PDF report, n.d.
-
Climate Sustainability Directory, Why is illegal logging difcult to stop?, 2026. Accessed: 2026-02-28.
-
U.S. Customs and Border Protection, Illegal logging. Online resource,
n.d. Accessed 2026.
-
A. J. Hess, Chainsaw milling, domestic unregulated deforestation agents or local entrepreneurs?, 2011. Accessed: 2026-02-28.
-
Combating illegal logging, IOP Conference Series: Earth and Envi- ronmental Science, vol. 467, no. 1, p. 012065, 2020.
-
A. Folhadella, New technology help nd and stop deforestation using sound, Oct 2020.
-
A. Savchuk, How many decibels is a chainsaw: Chainsaw decibels chart, Mar 2025.
-
P. Rawat, M. Bajaj, S. Vats, and V. Sharma, A comprehensive study based on MFCC and spectrogram for audio classication, Journal of Information and Optimization Sciences, vol. 44, no. 6, pp. 10571074, 2023.
-
Rainforest Connection, Rfcx frugalai chainsaw audio dataset. https://huggingface.co/datasets/rfcx/frugalai, 2024. Hugging Face dataset repository. Accessed: 2026-03-07.
-
Pinecone Systems, K-nearest neighbor (knn) explained. Online article,
n.d. Accessed 2026.
-
GeeksforGeeks, Random forest algorithm in machine learning, Dec 2025.
-
Medium, Multilayer perceptron explained: A visual guide with mini 2d dataset. Online article, n.d. Accessed 2026.
-
S. U. Jan and F. Khaliq, An improved forest re alerting system using wireless sensor network, Advances in Networks, vol. 6, no. 1, pp. 21
39, 2018.
-
TreeFolks, Treefolks: Planting trees, growing communities, 2026. Nonprot organization promoting community tree planting and urban forest restoration in Central Texas. Accessed: 2026-03-07.
-
Texas A&M Forest Service, Texas a&m forest service, 2026. State agency providing leadership and technical assistance to conserve forests and natural resources in Texas. Accessed: 2026-03-07.
-
Amazon Conservation Association, Amazon conservation association, 2026. Nonprot organization focused on conserving biodiversity in the Amazon Basin. Accessed: 2026-03-07.
