
Development of Machine Learning Models for Predicting Nitrogen Deficiency Levels in Rice Crop
Lwekiza Nelson Ndiwaita1, Kadeghe Goodluck Fue2, Mawazo J Shitindi3
1 Sokoine University of Agriculture, College of Agriculture, Department of Crop Science and Horticulture, P. O. Box 3005, Chuo-Kikuu, Morogoro, Tanzania.
2 Department of Agricultural Engineering, School of Engineering and Technology, Sokoine University of Agriculture, Morogoro, Tanzania.
3 Sokoine University of Agriculture, Department of Soil and Geological Sciences, College of Agriculture, P. O. Box 3008, Chuo-Kikuu, Morogoro, Tanzania.
*Corresponding author. E-mail: lwekizandiwaita@gmail.com
3.1 Abstract
This research paper develops machine learning models, specifically CNN architectures, to predict nitrogen deficiency levels in rice crops using RGB and NDVI imagery from field experiments in Tanzania. It evaluates models like MobileNetV3-Large and EfficientNetV2-S, achieving up to 75.3% accuracy on RGB data, addressing challenges in precision agriculture for smallholder farmers. The paper focuses on classifying four nitrogen treatment levels (0%, 50%, 100%, 150% of the recommended rate) in rice variety SARO 5 at Sokoine University of Agriculture. RGB imagery from GoPro Hero 10 and NDVI from Mapir Survey3 cameras were collected at multiple growth stages (40-90 DAP). Experiments used a randomized complete block design with controlled nitrogen applications via urea. Images underwent preprocessing (resizing, augmentation) before training seven pretrained CNNs with transfer learning. Performance metrics included accuracy, precision, recall, F1-score, confusion matrices, and t-SNE visualizations. MobileNetV3-Large topped RGB accuracy at 75.3%, tying EfficientNetV2-S on NDVI at 73.45%; RGB slightly outperformed NDVI overall. T0 (zero nitrogen) was easiest to classify, while T1 (50%) was most challenging due to spectral overlap. EfficientNetV2-S showed superior precision and training stability, recommending both for farmer tools
Keywords: Nitrogen deficiency, rice crop, convolutional neural network, NDVI, RGB imagery, deep learning, Tanzania, precision agriculture