论文信息
论文解读
AI 辅助整理- 方法
- 巴特沃斯滤波预处理加自编码器重构误差,在NAB真实数据集上做消融实验。
- 发现
- 预滤波有效降低误报并提升检测精度,方法轻量适合边缘农业物联网设备。
- 机会点
- 可探索自适应滤波参数与轻量自编码器在边缘端多传感器联合异常检测中的泛化能力。
论文摘要
部署于农业环境中的物联网(IoT)传感器常受环境波动引起的噪声干扰,导致基于深度学习的异常检测性能下降。本文提出了一种将巴特沃斯低通滤波器与自编码器相结合的混合流程,用于从传感器时间序列数据中检测异常。巴特沃斯滤波器在数据进入自编码器之前抑制高频环境噪声,从而提高输入特征的质量。自编码器重建正常传感器信号,并通过测量重建误差来识别异常样本。我们在NAB真实传感器数据集上验证了所提方法,并进行消融实验以分析滤波模块的贡献。实验结果表明,与使用原始数据的自编码器基线相比,预滤波步骤有效减少了假阳性并提高了检测精度。该混合方法轻量,适用于计算资源有限的边缘农业物联网设备。
全文
Zenodo (CERN European Organization for Nuclear Research)Hybrid Hardware-Aware Anomaly Detection in
Smart Agriculture: Combining Butterworth Signal
Filtering with PyTorch Autoencoders
Sicheng Su
Department of Electronic Engineering
King’s College London
London, United Kingdom
Email: sicheng.su@kcl.ac.uk
This work has been submitted to the IEEE for possible publication.
Copyright may be transferred without notice, after which this version may
no longer be accessible.
Abstract—As Internet of Things (IoT) edge devices and intelli-
gent sensors are increasingly deployed in modern agricultural
environments, automated sensor fault diagnosis and anomaly
detection become critical. Traditional deep learning anomaly
detection models often fail in real-world deployments due to high
false alarm rates caused by circuit thermal noise and contact
instability. This paper presents a domain-informed anomaly de-
tection pipeline that bridges classical electronic engineering (EE)
signal processing with unsupervised deep learning. This work in-
troduces a Butterworth low-pass filtering stage to attenuate high-
frequency circuit noise prior to feature extraction, followed by a
time-series PyTorch Autoencoder trained exclusively on normal
sensor dynamics. Through controlled fault-injection experiments
built upon the Numenta Anomaly Benchmark industrial sensor
dataset, the proposed hybrid architecture reduces the circuit-
induced false-alarm rate by 38.45 percentage points while pre-
serving 100% detection sensitivity for genuine physical wildlife
intrusion events under our simulation assumptions.
Index Terms—Anomaly Detection, Autoencoder, Butterworth
Filter, Machine Learning, Time-Series Analysis, Smart Agricul-
ture, IoT Sensors, Smart Scarecrow
I. INTRODUCTION
Intelligent agricultural monitoring systems, such as smart
scarecrows and remote environmental sensing arrays, rely
heavily on continuous time-series data collected by distributed
edge sensors (e.g., infrared, vibration, and temperature sen-
sors). Reliable anomaly detection is the core of such systems,
enabling timely responses to wildlife intrusion, equipment
failure and environmental abnormalities.
However, field-deployed hardware frequently suffers from
signal degradation caused by thermal fluctuations, poor circuit
contact, and electronic component aging. These hardware-
level interferences manifest as high-frequency noise in sensor
readings, which can easily be misidentified as abnormal events
by data-driven models, leading to system false alarms and
reduced operational trust. Slow baseline drift is also observed
in real deployments, yet it is outside the scope of the present
study.
In recent years, deep learning models, specifically unsu-
pervised Autoencoders (AE), have become the state-of-the-art
approach for time-series anomaly detection. These networks
learn the latent representation of normal operational behavior
and flag anomalies when the reconstruction loss exceeds a
predefined threshold. Nevertheless, standard machine learn-
ing pipelines treat raw sensor readings as pure numerical
sequences, ignoring the physical characteristics of electronic
signals. When high-frequency electronic noise corrupts the
input stream, vanilla Autoencoders misinterpret circuit insta-
bility as critical physical events, leading to unacceptably high
false alarm rates (FAR).
This work is extended from an in-course smart-scarecrow
prototype project. The original prototype suffered excessive
false positives triggered by field hardware noise. To address
this gap, this paper proposes a hardware-aware hybrid anomaly
detection framework. By embedding an EE-based Butterworth
digital filter into the deep learning pipeline, this work aims
to separate high-frequency electronic noise from high-energy
transient events. The primary contributions of this work are
threefold:
- This work formulates a mathematical fault-injection
framework simulating both continuous circuit instability
(Gaussian thermal noise) and instantaneous physical dis-
turbances (wildlife intrusions), built upon real-world in-
dustrial sensor time-series data with calibrated amplitude
parameters. - This work constructs a lightweight PyTorch Autoencoder
optimized for time-series reconstruction using a sliding-
window topology, with only 674 trainable parameters
(approx. 2.7 KB memory footprint) and strict training-
validation split to eliminate data leakage. - This work conducts quantitative controlled experi-
ments and dual-dimension ablation studies, proving that
domain-specific EE signal preprocessing yields a 38.45
percentage point absolute reduction in false-alarm rate
under high-frequency circuit noise, while maintaining full
event detection performance.
II. RELATEDWORK
A. Time-Series Anomaly Detection with Deep Learning
Unsupervised deep learning has become the dominant
paradigm for time-series anomaly detection due to its ability to
learn complex normal patterns without labeled anomaly data.
Malhotra et al. first proposed LSTM-based encoder-decoder
architectures for multi-sensor anomaly detection, establishing
the reconstruction-error-based detection paradigm [1]. Subse-
quent work has explored variants including convolutional au-
toencoders and transformer-based models for higher temporal
modeling capacity. However, most pure data-driven models
ignore the physical origin of sensor noise, treating all signal
deviations equally and resulting in vulnerability to hardware
interference [5].
B. Anomaly Detection in Agricultural IoT
Agricultural IoT systems present unique challenges includ-
ing harsh deployment environments, limited edge computing
resources, and high requirements for operational reliability.
Ayaz et al. provided a comprehensive survey of IoT applica-
tions in smart agriculture, identifying sensor fault tolerance
as a key unmet need [4]. Zhang et al. proposed edge-based
anomaly detection for agricultural sensor systems, but their
method focused on algorithmic optimization rather than hard-
ware noise mitigation [6]. Jha et al. developed an IoT-based
smart scarecrow system for crop protection, but did not address
false alarm issues caused by circuit noise [7].
C. Hybrid Signal Processing + Machine Learning Pipelines
There is growing recognition that domain-specific signal
preprocessing can improve the robustness of deep learning
anomaly detectors. Oprea et al. reviewed signal preprocess-
ing techniques for deep learning-based time-series anomaly
detection, noting that filtering methods are under-explored in
most end-to-end pipelines [5]. Ray surveyed deep learning for
IoT anomaly detection, highlighting the potential of hybrid
EE-ML approaches for edge deployment [3]. However, few
studies systematically quantify the trade-offs between filter
design parameters and detection performance in agricultural
sensor scenarios.
III. METHODOLOGY
A. Signal Modeling and Fault Injection
Experiments are built upon real industrial temperature sen-
sor data from the Numenta Anomaly Benchmark (NAB) [8],
which provides real-world sensor measurements with known
anomaly events. A fault-free baseline segment is extracted,
and two distinct anomaly types are injected to simulate field
deployment conditions. The noise and impulse amplitudes are
calibrated based on typical field measurements of agricultural
edge sensors: thermal contact noise typically ranges from 2–
4 times the sensor resolution, while wildlife intrusion events
produce signal spikes 10–30 times the normal fluctuation
range.
1)Circuit Fault Noise (n c(t)):High-frequency Gaussian
white noiseN(0, σ 2)simulating contact resistance instability
over a bounded time intervalt∈[t start, tend]:
xfault(t) =x(t) +N(0, σ2)(1)
whereσ= 3.5is set to match high-temperature field contact
noise levels.
2)Physical Intrusion Events (p i(t)):Transient high-
amplitude impulses representing physical force or wildlife
interaction at discrete time indicest k:
xintrusion(t) =x(t) +
X
k
δ(t−t k)·A spike (2)
whereA spike = 28.0simulates the signal amplitude of large
bird intrusion events. Note thatδ(t−t k)is a continuous-time
theoretical abstraction; in discrete simulation, single-sample
narrow impulses are used.
B. Butterworth Low-Pass Filtering
To prevent circuit-level noisen c(t)from corrupting the
neural network representations, Butterworth low-pass filtering
is employed. Butterworth topology is selected over alternatives
(moving average, wavelet denoising, Kalman filter) for two
key engineering reasons:
- It exhibits maximally flat magnitude response in the
passband, introducing no amplitude distortion to normal
low-frequency sensor dynamics. - It has extremely low computational complexity, requiring
only multiply-add operations, making it suitable for 8/32-
bit microcontroller edge deployment.
The magnitude frequency response|H(jω)|of ann-th order
Butterworth filter is defined as:
|H(jω)| 2 = 1
1 +
ω
ωc
2n (3)
wherenrepresents the filter order andω c denotes the cutoff
frequency. The sampling frequencyf s is set to1.0 Hz, with a
baseline physical cutoff frequencyf c = 0.05 Hz(normalized
cutoff 0.1).
The analog prototype is converted to digital form via
bilinear transform with pre-warping. A zero-phase digital fil-
tering algorithm (filtfilt) is applied for offline processing,
which processes the sequence forward and backward, guaran-
teeing zero phase distortion across transient impulse peaks.
Important note:filtfiltrequires future time samples
and is not suitable for real-time streaming edge inference.
Real-time deployment would require causal one-pass filtering,
which introduces phase delay.
C. PyTorch Autoencoder Architecture
The preprocessed time series is standardized and segmented
into sliding temporal windows of lengthW= 20. This
window size is chosen to balance temporal resolution and
contextual coverage: at1 Hzsampling, a 20-second window
captures typical short-term temperature dynamics while re-
maining fine enough to localize transient events. Window-level
labels are assigned by taking the maximum label value inside
each temporal window, ensuring that any window containing
an anomaly is correctly tagged.
A fully connected autoencoder rather than LSTM or convo-
lutional variants is used for edge deployment suitability: dense
layers have minimal memory overhead and deterministic infer-
ence latency, critical for resource-constrained microcontrollers.
The architecture comprises an EncoderE θ and a DecoderD ϕ:
1)Encoder (E θ):Compresses the 20-dimensional input
window into a 6-dimensional bottleneck representation
through dense layers with ReLU activations (20→12→
6).
2)Decoder (D ϕ):Reconstructs the original 20-dimensional
sequence from the bottleneck vector (6→12→20).
The total trainable parameter count is 674, resulting in a
memory footprint of approximately 2.7 KB in 32-bit floating
point format.
To avoid data leakage and overfitting, normal operational
windows are randomly split into an 80% training set and a
20% validation set. The autoencoder is trained exclusively on
the training set, and the anomaly threshold is computed solely
from the validation set.
The network is trained by minimizing the Mean Squared
Error (MSE) loss function:
LMSE(θ, ϕ) =1W
WX
i=1
(xi −ˆxi)2 (4)
During testing, the anomaly score for any given window
is evaluated via its reconstruction error. An anomaly alarm
is triggered whenever the error exceeds a dynamic threshold
τ, set at the 97.5th percentile of the reconstruction-error
distribution obtained from the independent validation set. This
percentile is a standard configuration in unsupervised anomaly
detection, providing an initial balance between false positives
and detection sensitivity.
IV. EXPERIMENTALRESULTS ANDDISCUSSION
A. Experimental Setup Details
All experiments use real-world sensor time-series from the
NAB dataset as the underlying signal base, with synthetic con-
trolled fault injection for repeatable comparative evaluation.
Fixed random seeds are reset at the start of each training run
for full reproducibility. Key hyper-parameters are summarized
below:
(a) Sampling frequencyf s = 1.0 Hz; total sequence length:
2400 samples.
(b) Sliding window lengthW= 20, sliding step size = 1
sample (sample-wise rolling window).
(c) Standardization: z-score normalization fit exclusively on
normal samples.
(d) Training/validation split: 80/20 random split of normal
windows; threshold computed on validation set only.
(e) Circuit noise: Gaussian white noise withσ= 3.5injected
over index intervalt∈[800,1399](600 noisy samples).
(f) Intrusion events: 4 narrow one-sample wildlife impulse
events with amplitudeA spike = 28.0at indices [300, 700,
1600, 2100].
(g) Autoencoder: trained with Adam optimizer, learning rate
5×10 −3, 100 training epochs, batch size 32.
B. Core Performance Comparison
TABLE I
QUANTITATIVEPERFORMANCECOMPARISON
Metric Direct AI EE-Enhanced AI
(No Filter)
Anomaly Threshold (τ)1.2×10 −4 1.9×10 −3
Circuit False Alarms 619 / 619 381 / 619
False Alarm Rate (FAR) 100.00% 61.55%
Event-level Detection Rate 100.0% 100.0%
FAR Absolute Reduction – 38.45 pp
As detailed in Table I, the baselineDirect AI Modelsuffers
catastrophic performance degradation during the circuit noise
interval, reaching a 100% false-alarm rate. The autoencoder
achieves near-perfect reconstruction on normal training data,
resulting in an extremely low threshold. Every window cor-
rupted by high-frequency Gaussian noise therefore produces
reconstruction error far above the normal threshold, as the
model cannot reconstruct out-of-distribution random noise
components. This result confirms that pure data-driven models
are completely unreliable when hardware-level interference is
present.
In contrast, the proposedEE-Enhanced AI Modelwith 0.05
Hz 4th-order Butterworth pre-filtering reduces the false-alarm
rate from 100.00% down to 61.55%. The filter attenuates a
substantial portion of high-frequency circuit noise before feed-
ing data into the neural network, lowering reconstruction error
for many noisy windows. Nevertheless, significant residual
false alarms remain, as the 4th-order low-pass filter cannot
fully eliminate strong Gaussian noise.
Importantly, event-level wildlife intrusion detection rate
remains 100% for both configurations. Under this simulation
setting, the impulse spikes carry sufficient energy such that
even after low-pass attenuation they can still be reliably
detected.
As illustrated in Fig. 1, the reconstruction loss magnitude
in the circuit-fault region is visibly reduced after filtering,
although many windows still lie above the alarm threshold.
C. Filter Frequency Response Analysis
To visualize the filtering characteristics underlying the per-
formance improvements, the magnitude frequency responses
of the tested Butterworth filter configurations are plotted
in Fig. 2. The 4th-order filter exhibits a smooth transition
from passband to stopband, with attenuation increasing with
frequency. Lower cutoff frequencies and higher orders both
provide stronger noise attenuation at the cost of reduced signal
bandwidth.
Fig. 1. Reconstruction loss comparison (log scale). Top: Direct AI without
filter; Bottom: Proposed EE-enhanced model with 0.05 Hz 4th-order Butter-
worth pre-filter. Yellow shaded area marks circuit-noise interval; blue triangles
denote wildlife intrusion events.
Fig. 2. Butterworth filter magnitude frequency responses. Left: varying cutoff
frequency (4th-order); Right: varying filter order (0.05 Hz cutoff). Dashed line
marks the 0.05 Hz baseline cutoff.
D. Ablation Studies
To systematically quantify the engineering trade-offs in filter
design, two ablation studies are conducted: one on filter cutoff
frequency (fixed order) and one on filter order (fixed cutoff
frequency). All configurations are trained independently with
identical random seed initialization to ensure reproducibility
and consistent comparison.
- Cutoff Frequency Ablation:Four physical cutoff fre-
quencies are evaluated: 0.02 Hz, 0.05 Hz, 0.1 Hz, and 0.2
Hz, all with a fixed 4th-order Butterworth topology.
TABLE II
ABLATIONSTUDY: CUTOFFFREQUENCY VS. DETECTIONPERFORMANCE
(4TH-ORDER FILTER)
Cutoff Frequency 0.02 Hz 0.05 Hz 0.1 Hz 0.2 Hz
False Alarm Rate 55.09% 61.55% 99.19% 99.68%
Event Detection Rate 100.0% 100.0% 100.0% 100.0%
Results in Table II and Fig. 3 reveal a clear monotonic trend:
as cutoff frequency decreases, the passband narrows and more
high-frequency noise is attenuated, leading to progressively
lower false-alarm rates. Reducing cutoff from 0.2 Hz to 0.02
Hz cuts FAR from 99.68% to 55.09%.
The most dramatic improvement occurs between 0.1 Hz and
0.05 Hz, where FAR drops by over 37 percentage points. This
is because the injected Gaussian white noise has approximately
60% of its energy above 0.1 Hz; lowering the cutoff into
this range removes the majority of noise power. Below 0.05
Hz, further reduction in cutoff yields diminishing returns, as
remaining noise components overlap more with the signal
passband.
Across all tested cutoff frequencies, event-level detection
rate remains at 100% because the high-amplitude intrusion
impulses retain sufficient energy after low-pass filtering to
exceed the anomaly threshold.
Fig. 3. False alarm rate as a function of filter cutoff frequency (4th-order
Butterworth). - Filter Order Ablation:Four filter orders are evaluated:
2nd, 4th, 6th, and 8th order, all with a fixed physical cutoff
frequency of 0.05 Hz. Filter order determines the steepness of
the transition band between passband and stopband: higher or-
ders provide faster roll-off and stronger stopband attenuation,
at the cost of higher computational complexity.
TABLE III
ABLATIONSTUDY: FILTERORDER VS. DETECTIONPERFORMANCE(0.05
HZ CUTOFF)
Filter Order 2nd 4th 6th 8th
False Alarm Rate 89.66% 61.55% 55.09% 48.47%
Event Detection Rate 100.0% 100.0% 100.0% 100.0%
Results in Table III and Fig. 4 confirm the expected relation-
ship between filter order and noise suppression. Increasing fil-
ter order steepens the roll-off characteristic, suppressing more
high-frequency noise components above the cutoff frequency
and progressively reducing the false-alarm rate; moving from
2nd to 6th order reduces FAR from 89.66% to 55.09%.
Performance gains begin to plateau beyond 6th order: an
8th-order filter achieves only a minor additional reduction to
48.47% FAR. From a computational perspective, an 8th-order
filter requires roughly twice the multiply-add operations of a
4th-order filter, for only 13.08 percentage points of additional
FAR reduction. Remarkably, the detection rate remains 100%
across all tested filter orders, as even the 8th-order filter with
very steep transition does not attenuate the high-amplitude
intrusion pulses enough to cause missed detections under the
current amplitude setting.
Fig. 4. False alarm rate as a function of filter order (0.05 Hz cutoff frequency).
3) Waveform-Level V alidation:To confirm that filtering
preserves intrusion signal detectability, the waveform of a
representative intrusion event before and after filtering is
examined in Fig. 5. The single-sample impulse is slightly
broadened by the filter but retains a clear peak that is orders
of magnitude above the noise floor, explaining the maintained
100% detection rate.
Fig. 5. Waveform comparison of a representative wildlife intrusion event
(index 1600) before and after 0.05 Hz 4th-order Butterworth filtering.
4) Discussion of Trade-offs:Notably, the classical
detection-false alarm trade-off does not emerge across the
tested parameter range, due to the high amplitude of the
simulated intrusion events. Instead, the trade-off manifests in
two practical dimensions:
1)Noise suppression vs. computational cost: Higher filter
order and lower cutoff frequency reduce FAR, but in-
crease arithmetic operations and memory footprint, which
is critical for microcontroller-based edge deployment.
2)Diminishing returns: Noise reduction gains decrease as
filter aggressiveness increases. For example, moving from
6th to 8th order yields only 6.62 percentage points of FAR
improvement, compared to a 28.11 percentage point gain
from 2nd to 4th order.
For resource-constrained edge devices, 4th-order 0.05 Hz
offers a favourable balance of performance and efficiency;
for offline processing, 6th-order configuration delivers the best
noise suppression without detection loss.
E. Limitations
This study has several important limitations that should
be acknowledged. First, wildlife intrusions are modelled as
high-amplitude single-sample impulses, and detection rate
remains 100% across all tested filter parameters. In real-
world scenarios with weaker or wider intrusion signals, ag-
gressive filtering could lead to missed detections, exhibiting
the classical detection-false alarm trade-off. Second, the zero-
phasefiltfiltused here is an offline algorithm. Real-time
edge deployment on microcontrollers requires causal filtering,
which introduces phase distortion and may alter detection
performance. Third, the proposed pipeline only mitigates high-
frequency circuit noise; slow baseline drift is not addressed
and can still trigger false alarms. Fourth, all experiments
use Gaussian white noise as the interference model. Real-
world circuit noise may contain additional components such as
power-line hum or impulse noise, which would require differ-
ent filter designs. Finally, all quantitative results are obtained
from fault-injection experiments based on the NAB public
benchmark dataset. Performance on real smart-scarecrow field
measurements remains to be validated in future work.
V. CONCLUSION
This paper demonstrates that integrating domain-specific
electronic engineering signal processing with unsupervised
deep learning can significantly improve anomaly-detection
robustness for agricultural IoT edge devices. By deploying a
Butterworth low-pass digital filter upstream of a PyTorch Au-
toencoder, a measurable reduction of false alarms originating
from thermal high-frequency circuit noise is achieved, while
maintaining full event-level detection for wildlife intrusion
transients in our simulation setting.
Ablation studies quantify the impact of both cutoff fre-
quency and filter order: lower cutoff and higher order both
improve noise suppression, with 8th-order 0.05 Hz configura-
tion achieving 48.47% false-alarm rate compared to 100% for
the unfiltered baseline. Complete elimination of false alarms
is not achieved under strong circuit noise, highlighting the
inherent trade-offs in filter design.
Future work will evaluate causal filter variants, systemati-
cally optimize filter parameters for specific field conditions,
address baseline drift compensation, validate performance on
real smart-scarecrow field measurements, and deploy this
architecture onto microcontrollers for low-power TinyML edge
inference.
REFERENCES
[1] P. Malhotraet al., “LSTM-based Encoder-Decoder for Multi-sensor
Anomaly Detection,”arXiv preprint arXiv:160700148, 2016.
[2] A. V . Oppenheim,Discrete-Time Signal Processing, 3rd ed. Prentice
Hall, 2009.
[3] A. Ray, “Deep Learning for IoT Anomaly Detection: A Survey,”IEEE
Internet of Things Journal, vol. 8, no. 14, pp. 11210-11228, 2021.
[4] M. Ayazet al., “Internet-of-Things in smart agriculture: A survey,”
Computers and Electronics in Agriculture, vol. 155, pp. 221-232, 2018.
[5] S. M. Opreaet al., “Signal preprocessing for deep-learning-based time-
series anomaly detection: A review,”Sensors, vol. 22, no. 11, 2022.
[6] D. Zhanget al., “Edge-based sensor anomaly detection for agricultural
IoT systems,”IEEE Sensors Journal, vol. 21, no. 18, pp. 20448-20457,
2021.
[7] R. K. Jhaet al., “IoT-based smart scarecrow for crop protection,” in
Proc. IEEE International Conference on Smart Instruments and Control
Systems, 2020, pp. 1-6.
[8] A. Lavin and S. Ahmad, “Evaluating Real-time Anomaly Detec-
tion Algorithms – the Numenta Anomaly Benchmark,” inProc. 14th
IEEE International Conference on Machine Learning and Applications
(ICMLA), 2015, pp. 38-44.
论文原文与出版信息
Zenodo (CERN European Organization for Nuclear Research)