An Attention-Enhanced PSO-CNN-BiLSTM Model for Precise Soil Phosphorus Content Prediction
Main Article Content
Abstract
Background: The impact of soil phosphate, an essential micronutrient, on agricultural productivity and crop growth is significant. The accurate determination of phosphorus in the soil is crucial for sustainable agriculture and efficient fertilizer usage. Standard laboratory analysis of soil is time-consuming and expensive, making it inadequate for monitoring large areas of land. Simple methods for estimating soil nutrients can now be achieved through the use of local environmental parameters, thanks to ML and deep learning.
Results: A model that enhances attention was developed by PSO-CNN-Bidirectional Long Short-Term Memory Particle Swarm Optimization–Convolutional Neural Network–Bidirectional Long Short-Term Memory (PSO–CNR-BILSTM), which accurately predicted the soil phosphorus content. Our study included this work. No details? The proposed method involves the use of convolutional neural networks (CNN) for spatial characteristics, BILSTM for discovering patterns over time in the target variable, and an attention mechanism to identify crucial factors that impact phosphorus dynamics. Particle Swarm Optimization (PSO) was used to optimize the model hyperparameters and enhance our predictions. This was achieved through automation.
The model was adapted to the conditions by taking into account soil and environmental variables from the Hulan soil monitoring dataset before being tested. Using experimental data, the proposed model has an R2 of approximately 0.96 and an inversely related RMSE of around 0.20. Both are empirically significant. The reliability of the model was assessed by examining correlation heat maps, residual variance distributions and actual versus predicted curves.
Conclusion: This proposed hybrid framework provides intelligent and effective means to predict soil nutrients, which is beneficial for precision agriculture and farm management systems based on data.
Article Details
Copyright (c) 2026 Subramaniam M, et al.

This work is licensed under a Creative Commons Attribution 4.0 International License.
Zhang Y, Wang L, Liu X, Chen H. Machine learning applications for precision agriculture: a comprehensive review. IEEE Access. 2020;8:48499–48517. Available from: https://scispace.com/pdf/machine-learning-applications-for-precision-agriculture-a-595xsgydlw.pdf
Rao V, Kumar P, Singh R. Soil phosphorus content prediction based on improved PSO-LSTM algorithm. Soil Use Manage. 2023;39(2):734–746.
Moussaid A, Benali M, Idrissi H. Hybrid CNN-LSTM model for predicting nitrogen, phosphorus and potassium fertilization requirements. Smart Agric Technol. 2025.
Farhangmehr V, Costa M, Pereira J. Spatiotemporal CNN-LSTM deep learning model for predicting soil environmental variables. Sci Total Environ. 2025. Available from: https://doi.org/10.1016/j.scitotenv.2025.178901
Tang Y, Zhao L, Wang J, Liu H. A novel self-supervised learning method for accurate multigranularity prediction of soil organic carbon. ISPRS J Photogramm Remote Sens. 2023;201:40–54. Available from: https://doi.org/10.1109/TGRS.2024.3511118
Kaya F, Kılıç K. Assessing machine learning-based prediction of soil phosphorus using environmental variables. Agriculture. 2022;12(7):1062. Available from: https://www.mdpi.com/2077-0472/12/7/1062
Folorunso O, Adeyemi A, Ogunleye O. Exploring machine learning models for soil nutrient prediction and agricultural decision support. Algorithms. 2023;7(2):113.
Shahare YR, Patil S, Deshmukh R. Agriculture soil fertility assessment using random forest algorithms. Procedia Comput Sci. 2024. Available from: https://doi.org/10.1016/j.procs.2024.04.164
Liu Q, Zhang T, Wang J, Li Y. Application of hyperspectral technology combined with bat algorithm–Adaboost model in field soil nutrient prediction. Comput Electron Agric. 2021;179:105825.
Zhou M, Li X, Chen Y, Wang H. SSL-SoilNet: a hybrid transformer-based framework with self-supervised learning for large-scale soil organic carbon prediction. IEEE Trans Geosci Remote Sens. 2024;62. Available from: https://arxiv.org/abs/2308.03586
Huang Y, Li F, Zhang X, Wang L. Prediction of soil organic carbon content using UAV multispectral and LiDAR data. Ecol Indic. 2022;136:108660. Available from: https://doi.org/10.1109/JSTARS.2025.3534238
Trontelj J, Chambers O, Seme S. Machine learning strategy for soil nutrients prediction using spectroscopic methods. Sensors. 2021;21(12):4208. Available from: https://www.mdpi.com/1424-8220/21/12/4208
Sharma P, Gupta R, Mena S. Deep-learning-based approach for estimation of fractional abundance of nitrogen in soil from hyperspectral data. Soil Sci Soc Am J. 2022;86(3):812–826. Available from: https://doi.org/10.1109/JSTARS.2020.3039844
Huang Y, Li F, Zhang X, Wang L. Prediction of soil organic carbon content using UAV multispectral and LiDAR data. Ecol Indic. 2022;136:108660. Available from: https://doi.org/10.1109/JSTARS.2025.3534238
Park J, Kim S, Lee H, Choi Y. An edge transfer learning approach for calibrating soil electrical conductivity sensors. IEEE Internet Things J. 2024;11(3):4562–4574.
Mehta R, Patel S, Shah D. Integrating electrical features for simultaneous prediction of soil moisture and potassium levels based on neural network prediction model. Precis Agric. 2022;23:567–584. Available from: https://doi.org/10.1109/TIM.2025.3544382
Hall RL, Johnson M, Baker T. Machine learning approach to predicting plant-available phosphorus using soil chemical properties. J Soils Sediments. 2024. Available from: https://www.researchgate.net/publication/374058256_A_machine_learning_approach_to_predicting_plant_available_phosphorus_that_accounts_for_soil_heterogeneity_and_regional_variability
Bulan R, Prasetyo B, Santoso H. Vis-NIR spectra combined with machine learning for prediction of soil nutrient properties. Smart Agric Technol. 2022. Available from: https://doi.org/10.1016/j.cscee.2022.100268
Gao J, Liu Y, Wang X. Rapid detection of soil available phosphorus using advanced analytical techniques. Sensors. 2024. Available from: https://doi.org/10.2174/0115701794295930240902050855
Yu X, Zhang Y, Liu H. Prediction model of nitrogen, phosphorus and potassium fertilizer requirements using neural networks. Agronomy. 2024;14(6):1165.
Guo J, Wang L, Li Y. Machine learning and genetic algorithm for mapping soil phosphorus variability. Ecol Inform. 2024. Available from: https://doi.org/10.1016/j.ecolind.2024.112294
Lavanya V, Kumar P, Reddy S. Digital soil mapping of available phosphorus using smartphone imaging and machine learning. Smart Agric Technol. 2024.
Abekoon T, Perera A, Silva R, Rathnayake N, Meddage DPP, Rathnayake U. Justifying the prediction of major soil nutrients levels using Sajindra H, Wijesinghe D, Fernando K. Deep learning model for predicting soil nitrogen, phosphorus and potassium content. Results Eng. 2024.
Sajindra H, Wijesinghe D, Fernando K. deep neural networks. Environ Technol Innov. 2024. Available from: https://doi.org/10.1016/j.mex.2024.102793
Ennaji O, Elhaddad M, Rahmani A. Machine learning-based optimization of site-specific NPK fertilizer recommendations. Smart Agric Technol. 2026. Available from: https://www.researchgate.net/publication/400073554_Machine_Learning-Based_Optimization_of_Site-Specific_NPK_Fertilizer_Recommendation
Chen X, Huang Z, Li Y, Zhang Q. Random forest-based soil moisture estimation using Sentinel-2, Landsat-8/9, and UAV-based hyperspectral data. IEEE J Sel Top Appl Earth Obs Remote Sens. 2023;16:2341–2354. Available from: https://www.mdpi.com/2072-4292/16/11/1962