Controlled image-based prediction of soil nutrient concentrations (NPK) using machine and deep learning
9 affiliations
- 1School of Computer Science, Taylors University, Subang Jaya, Malaysia
- 2Foundation University, Islamabad, Pakistan
- 3School of Computing and Artificial Intelligence, Faculty of Engineering and Technology, Sunway University, Bandar Sunway, Selangor Darul Ehsan, Malaysia
- 4Office of Research and Development, Asia University, Taichung, Taiwan
- 5University Institute of Information Technology, PMAS Arid Agriculture University, Rawalpindi, Pakistan
- 6Department of Engineering Technology, Foundation University, Islamabad, Islamabad, Pakistan
- 7Department of Applied Data Engineering, Fakulti Teknologi Maklumat dan Komunikasi, Universiti Teknikal Malaysia, Melaka, Malaysia
- 8Centre for Advanced Analytics, COE for Artificial Intelligence, Multimedia University, Persiaran Multimedia, Cyberjaya, Selangor, Malaysia
- 9Faculty of Computing and Informatics, Multimedia University, Persiaran Multimedia, Cyberjaya, Selangor, Malaysia
Abstract
Soil nutrient analysis is essential for sustainable agriculture and precision farming. Traditional chemical tests for nitrogen, phosphorus, and potassium are reliable but costly, time-consuming, and often unavailable in remote areas. The objective of this study is to develop a novel approach that combines laboratory chemical extraction, controlled image acquisition, image processing, machine learning, and deep learning to classify soil nitrogen, phosphorus, and potassium levels. 50 independent soil samples were analyzed, chemically extracted, and classified as Low, Medium, or High for each nutrient. A specially designed black-box prototype was developed to capture high-quality images of soil extract samples under consistent lighting conditions. The images were used to extract color and texture information, which was evaluated using multiple classical machine-learning algorithms, such as K-nearest neighbours, support vector machines, logistic regression, random forest, extra trees, gradient boosting, and Gaussian naive Bayes. A convolutional neural network-based model was also used for comparison. To minimize data leakage, all validation procedures were performed at the physical-sample level, and augmented images were restricted to the training data. The best models obtained using nested cross-validation for nitrogen, phosphorus, and potassium were KNN, Random Forest, and Logistic Regression, respectively, with accuracies of 60%, 82%, and 48%. The nitrogen model correctly identified the High category, and the phosphorus model correctly identified the dominant Low category each time. For potassium, Logistic Regression made predictions of all three classes and outperformed the majority class baseline. The Classical machine-learning models slightly outperformed the compact CNN for nitrogen and potassium, while both achieved the same accuracy for phosphorus; however, overall performance remained limited by the small and imbalanced dataset. The findings suggest that the proposed framework could contribute to image-assisted decision-making in smart farming and support improved soil management practices, particularly in regions where laboratory testing facilities are limited.
Related
- Integrating hippopotamus optimization algorithm into machine learning frameworks for predicting suspended sediment concentrations
- Regional climate variability and rice yields prediction in Bangladesh using machine learning and deep learning models
- Integrating Multisource Target Evidence with Machine-Learning Potency Prediction for Alzheimer's Disease Drug Discovery
- An Explainable Hybrid Machine Learning Approach Based on MPSO-XGBoost for Pest Density Prediction in Almond Orchards
- Species Distribution, Antifungal Susceptibility, and Machine Learning-Based Prediction of Optimal Therapies Against Candida Species
BibTeX
@article{maqsood2026controlled,
title = {{Controlled image-based prediction of soil nutrient concentrations (NPK) using machine and deep learning}},
author = {Umair Maqsood and Tehmina Karamat Ullah Khan and NZ Jhanjhi and Kashif Sattar and Fatima Iftikhar and Najma Imtiaz Ali and Raja Majid Mehmood},
journal = {PLOS One},
year = {2026},
month = oct,
doi = {10.1371/journal.pone.0360517},
url = {https://doi.org/10.1371/journal.pone.0360517},
note = {CC BY 4.0},
}
RIS
TY - JOUR
TI - Controlled image-based prediction of soil nutrient concentrations (NPK) using machine and deep learning
AU - Umair Maqsood
AU - Tehmina Karamat Ullah Khan
AU - NZ Jhanjhi
AU - Kashif Sattar
AU - Fatima Iftikhar
AU - Najma Imtiaz Ali
AU - Raja Majid Mehmood
PY - 2026
DA - 2026/10/27
JO - PLOS One
DO - 10.1371/journal.pone.0360517
UR - https://doi.org/10.1371/journal.pone.0360517
AB - Soil nutrient analysis is essential for sustainable agriculture and precision farming. Traditional chemical tests for nitrogen, phosphorus, and potassium are reliable but costly, time-consuming, and often unavailable in remote areas. The objective of this study is to develop a novel approach that combines laboratory chemical extraction, controlled image acquisition, image processing, machine learning, and deep learning to classify soil nitrogen, phosphorus, and potassium levels. 50 independent soil samples were analyzed, chemically extracted, and classified as Low, Medium, or High for each nutrient. A specially designed black-box prototype was developed to capture high-quality images of soil extract samples under consistent lighting conditions. The images were used to extract color and texture information, which was evaluated using multiple classical machine-learning algorithms, such as K-nearest neighbours, support vector machines, logistic regression, random forest, extra trees, gradient boosting, and Gaussian naive Bayes. A convolutional neural network-based model was also used for comparison. To minimize data leakage, all validation procedures were performed at the physical-sample level, and augmented images were restricted to the training data. The best models obtained using nested cross-validation for nitrogen, phosphorus, and potassium were KNN, Random Forest, and Logistic Regression, respectively, with accuracies of 60%, 82%, and 48%. The nitrogen model correctly identified the High category, and the phosphorus model correctly identified the dominant Low category each time. For potassium, Logistic Regression made predictions of all three classes and outperformed the majority class baseline. The Classical machine-learning models slightly outperformed the compact CNN for nitrogen and potassium, while both achieved the same accuracy for phosphorus; however, overall performance remained limited by the small and imbalanced dataset. The findings suggest that the proposed framework could contribute to image-assisted decision-making in smart farming and support improved soil management practices, particularly in regions where laboratory testing facilities are limited.
SN - 1932-6203
ER -