LGCA-Net: A time-series anomaly detection method for multiple types of agricultural sensors

Zongren Wang, Laixi Zhang, Jianbo Guo, Yuan Huang, Lin Ping, Wengang Zheng, Lili Zhangzhong · Information Processing in Agriculture · 2026

The algorithm flow in this study can be divided into three parts: multi-scale local feature extraction, global feature extraction, and cross-attention mechanism feature fusion. In the multi-scale local feature extraction part, we use three convolutional residual blocks of different scales for feature extraction. By concatenating the extracted multi-scale features, a multi-scale local feature map is formed, providing fine-grained feature support for subsequent anomaly recognition. In the global feature extraction part, we adopt the encoder structure in Transformer. Through the multi-head attention mechanism, the attention distribution in multiple sub-spaces is calculated in parallel, while taking into account the dependency relationships across different time spans. In this way, global features covering long time-series are constructed, avoiding misjudgments due to local fluctuations and overlooking overall trend anomalies. In the cross-attention mechanism feature fusion part, we calculate the self-attention mechanism for both the global feature map and the local feature map to obtain their respective QKV (query, key, value). The global Q queries the local KV, and at the same time, the local Q queries the global KV. This forms an information interaction between global and local features, enhancing the model’s learning ability for complex data. Finally, the interacted features are fused and input into the fully-connected layer to obtain the final result of anomaly judgment. Anomaly detection of agricultural data is a crucial and challenging task in smart agriculture. Agricultural sensor data serves as an important basis for guiding agricultural production. However, due to the complex environmental conditions in farmland and diverse crop management measures, the quality of data collected by sensors faces severe challenges. Especially in precision agriculture, even a small amount of abnormal data can lead to deviations in key decisions such as crop water requirements, fertilization, or pest and disease control, resulting in huge losses. The method proposed in this paper can effectively improve the adaptability of the model in different agricultural environments. Compared with traditional methods, it has more stable performance and higher accuracy. The effectiveness of this method was experimentally verified using real-world scenario datasets from both greenhouse and field environments. In terms of the F1-Score metric, which comprehensively measures false alarms (Precision) and missed detections (Recall), the proposed method achieved 0.9580 in the field and 0.9721 in the greenhouse. Agricultural sensors play a crucial role in guiding agricultural production. However, the quality of data collected by these sensors is often compromised by the complex environmental conditions of farmlands and the diversity of crop management practices. Particularly in precision agriculture, even minor anomalies in data can lead to significant deviations in critical decisions, such as estimation of crop water demand, fertilization scheduling, and pest or disease management strategies, thereby resulting in substantial losses. To address this challenge, this study introduces a universal time-series anomaly detection method for multi-type agricultural sensors employing the fusion of global and local features, termed LGCA-Net. To capture the short-term change rule of data, a multiscale convolutional neural network (MCNN) is employed to extract detailed local information. For identifying the long-term change rule of data, a transformer neural network is employed to capture the global correlation within the data. Finally, the fusion of global and local information is achieved via a cross-attention mechanism, which enhances the anomaly recognition ability of the model under different agricultural sensor data. To evaluate the effectiveness of the proposed model, experiments were conducted using two agricultural scenario datasets from greenhouses and fields. The results demonstrate that the proposed method achieves F1-scores of 0.9580 (field) and 0.9721 (greenhouse), which comprehensively measures precision and recall. Compared with the single-structure model, the Accuracy (ACC) of abnormal sample recognition increased by an average of 6.65% (field) and 6.67% (greenhouse). In summary, the proposed LGCA-Net model adapts to the dual characteristics of short-term fluctuations and long-term cycles in agricultural time series through the parallel fusion of global and local features. It overcomes the limitations of single-structure models in feature capture and provides a reliable anomaly detection solution for multi-type of agricultural sensors

Read the paper · More papers on PaperTik