Early diagnosis method for nitrogen deficiency of corn based on leaf spatial spectral characteristics

By fusing leaf spatial spectral features with spectral features, and combining key band screening with deep learning models, the destructive and ambiguous problems of traditional maize nitrogen content detection have been solved. This enables non-destructive and accurate early diagnosis of maize nitrogen deficiency, providing a basis for real-time field diagnosis.

CN122391846APending Publication Date: 2026-07-14SHANDONG AGRICULTURAL UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANDONG AGRICULTURAL UNIVERSITY
Filing Date
2026-03-19
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing methods for detecting nitrogen content in maize suffer from problems such as being highly destructive, cumbersome to operate, unable to provide real-time diagnosis, ignoring spatial differences, having difficult-to-interpret models, and having vague grading standards, making it impossible to accurately identify early nitrogen deficiency characteristics in maize.

Method used

By integrating the spatial and spectral features of leaf transmission hyperspectral data from maize stages V8 to V10, combining key band selection with linear kernel support vector machine, full fine-tuning of the DenseNet201 model, and hierarchical modeling of growth stages, along with gradient-weighted class activation mapping feature visualization and hierarchical diagnostic logic, a non-destructive, direct field diagnosis of nitrogen deficiency can be achieved.

Benefits of technology

This method enables non-destructive and easy-to-use early diagnosis of nitrogen deficiency in corn, improving the accuracy and interpretability of the diagnosis. It can promptly identify early signs of nitrogen deficiency, providing a clear basis for fertilization and avoiding the cumbersome procedures and misdiagnosis problems of traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391846A_ABST
    Figure CN122391846A_ABST
Patent Text Reader

Abstract

The application discloses a corn nitrogen deficiency early diagnosis method based on leaf spatial spectral characteristics, and relates to the technical field of crop nutrition diagnosis.The specific steps of the method are as follows: firstly, a transmissive hyperspectral image of a leaf is collected at the V8 to V10 stage of corn, and the nitrogen content is measured by using the Kjeldahl method to complete high and low nitrogen two-class labeling; secondly, the image is subjected to multi-link preprocessing to obtain a standardized image; thirdly, key spectral bands are screened to generate a spatial spectral fusion image; fourthly, the data set is divided, the DenseNet201 model is trained by modifying and combining growth stage layering modeling; fifthly, the model is visualized by gradient weighted class activation mapping and the generalization is verified; and finally, the image after field preprocessing is input into the model, nitrogen deficiency grading diagnosis is performed according to the nitrogen content and the prediction confidence.The application solves the problems of traditional diagnosis, such as neglecting spatial differences, model lack of interpretability and grading ambiguity, and realizes early precise and non-destructive diagnosis of corn nitrogen deficiency by fusing leaf spatial spectral characteristics, growth stage layering modeling and model visualization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of crop nutrition diagnostic technology, specifically to an early diagnostic method for nitrogen deficiency in maize based on the spatial spectral characteristics of leaves. Background Technology

[0002] Maize is a vital food and economic crop globally. Nitrogen, an essential macronutrient for maize growth, directly impacts leaf photosynthetic efficiency and plant development. Insufficient nitrogen supply can lead to stunted early growth and ultimately reduced yield. Accurate early assessment of maize's nitrogen nutrient status is crucial for timely adjustments to fertilization plans. With the development of hyperspectral imaging technology, portable transmission hyperspectral imaging devices, capable of capturing internal leaf biochemical characteristics, are increasingly being used for crop nutrient diagnosis. Leaf-level hyperspectral detection, with its advantages of high resolution and low environmental interference, has become an important technological direction for early nitrogen deficiency diagnosis in maize.

[0003] Traditional methods for detecting nitrogen content in maize have significant shortcomings, and existing hyperspectral diagnostic models cannot meet practical needs: the Kjeldahl method, while accurate, requires destructive sampling and complex pretreatment steps, making it cumbersome and time-consuming, and unable to complete diagnosis in real time in the field; SPAD chlorophyll meters can only perform spot measurements, failing to reflect the spatial heterogeneity of leaf nitrogen content, and rely solely on limited spectral information, resulting in insufficient detection stability; existing hyperspectral diagnostic models mostly focus on single spectral feature analysis, lacking deep integration of spatial and spectral features, and deep learning models are mostly black-box structures, with diagnostic results lacking clear feature basis, vague grading standards, and unable to accurately identify subtle early nitrogen deficiency characteristics in maize. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of existing technologies and provide an early diagnostic method for nitrogen deficiency in maize based on leaf spatial spectral characteristics. This method integrates the spatial and spectral characteristics of maize leaves at stages V8 to V10, combines key band screening using linear kernel support vector machines, construction of a fully fine-tuned DenseNet201 model, and hierarchical modeling of growth stages, with gradient-weighted class activation mapping feature visualization and hierarchical diagnostic logic. This solves the problems of traditional diagnostic methods ignoring spatial differences, difficult model interpretation, and ambiguous grading standards. The entire process does not require leaf damage, the operation procedure is standardized, it can be carried out directly in the field, and the diagnostic results are accurate and reliable, effectively identifying early nitrogen deficiency characteristics in maize.

[0005] To solve the above-mentioned technical problems, this invention provides the following technical solution: an early diagnosis method for nitrogen deficiency in maize based on leaf spatial spectral characteristics, the specific steps of which are as follows:

[0006] Step 1, Sample collection and labeling: During the early vegetative growth stage of maize V8 to V10, select the top mature leaves of disease-free plants in the field, and use a portable leaf transmission hyperspectral imager to collect full-area transmission hyperspectral images of the leaves. At the same time, use the Kjeldahl method to determine the actual nitrogen content of the corresponding leaves and complete the binary labeling of high nitrogen and low nitrogen leaves.

[0007] Step 2, hyperspectral image preprocessing: The acquired hyperspectral images are sequentially processed by band cropping, reference calibration, leaf region segmentation, spectral transformation, multivariate scattering correction, smoothing and denoising, data augmentation and normalization to obtain standardized leaf hyperspectral images.

[0008] Step 3, Key Spectral Band Screening: Input the preprocessed average absorption spectrum of the leaf into the linear kernel support vector machine model. After optimizing the hyperparameters through 5-fold cross-validation, extract the model weight coefficients and screen a preset number of key spectral bands to generate a spatial spectral fusion image that retains the complete spatial information of the leaf.

[0009] Step 4, Diagnostic Model Construction: The spatial spectral fusion images are divided into training and test sets in an 8:2 ratio, while maintaining the same sample ratio between V8 and V10 stages and between high-nitrogen and low-nitrogen stages. The DenseNet201 model is modified in structure and trained using a full fine-tuning strategy. During training, the model performance is optimized by combining a hierarchical modeling strategy based on the reproductive period, resulting in an early diagnostic model for nitrogen deficiency in maize.

[0010] Step 5, Model Visualization and Validation: A heat map of leaf spatial features is generated by gradient weighted class activation mapping to visualize the model features. At the same time, a three-dimensional model evaluation system is adopted to verify the model's generalization ability through cross-cycle and cross-field experiments.

[0011] Step 6, field grading diagnosis: Input the leaf images collected in the field and preprocessed in accordance with the training set into the trained diagnostic model. Based on the actual nitrogen content of the leaves and the confidence of the model prediction, the leaves are divided into three levels: no nitrogen deficiency, mild nitrogen deficiency, and severe nitrogen deficiency.

[0012] Furthermore, in step 2, the band is clipped to retain the effective band from 490 nm to 890 nm; the reference calibration uses a green reference plate for light source correction, and the correction formula is:

[0013]

[0014] in The light source corrected transmission spectrum of the blade. The original leaf transmission spectrum was collected. The transmission spectrum corresponding to a dark background. This is the standard transmission spectrum corresponding to the green reference plate; the spectral transformation is based on Beer's Law, converting the transmission spectrum into an absorption spectrum, and the transformation formula is:

[0015]

[0016] in The converted leaf absorption spectrum is shown below. The light source corrected transmission spectrum of the blade. The standard transmission spectrum of the green reference plate is used; the Savitzky-Gore smoothing algorithm with a window length of 15 and a polynomial order of 1 is used for smoothing and denoising; data augmentation includes window resampling with a window size of 5, random Gaussian blur, random vertical flip, random horizontal flip, and random rotation; the spatial size of all leaf hyperspectral images is uniformly adjusted to 128×64 by bilinear interpolation; the normalization adopts the max-min normalization method to reduce the spectral values ​​to the range of 0 to 1.

[0017] Furthermore, in step 3, the number of key spectral bands obtained by screening through the linear kernel support vector machine model is 9; the spatial spectral fusion image is a hyperspectral image that retains only these 9 key spectral bands and completely preserves the two-dimensional spatial information of the leaf.

[0018] Furthermore, in step 4, the structure of the DenseNet201 model is modified as follows: the number of input channels of the first convolutional layer is adjusted to 9 to match the number of key spectral bands; the output dimension of the last fully connected layer is adjusted to 2 to adapt to the binary classification task; the full fine-tuning strategy adopts an adaptive moment estimation optimizer, the loss function is the cross-entropy loss function, and the activation function is the Softmax function; the training parameters are set as follows: initial learning rate of 0.01, the learning rate is decayed by a coefficient of 0.8 every 10 training epochs, the training batch size is 64, the total number of training epochs is 500, and the model's learnable parameters are saved according to the highest accuracy on the test set during training.

[0019] Furthermore, in step 4, the specific steps of the reproductive period stratification modeling strategy are as follows: First, use the spatial spectral fusion images of V8 and V10 in the training set to train dedicated sub-models respectively. The structure of the two sub-models is consistent with the modified DenseNet201 model. The training rounds of the sub-models are all set to 200, and the training parameters are consistent with the training parameters of the full fine-tuning strategy.

[0020] Then extract the second-to-last feature layer from the two sub-models and concatenate and fuse them to construct a fused feature layer;

[0021] A new fully connected layer is added based on the fusion feature layer, and 50 rounds of joint fine-tuning are performed. The training parameters of the joint fine-tuning are consistent with the training parameters of the sub-model, and finally the optimized early diagnosis model of nitrogen deficiency in maize is obtained.

[0022] Furthermore, in step 5, the three-dimensional model evaluation system includes three dimensions: classification accuracy, stability, and anti-interference capability. Classification accuracy is quantitatively evaluated by diagnostic accuracy, area under the receiver operating characteristic curve, and F1 score. Stability is evaluated by the fluctuation of diagnostic accuracy across rounds and fields. Anti-interference capability is evaluated by the diagnostic accuracy of the model on leaf samples with slight leaf wrinkles or minor instrument scanning deviations.

[0023] Furthermore, in step 5, the specific steps of gradient-weighted class activation mapping are as follows:

[0024] Extract the output feature map and corresponding gradient of the Denseblock4 layer in the DenseNet201 model, and perform global averaging of the gradient in the spatial domain to obtain the weight coefficient of each feature channel. The formula for calculating the weight coefficient is as follows:

[0025]

[0026] in For the first The feature channel corresponds to the first The weight coefficients of each category, This represents the number of pixels in the width direction of the feature map. This represents the number of pixels in the height direction of the feature map. The total spatial size of the feature map. is the pixel coordinate index along the width direction of the feature map. The pixel coordinate index in the height direction of the feature map. For the diagnostic model to the first The final output value for each category, For the first Output feature maps of each feature channel For the model number Class output value pair Gradient values ​​of feature maps for each feature channel;

[0027] The original feature map is reweighted using weight coefficients, and positive contribution features are retained by modifying the linear unit activation function to generate an initial localization map.

[0028] The initial positioning image is upsampled to the same size as the original blade image to obtain a spatial feature heatmap;

[0029] The heatmap was used as a weighting coefficient to reconstruct the average absorption spectrum of the leaf, and the separability of the reconstructed spectrum was verified by dimensionality reduction through principal component analysis.

[0030] Furthermore, in step 6, the specific logic of the graded diagnosis is as follows: the actual nitrogen content of the leaves corresponding to the no nitrogen deficiency level is not lower than the preset high threshold, and the confidence level of the model predicting high nitrogen is not lower than the preset high confidence threshold; the actual nitrogen content of the leaves corresponding to the mild nitrogen deficiency level is in the preset medium threshold range, and the confidence level of the model predicting low nitrogen is in the preset medium confidence range; the actual nitrogen content of the leaves corresponding to the severe nitrogen deficiency level is not higher than the preset low threshold, and the confidence level of the model predicting low nitrogen is not lower than the preset high confidence threshold.

[0031] Compared with existing technologies, this early diagnosis method for nitrogen deficiency in maize based on leaf spatial spectral characteristics has the following advantages:

[0032] I. This invention addresses the problems of traditional diagnostic methods neglecting spatial differences in leaf nitrogen content and failing to adapt to different early growth stages by integrating spatial and spectral characteristics of maize leaves from stages V8 to V10, combining linear kernel support vector machine to screen nine key bands, fully fine-tuning the DenseNet201 model, and employing a stratified modeling strategy based on growth stage. Key band screening eliminates redundant spectral information, improving computational efficiency, while stratified modeling adapts to the characteristic differences between leaves at stages V8 and V10. The entire approach does not require leaf destruction, avoiding the cumbersome procedures and long waiting times of traditional chemical testing. Its high accuracy across crop cycles and fields allows for timely detection of nitrogen deficiency in maize at its earliest stages, providing a clear basis for subsequent fertilization adjustments.

[0033] Second, this invention achieves model feature visualization through gradient-weighted activation mapping, combined with a three-dimensional evaluation system and field-based grading and diagnostic logic, solving the problems of existing deep learning models being difficult to interpret, lacking clear basis for diagnostic results, and having vague grading standards. Spatial feature heatmaps can intuitively display the key leaf regions of interest to the model, and principal component analysis verifies spectral differences, providing clear feature support for diagnostic results and avoiding the blind reliance on model output alone. Grading and diagnosis classifies different nitrogen deficiency levels based on nitrogen content and prediction confidence, accurately matching different levels of intervention needs and avoiding waste from excessive nitrogen fertilizer application or yield impact from insufficient application. The standardized pretreatment process is compatible with portable equipment and can be operated directly in the field without relying on complex laboratory conditions.

[0034] Other advantages, objectives and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination or study, or may be learned from the practice of the invention. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0036] Figure 1 This is the main flowchart of the early diagnosis method for nitrogen deficiency in maize based on the spatial spectral characteristics of leaves in this invention;

[0037] Figure 2 This is a flowchart of the hyperspectral image preprocessing process of the present invention;

[0038] Figure 3 This is a schematic diagram of the reproductive period stratification modeling strategy of the present invention. Detailed Implementation

[0039] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.

[0040] Example 1:

[0041] This embodiment uses spring-sown maize varieties as the experimental subject. An early diagnosis experiment of nitrogen deficiency in maize at the V8 to V10 stage was carried out in a maize experimental field. A portable leaf transmission hyperspectral imager was used to acquire leaf images. Through standardized preprocessing, key band screening with linear kernel support vector machine, construction of a fully fine-tuned DenseNet201 model, and visualization of gradient-weighted class activation mapping, a binary classification diagnosis of nitrogen deficiency in maize was achieved. The entire process followed the principle of non-destructive detection. The experiment was set up to be repeated three times to ensure the reliability and repeatability of the data. The parameters of each step were strictly matched with the preset parameter limits to verify the feasibility and accuracy of the basic diagnostic method.

[0042] like Figure 1 As shown in the embodiment of the present invention, the method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics includes steps 1 to 5, and the specific implementation process is as follows:

[0043] Step 1, Sample Collection and Labeling

[0044] The experimental field was selected from flat plots with uniform soil fertility. During the early vegetative growth stage of maize (V8 to V10), mature top leaves free from pests, diseases, and mechanical damage were selected from the field. Under clear, cloudless conditions from 8:00 AM to 12:00 PM local time each day, full-area transmission hyperspectral images of the leaves were collected using a portable leaf transmission hyperspectral imager. This imager has a visible-near-infrared spectral range of 460 nm to 950 nm, a spatial resolution of 0.2 mm, and a spectral resolution of 1.3 nm. It is equipped with a closed imaging cavity and a line-scan push-broom acquisition structure. During acquisition, the push-broom scan was performed smoothly along the midrib of the leaf to ensure that the leaf was flat and wrinkle-free and did not contact the inner wall of the imaging cavity. Simultaneously, the actual nitrogen content of each collected leaf was determined using the Kjeldahl method. Based on the nitrogen content detection results, the leaves were labeled as high-nitrogen and low-nitrogen. The high-nitrogen group was the normal nitrogen application treatment group, and the low-nitrogen group was the nitrogen-deficient treatment group. A total of 180 valid leaf hyperspectral images were collected, and the corresponding labels were completed.

[0045] Step 2, Hyperspectral Image Preprocessing

[0046] like Figure 2 As shown, the 180 acquired hyperspectral images underwent a multi-stage standardization process. First, band cropping was performed, removing edge noise bands from 460 nm to 490 nm and 890 nm to 950 nm, retaining only the effective band from 490 nm to 890 nm. Then, reference calibration was performed using a green reference plate for light source correction, according to the calibration formula. Calculate the original leaf transmission spectrum obtained from the data collection. Subtract the transmission spectrum corresponding to the dark background Then divide by the standard transmission spectrum corresponding to the green reference plate. Subtract the transmission spectrum corresponding to the dark background The difference was used to obtain the blade transmission spectrum after light source correction. This eliminates spectral errors caused by variations in light intensity. Next, leaf region segmentation is performed, using a binarization thresholding algorithm to separate the leaf region from the background region, setting background pixel values ​​to zero and retaining only the effective leaf region. After segmentation, spectral transformation is performed based on Beer's Law and the transformation formula. Calculate the transmission spectrum of the blade after light source correction. Standard transmission spectrum compared to the green reference plate The ratio is taken as the base 10 logarithm and then the opposite is taken to obtain the converted leaf absorption spectrum. This allows for a more intuitive reflection of the absorption characteristics of nitrogen within the leaf spectrum. Subsequently, multivariate scattering correction and smoothing / denoising are performed sequentially. The smoothing / denoising uses the Savitzky-Gore smoothing algorithm with a window length of 15 and a polynomial order of 1 to reduce random noise in the spectral curves. Next, data augmentation is performed, using a window size of 5 for resampling, random Gaussian blur, random vertical flip, random horizontal flip, and random rotation to improve the model's generalization ability. Bilinear interpolation is used to uniformly adjust the spatial dimensions of all leaf hyperspectral images to 128×64, ensuring image size consistency. Finally, max-min normalization is performed to shrink all spectral values ​​to the 0-1 range, resulting in standardized leaf hyperspectral images.

[0047] Step 3, Screening of key spectral bands

[0048] The average absorption spectra of all standardized leaf hyperspectral images were extracted and used as input data into a linear kernel support vector machine (LVM) model. To optimize the model's hyperparameters, a 5-fold cross-validation method was used to divide the dataset into five equal parts. One part was selected as the validation set, and the remaining four parts were used as the training set. Model training and validation were completed, and the optimal hyperparameters were determined after repeated iterations. Based on the optimized LVM model, the weight coefficients corresponding to each spectral band were extracted, and the nine key spectral bands with the highest weight coefficients were selected. Redundant spectral information was removed, and only these nine key spectral bands were retained, while preserving the complete two-dimensional spatial information of the leaves. Spatial spectral fusion images were generated, resulting in 180 spatial spectral fusion images, providing high-quality input data for subsequent model construction.

[0049] Step 4, Diagnostic Model Construction

[0050] 180 spatial spectral fusion images were randomly divided into training and test sets in an 8:2 ratio, with 144 images in the training set and 36 in the test set. The ratio of V8 to V10 and high-nitrogen to low-nitrogen samples was strictly maintained during the partitioning process to avoid sample imbalance that could lead to training bias. The DenseNet201 model was structurally modified by adjusting the number of input channels in the first convolutional layer to 9, matching the number of the 9 key spectral bands, and adjusting the output dimension of the last fully connected layer to 2 to adapt to the binary classification diagnostic task involving high-nitrogen and low-nitrogen samples. A full fine-tuning strategy was used to train the modified DenseNet201 model, with all network layers participating in parameter updates. An adaptive moment estimation optimizer was used, with cross-entropy loss and softmax activation. The initial learning rate was set to 0.01, decaying by 0.8 every 10 training epochs. The batch size was 64, and the total number of training epochs was 500. During training, the following methods were combined: Figure 3The stratified modeling strategy for reproductive period shown optimizes model performance. During training, the diagnostic accuracy of the test set is monitored in real time. The model learnable parameters are saved according to the highest accuracy of the test set, resulting in an early diagnostic model for nitrogen deficiency in maize.

[0051] Step 5, Model Visualization and Validation

[0052] Gradient-weighted class activation mapping is used to visualize model features. First, the output feature map and corresponding gradient of the Denseblock4 layer in the trained DenseNet201 model are extracted. This layer is the deep feature layer of the model, which can effectively fuse the spatial and spectral features of the leaves. The gradient is globally averaged in the spatial domain and calculated according to the weight coefficient formula. Calculate the weight coefficients for each feature channel, where This represents the number of pixels in the width direction of the feature map. This represents the number of pixels in the height direction of the feature map. is the pixel coordinate index along the width direction of the feature map. The pixel coordinate index in the height direction of the feature map. For the diagnostic model to the first The final output value for each category, For the first Output feature maps of each feature channel For the model number Class output value pair The gradient values ​​of the feature maps of each feature channel were calculated. The original feature maps were reweighted using the calculated weight coefficients, and positive contribution features were retained by modifying the linear unit activation function to generate an initial localization map. The initial localization map was upsampled to the same size as the original leaf image to obtain a spatial feature heatmap, which visually displays the key leaf regions of interest during model diagnosis. Simultaneously, a three-dimensional model evaluation system was used to verify the model's generalization ability. Through cross-cycle and cross-field trials, the model was evaluated from three dimensions: classification accuracy, stability, and anti-interference. The quantitative indicators for classification accuracy were a diagnostic accuracy rate of no less than 92%, an area under the receiver operating characteristic curve of no less than 0.94, and an F1 score of no less than 0.90. Stability was defined as the model's diagnostic accuracy fluctuation across cycles and fields not exceeding ±2%. Anti-interference was defined as the model's diagnostic accuracy for leaf samples with slight leaf wrinkles or minor instrument scanning deviations being no less than 85%. This embodiment underwent three repeated trials, and the average value of the cross-cycle and cross-field trials was taken. The results of the core evaluation indicators are shown in Table 1.

[0053] Table 1: Results (average) of core indicators of the three-dimensional evaluation system for the early diagnosis model of nitrogen deficiency in maize in Example 1

[0054] Evaluation Dimensions detection indicators numerical values Classification accuracy Diagnostic accuracy 93.89% Classification accuracy Area under receiver operating characteristic curve 0.956 Classification accuracy F1 score 0.942 stability Diagnostic accuracy fluctuation ±1.5% Anti-interference Diagnostic accuracy of low-quality samples 87.22%

[0055] Step 6, Field grading diagnosis

[0056] Field diagnostic applications were conducted in the experimental field and surrounding similar maize fields. Leaves from maize stages V8 to V10 were selected, and images were acquired and preprocessed using a portable leaf transmission hyperspectral imager following the same procedure as the training set. The resulting spatial spectral fusion images were input into a trained maize nitrogen deficiency early diagnosis model. The model output the diagnostic results of high and low nitrogen in the leaves and their corresponding confidence levels. Based on the actual nitrogen content of the leaves and the model's prediction confidence level, a graded diagnosis was performed. Specifically, the thresholds were as follows: no nitrogen deficiency level corresponds to an actual nitrogen content of leaves not less than 3.0% and a model prediction confidence level of high nitrogen not less than 0.9; mild nitrogen deficiency level corresponds to an actual nitrogen content of leaves between 2.0% and 3.0% and a model prediction confidence level of low nitrogen between 0.7 and 0.9; and severe nitrogen deficiency level corresponds to an actual nitrogen content of leaves not higher than 2.0% and a model prediction confidence level of low nitrogen not less than 0.9. Based on this, the leaves were divided into three levels: no nitrogen deficiency, mild nitrogen deficiency, and severe nitrogen deficiency, providing a direct basis for field nitrogen intervention.

[0057] This embodiment verifies the feasibility of the basic method by fully executing the entire process of early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics. The parameter settings for each step are reasonable and highly matched to the preset parameter range. The spatial spectral fusion image effectively preserves the core features of the leaves. The fully fine-tuned DenseNet201 model achieves high-accuracy binary classification diagnosis. Gradient-weighted class activation mapping makes the model's diagnostic process interpretable. The three-dimensional model evaluation system effectively verifies the model's generalization ability. The entire diagnostic process does not require leaf damage, the operation procedure is standardized, and it can be carried out directly in the field, avoiding the cumbersome procedures of traditional chemical testing. It solves the problem that traditional spot measurement methods cannot reflect the spatial differences in leaf nitrogen content. Experimental data proves that the diagnostic results of this method are accurate and reliable, and can effectively identify nitrogen deficiency characteristics in maize stages V8 to V10.

[0058] Example 2:

[0059] This embodiment uses spring-sown maize varieties as the experimental subjects and conducts an early diagnosis experiment on nitrogen deficiency in maize at stages V8 to V10 across multiple plots in maize experimental fields and ordinary planting fields. Based on the basic diagnostic methods, a growth stage stratified modeling strategy is incorporated, the model structure and training process are optimized, the feature verification link of gradient weighted class activation mapping visualization is strengthened, and the logic of tiered diagnosis is improved. The experiment is set up with 3 replicates to expand the sample size and further improve the adaptability and accuracy of the diagnostic method. The values ​​and units of all parameters are consistent with the preset parameter limits.

[0060] Step 1, Sample Collection and Labeling

[0061] Three ordinary planting fields with different fertility levels, including a maize experimental field, were selected as experimental plots. Spring-sown maize varieties V8 to V10 were used as the experimental subjects. During the early vegetative growth stage of maize, under clear, cloudless conditions from 8:00 AM to 12:00 PM local time, mature top leaves free from pests, diseases, and mechanical damage were selected. A portable leaf transmission hyperspectral imager was used to acquire full-area transmission hyperspectral images of the leaves. This imager has a visible-near-infrared spectral range of 460 nm to 950 nm, a spatial resolution of 0.2 mm, and a spectral resolution of 1.3 nm. The acquisition operation strictly followed the requirements of scanning along the midrib of the leaf, ensuring the leaf was flat and wrinkle-free, and avoiding contact with the inner wall of the imaging chamber. Simultaneously, the Kjeldahl method was used to determine the actual nitrogen content of each collected leaf. Two-level labels were created: high nitrogen and low nitrogen. Furthermore, based on the nitrogen content range, three-level labels were created: no nitrogen deficiency, mild nitrogen deficiency, and severe nitrogen deficiency. A total of 420 valid leaf hyperspectral images were collected, covering different plots, different growth stages, and different nitrogen nutrient levels, and corresponding labels were completed.

[0062] Step 2, Hyperspectral Image Preprocessing

[0063] A standardized preprocessing workflow, identical to that in the basic implementation, was performed on 420 hyperspectral images, sequentially including band cropping, reference calibration, leaf region segmentation, spectral transformation, multivariate scattering correction, smoothing and denoising, data augmentation, and normalization. Band cropping retained the effective band from 490 nm to 890 nm, and reference calibration was performed according to the formula... After completing the light source calibration, the spectral transformation is performed according to the formula. Transmission spectra are converted into absorption spectra. Smoothing and denoising are performed using the Savitzky-Gore smoothing algorithm with a window length of 15 and a polynomial order of 1. Data augmentation includes window resampling with a window size of 5 and various random transformation operations. The image spatial size is unified to 128×64 through bilinear interpolation, and the spectral values ​​are reduced to the range of 0 to 1 by max-min normalization. This ensures that the quality of the preprocessed data is consistent with that of the basic embodiment, resulting in a standardized hyperspectral image of the leaf.

[0064] Step 3, Screening of key spectral bands

[0065] The average absorption spectrum of leaves was extracted from all standardized leaf hyperspectral images and input into a linear kernel support vector machine model. The model hyperparameters were optimized using a 5-fold cross-validation method. After iteration, the optimal model parameters were determined. The weight coefficients of each spectral band were extracted, and the nine key spectral bands with the highest weight coefficients were selected. These nine key spectral bands were retained, and the two-dimensional spatial information of the leaves was fully preserved. 420 spatial spectral fusion images were generated to ensure that the images simultaneously possess core spectral features and complete spatial features, providing a data foundation for hierarchical modeling of the growth period.

[0066] Step 4, Diagnostic Model Construction

[0067] 420 spatial spectral fusion images were divided into training and testing sets in an 8:2 ratio, with 336 images in the training set and 84 images in the testing set. The ratio of V8 to V10 periods and high-nitrogen to low-nitrogen samples was maintained during the partitioning. The DenseNet201 model was structurally modified by adjusting the input channel number of the first convolutional layer to 9 and the output dimension of the last fully connected layer to 2, adapting it to the binary classification diagnostic task. A reproductive stage-based modeling strategy was adopted for model training. First, the V8 and V10 spatial spectral fusion images in the training set were separated and used to train dedicated sub-models for V8 and V10 periods, respectively. The structures of both sub-models were consistent with the modified DenseNet201 model. The training epochs for each sub-model were set to 200, and the training parameters were consistent with the full fine-tuning strategy, i.e., using an adaptive moment estimation optimizer, cross-entropy loss function, and softmax activation function, with an initial learning rate of 0.01. The learning rate was decayed by a coefficient of 0.8 every 10 training epochs, and the training batch size was 64. After the two sub-models are trained, the penultimate feature layer of each sub-model is extracted. This layer is the core feature layer of the model and contains rich leaf feature information. The two feature layers are spliced ​​and fused to construct a fused feature layer. A new fully connected layer is added based on the fused feature layer, and 50 rounds of joint fine-tuning are performed. All training parameters of the joint fine-tuning are consistent with the training parameters of the sub-models. During the training process, the learnable parameters of the model are saved according to the highest accuracy on the test set, resulting in the optimized early diagnosis model of nitrogen deficiency in maize.

[0068] Step 5, Model Visualization and Validation

[0069] Building upon the basic implementation, the model visualization and verification process is enhanced. First, the output feature map and corresponding gradient of the Denseblock4 layer in the DenseNet201 model are extracted following the complete gradient-weighted activation mapping process. Then, the weight coefficients for each feature channel are calculated using the following formula: A spatial feature heatmap of the same size as the original leaf image was generated to visually display the key leaf regions of interest to the model. This heatmap was then used as a weighting coefficient to reconstruct the average absorption spectrum of the leaves. Principal component analysis was used for dimensionality reduction to verify the separability of the reconstructed spectrum and further confirm the effectiveness of the model's feature extraction. Model generalization validation employed a three-dimensional model evaluation system, conducting multi-dimensional validation across crop cycles and fields based on classification accuracy, stability, and anti-interference capabilities. Classification accuracy was quantified as a diagnostic accuracy of no less than 92%, an area under the receiver operating characteristic (AUC) curve of no less than 0.94, and an F1 score of no less than 0.90. Stability was defined as a fluctuation in diagnostic accuracy across crop cycles and fields not exceeding ±2%. Anti-interference capability was defined as a diagnostic accuracy of no less than 85% for leaf samples with slight leaf wrinkles or minor instrument scanning deviations. This embodiment underwent three repeated experiments, and the average value of the cross-crop and cross-field experiments was taken. The results of the core evaluation indicators are shown in Table 2.

[0070] Table 2: Results (average values) of the core indicators of the three-dimensional evaluation system for the early diagnosis model of nitrogen deficiency in maize in Example 2.

[0071] Evaluation Dimensions detection indicators numerical values Classification accuracy Diagnostic accuracy 96.43% Classification accuracy Area under receiver operating characteristic curve 0.978 Classification accuracy F1 score 0.966 stability Diagnostic accuracy fluctuation ±0.8% Anti-interference Diagnostic accuracy of low-quality samples 91.19%

[0072] Step 6, Field grading diagnosis

[0073] Field diagnostic applications were conducted in the experimental plots and surrounding maize-growing areas. For maize leaves at stages V8 to V10 in different fertility plots, image acquisition and preprocessing were performed according to a standardized process. Spatial spectral fusion images were input into an optimized diagnostic model, which outputs classification results of leaf nitrogen nutrition and corresponding confidence levels. A strict grading diagnostic logic was implemented based on the actual nitrogen content of the leaves and the model's predicted confidence levels. Specifically, the thresholds were: no nitrogen deficiency corresponding to an actual nitrogen content of no less than 3.0% and a model prediction confidence level of high nitrogen of no less than 0.9; mild nitrogen deficiency corresponding to an actual nitrogen content of 2.0% to 3.0% and a model prediction confidence level of low nitrogen of 0.7 to 0.9; and severe nitrogen deficiency corresponding to an actual nitrogen content of no more than 2.0% and a model prediction confidence level of low nitrogen of no less than 0.9. Based on the grading results, precise classification criteria were provided for field nitrogen application, achieving accurate matching between diagnostic results and field interventions.

[0074] This embodiment incorporates a stratified modeling strategy based on growth stages into the basic diagnostic method, effectively adapting to the differences in leaf characteristics between maize stages V8 and V10, thus improving the model's diagnostic adaptability to leaves at different growth stages. Cross-plot experimental design further validates the model's generalization ability. The feature verification step of gradient-weighted activation mapping is strengthened, and principal component analysis after spectral reconstruction further validates the effectiveness of model feature extraction. The improved tiered diagnostic logic makes the diagnostic results more aligned with actual field application needs. The entire optimization method maintains its core advantages of being non-destructive and field-operable. Parameter settings are highly matched to preset limits, and multi-dimensional verification demonstrates improved diagnostic accuracy and stability, making it applicable to early diagnosis of nitrogen deficiency in maize stages V8 to V10 in different fertility plots.

[0075] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics, characterized in that, The specific steps of this method are as follows: Step 1, Sample collection and labeling: During the early vegetative growth stage of maize V8 to V10, select the top mature leaves of disease-free plants in the field, and use a portable leaf transmission hyperspectral imager to collect full-area transmission hyperspectral images of the leaves. At the same time, use the Kjeldahl method to determine the actual nitrogen content of the corresponding leaves and complete the binary labeling of high nitrogen and low nitrogen leaves. Step 2, hyperspectral image preprocessing: The acquired hyperspectral images are sequentially processed by band cropping, reference calibration, leaf region segmentation, spectral transformation, multivariate scattering correction, smoothing and denoising, data augmentation and normalization to obtain standardized leaf hyperspectral images. Step 3, Key Spectral Band Screening: Input the preprocessed average absorption spectrum of the leaf into the linear kernel support vector machine model. After optimizing the hyperparameters through 5-fold cross-validation, extract the model weight coefficients and screen a preset number of key spectral bands to generate a spatial spectral fusion image that retains the complete spatial information of the leaf. Step 4, Diagnostic model construction: Divide the spatial spectral fusion images into training and test sets in an 8:2 ratio, while maintaining the same sample ratio between V8 and V10, and between high nitrogen and low nitrogen. After structural modifications to the DenseNet201 model, a full fine-tuning strategy was used for training. During the training process, a hierarchical modeling strategy based on the reproductive period was combined to optimize the model performance, resulting in an early diagnosis model for nitrogen deficiency in maize. Step 5, Model Visualization and Validation: A heat map of leaf spatial features is generated by gradient weighted class activation mapping to visualize the model features. At the same time, a three-dimensional model evaluation system is adopted to verify the model's generalization ability through cross-cycle and cross-field experiments. Step 6, field grading diagnosis: Input the leaf images collected in the field and preprocessed in accordance with the training set into the trained diagnostic model. Based on the actual nitrogen content of the leaves and the confidence of the model prediction, the leaves are divided into three levels: no nitrogen deficiency, mild nitrogen deficiency, and severe nitrogen deficiency.

2. The method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics according to claim 1, characterized in that, In step 1, the visible-near-infrared spectral band of the portable leaf transmission hyperspectral imager is 460 nm to 950 nm, with a spatial resolution of not less than 0.2 mm and a spectral resolution of not more than 1.3 nm. The imager is equipped with a closed imaging cavity and a line-scan push-broom acquisition structure. Leaf image acquisition is carried out in a clear, cloudless environment from 8:00 to 12:00 local time. During acquisition, a push-broom scan is performed along the midrib of the leaf to ensure that the leaf is flat and wrinkle-free and does not contact the inner wall of the imaging cavity.

3. The method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics according to claim 1, characterized in that, In step 2, the band clipping is performed to retain the effective band from 490 nm to 890 nm; the reference calibration uses a green reference plate for light source correction, and the correction formula is: in The light source corrected transmission spectrum of the blade. The original leaf transmission spectrum was collected. The transmission spectrum corresponding to a dark background. This is the standard transmission spectrum corresponding to the green reference plate; the spectral transformation is based on Beer's Law to convert the transmission spectrum into an absorption spectrum, and the transformation formula is: in The converted leaf absorption spectrum is shown below. The light source corrected transmission spectrum of the blade. The standard transmission spectrum of the green reference plate is used; the Savitzky-Gore smoothing algorithm with a window length of 15 and a polynomial order of 1 is used for smoothing and denoising; data augmentation includes window resampling with a window size of 5, random Gaussian blur, random vertical flip, random horizontal flip, and random rotation; the spatial size of all leaf hyperspectral images is uniformly adjusted to 128×64 by bilinear interpolation; the normalization adopts the max-min normalization method to reduce the spectral values ​​to the range of 0 to 1.

4. The method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics according to claim 1, characterized in that, In step 3, the number of key spectral bands obtained by screening through the linear kernel support vector machine model is 9; the spatial spectral fusion image is a hyperspectral image that retains only these 9 key spectral bands and completely preserves the two-dimensional spatial information of the leaf.

5. The method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics according to claim 4, characterized in that, In step 4, the structure of the DenseNet201 model is modified as follows: the number of input channels of the first convolutional layer is adjusted to 9 to match the number of key spectral bands; the output dimension of the last fully connected layer is adjusted to 2 to adapt to the binary classification task; the full fine-tuning strategy adopts the adaptive moment estimation optimizer, the loss function is the cross-entropy loss function, and the activation function is the softmax function; the training parameters are set as follows: initial learning rate 0.01, the learning rate is decayed by a coefficient of 0.8 every 10 training epochs, the training batch size is 64, the total training epochs are 500, and the learnable parameters of the model are saved according to the highest accuracy on the test set during training.

6. The method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics according to claim 5, characterized in that, In step 4, the specific steps of the reproductive period stratification modeling strategy are as follows: First, use the spatial spectral fusion images of V8 and V10 in the training set to train dedicated sub-models. The structure of the two sub-models is consistent with the modified DenseNet201 model. The training rounds of the sub-models are all set to 200, and the training parameters are consistent with the training parameters of the full fine-tuning strategy. Then extract the second-to-last feature layer from the two sub-models and concatenate and fuse them to construct a fused feature layer; A new fully connected layer is added based on the fusion feature layer, and 50 rounds of joint fine-tuning are performed. The training parameters of the joint fine-tuning are consistent with the training parameters of the sub-model, and finally the optimized early diagnosis model of nitrogen deficiency in maize is obtained.

7. The method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics according to claim 1, characterized in that, In step 5, the three-dimensional model evaluation system includes three dimensions: classification accuracy, stability, and anti-interference ability. Classification accuracy is quantitatively evaluated by diagnostic accuracy, area under the receiver operating characteristic curve, and F1 score. Stability is evaluated by the fluctuation of diagnostic accuracy across rounds and fields. Anti-interference ability is evaluated by the diagnostic accuracy of the model on leaf samples with slight leaf wrinkles or minor instrument scanning deviations.

8. The method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics according to claim 1, characterized in that, In step 5, the specific steps of gradient-weighted class activation mapping are as follows: Extract the output feature map and corresponding gradient of the Denseblock4 layer in the DenseNet201 model, and perform global averaging of the gradient in the spatial domain to obtain the weight coefficient of each feature channel. The formula for calculating the weight coefficient is as follows: in For the first The feature channel corresponds to the first The weight coefficients of each category, This represents the number of pixels in the width direction of the feature map. This represents the number of pixels in the height direction of the feature map. The total spatial size of the feature map. This refers to the pixel coordinate index along the width direction of the feature map. The pixel coordinate index in the height direction of the feature map. For the diagnostic model to the first The final output value for each category, For the first Output feature maps of each feature channel For the model number Class output value pair Gradient values ​​of feature maps for each feature channel; The original feature map is reweighted using weight coefficients, and positive contribution features are retained by modifying the linear unit activation function to generate an initial localization map. The initial positioning image is upsampled to the same size as the original blade image to obtain a spatial feature heatmap; The heatmap was used as a weighting coefficient to reconstruct the average absorption spectrum of the leaf, and the separability of the reconstructed spectrum was verified by dimensionality reduction through principal component analysis.

9. The method for early diagnosis of nitrogen deficiency in maize based on leaf spatial spectral characteristics according to claim 1, characterized in that, In step 6, the specific logic of the graded diagnosis is as follows: the actual nitrogen content of the leaves corresponding to the no nitrogen deficiency level is not lower than the preset high threshold, and the confidence level of the model predicting high nitrogen is not lower than the preset high confidence threshold; the actual nitrogen content of the leaves corresponding to the mild nitrogen deficiency level is in the preset medium threshold range, and the confidence level of the model predicting low nitrogen is in the preset medium confidence range. The actual nitrogen content in the leaves corresponding to the severe nitrogen deficiency level is not higher than the preset low threshold, and the confidence level of the model prediction of low nitrogen is not lower than the preset high confidence threshold.