In agricultural production, the nitrogen content of sugarcane is assessed with precision and the economy, which is crucial for balancing fertilizer application, reducing resource waste, and minimizing environmental pollution. As an important economic crop, the productivity of sugarcane is significantly influenced by various environmental factors, especially nitrogen supply. Traditional methods based on manually extracted image features are not only costly but are also limited in accuracy and generalization ability. To address these issues, a novel regression prediction model for estimating the nitrogen content of sugarcane, named SC-ResNeXt (Enhanced with Self-Attention, Spatial Attention, and Channel Attention for ResNeXt), has been proposed in this study. The Self-Attention (SA) mechanism and Convolutional Block Attention Module (CBAM) have been incorporated into the ResNeXt101 model to enhance the model’s focus on key image features and its information extraction capability. It was demonstrated that the SC-ResNeXt model achieved a test R2 value of 93.49% in predicting the nitrogen content of sugarcane leaves. After introducing the SA and CBAM attention mechanisms, the prediction accuracy of the model improved by 4.02%. Compared with four classical deep learning algorithms, SC-ResNeXt exhibited superior regression prediction performance. This study utilized images captured by smartphones combined with automatic feature extraction and deep learning technologies, achieving precise and economical predictions of the nitrogen content in sugarcane compared to traditional laboratory chemical analysis methods. This approach offers an affordable technical solution for small farmers to optimize nitrogen management for sugarcane plants, potentially leading to yield improvements. Additionally, it supports the development of more intelligent farming practices by providing precise nitrogen content predictions.
Traditional nutritional diagnosis suffers from inefficiency, high cost, and damage when predicting the nitrogen, phosphorus, and potassium content of sugarcane leaves. Non-destructive nutritional diagnosis of sugarcane leaves based on traditional machine learning and deep learning suffers from poor generalization and lower accuracy. To address these issues, this study proposes a novel convolutional neural network called WT-ResNet. This model incorporates wavelet transform into the residual network structure, enabling effective feature extraction from sugarcane leaf images and facilitating the regression prediction of nitrogen, phosphorus, and potassium content in the leaves. By employing a cascade of decomposition and reconstruction, the wavelet transform extracts multi-scale features, which allows for the capture of different frequency components in images. Through the use of shortcut connections, residual structures facilitate the learning of identity mappings within the model. The results show that by analyzing sugarcane leaf images, our model achieves R2 values of 0.9420 for nitrogen content prediction, 0.9084 for phosphorus content prediction, and 0.8235 for potassium content prediction. The accuracy rate for nitrogen prediction reaches 88.24% within a 0.5 tolerance, 58.82% for phosphorus prediction within a 0.1 tolerance, and 70.59% for potassium prediction within a 0.5 tolerance. Compared to other algorithms, WT-ResNet demonstrates higher accuracy. This study aims to provide algorithms for non-destructive sugarcane nutritional diagnosis and technical support for precise sugarcane fertilization.