Wheat leaf layer nitrogen content estimation method and system based on hyperspectral image

By segmenting hyperspectral images and constructing an undirected graph network, and using graph neural networks to extract deep features, the problem of insufficient spatial structure modeling in wheat leaf nitrogen content estimation was solved, achieving high-precision and generalizable nitrogen content estimation.

CN121482618AActive Publication Date: 2026-02-06INNER MONGOLIA AGRICULTURAL UNIVERSITY +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610015340.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-07
Publication Date
2026-02-06
Estimated Expiration
2046-01-07

AI Technical Summary

Technical Problem

Existing technologies struggle to explicitly model the spatial structure of the wheat canopy, making it difficult for wheat leaf nitrogen content estimation models to meet the need for accurate monitoring in complex field environments. Furthermore, the models lack generalization ability and experience significant performance degradation when applied to new regions.

Method used

By segmenting hyperspectral images into homogeneous regions, constructing an undirected graph network, extracting deep features using graph neural networks, and combining this with a supervised learning regression model, we can achieve explicit modeling of the spatial structure of wheat canopy and estimation of nitrogen content.

Benefits of technology

It improves the accuracy of wheat leaf nitrogen content estimation and the model's generalization ability, enabling the rapid acquisition of high-precision estimation results in new regions and reducing reliance on large amounts of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482618A_ABST
    Figure CN121482618A_ABST
Patent Text Reader

Abstract

The invention provides a wheat leaf layer nitrogen content estimation method and system based on a hyperspectral image, relates to the technical field of wheat leaf layer nitrogen content detection, and aims to solve the problems of insufficient estimation precision and weak model generalization ability caused by neglecting a crop canopy space structure in the prior art. The method comprises the following steps: acquiring a hyperspectral image of a wheat canopy, constructing a homogeneous region by using superpixel segmentation, and extracting node features of fused spectrum and spatial texture; constructing graph data representing canopy space topology by taking the region adjacency relation as an edge; applying a pre-trained graph neural network, and generating a deep feature vector containing a spatial context by aggregating adjacent node information; and finally, estimating the nitrogen content based on the deep features by using a regression model, and synthesizing a spatial distribution diagram. By explicitly modeling the spatial relationship of the wheat canopy, the nitrogen content nondestructive monitoring with high precision and strong generalization capability is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of wheat leaf layer nitrogen content detection, in particular to a wheat leaf layer nitrogen content estimation method and system based on hyperspectral images. BACKGROUND

[0002] Non-destructive estimation of wheat leaf layer nitrogen content using hyperspectral remote sensing technology is the key to realizing smart agriculture and precision fertilization. The existing technology generally extracts various spectral features (such as vegetation index, spectral position and shape feature) from hyperspectral images and establishes a regression model to achieve this. These methods establish a statistical relationship between spectral reflectance and nitrogen content to some extent. However, such handcrafted feature-based schemes have inherent limitations and cannot meet the demand for accurate monitoring in complex field environments.

[0003] In the prior art, the invention patent with the authorization publication number CN112557393B attempts to introduce a convolutional neural network to extract deep features, but its essence is to treat the image as a regular two-dimensional pixel grid for processing. This method cannot explicitly represent and utilize the inherent irregular topological structure of the wheat canopy, such as the spatial adjacency, competition, and stress diffusion relationship between leaf clusters. The crop canopy is a complex three-dimensional structure, and the spatial heterogeneity and interaction within it significantly modulate the spectral signal. Ignoring this structural information makes it difficult for the model to distinguish between nitrogen deficiency caused by spatial competition and spectral anomalies caused by soil background and patchy diseases. In addition, end-to-end model training extracts features that are highly coupled with the specific distribution of training data. When the model is applied to new planting areas with distribution differences, the model performance often decreases significantly due to the lack of robust modeling of universal spatial relationships.

[0004] Therefore, there is an urgent need in the art for a new method that can explicitly model the spatial structure of the wheat canopy, extract robust features with strong generalization ability, and achieve high-precision nitrogen content estimation based on this. SUMMARY

[0005] The purpose of the present application is to provide a wheat leaf layer nitrogen content estimation method and system based on hyperspectral images to solve the problems raised in the background art.

[0006] To achieve the above purpose, the present application provides the following technical solutions: A wheat leaf layer nitrogen content estimation method and system based on hyperspectral images, the specific steps comprising: Step 1: Obtain the hyperspectral image of the target wheat canopy and segment the image to obtain several homogeneous regions. Take each homogeneous region as a graph node to construct an undirected graph. Extract the spectral features and spatial texture features corresponding to the graph nodes in the image as the initial features of the graph nodes. Step 2: Based on the spatial adjacency relationship between the nodes in each graph, add edges to the undirected graph to form an undirected graph network, and construct the first graph data representing the spatial structure of the wheat canopy based on the undirected graph network; Step 3: Input the first graph data into the pre-trained feature extraction model. The feature extraction model aggregates the initial features of each graph node and its edge connection relationship through neighborhood information. After iterative updates, it outputs the deep feature vector of each graph node to form the second graph data. Step 4: Input the deep feature vectors of each graph node in the second graph data into the pre-established nitrogen content estimation model to obtain the estimated value of wheat leaf nitrogen content in the region corresponding to each graph node. Integrate the estimated values ​​of all graph nodes to generate a spatial distribution map of wheat leaf nitrogen content.

[0007] Furthermore, the specific method for segmenting hyperspectral images into several homogeneous regions is as follows: extract the reflectance of all pixels in the hyperspectral image in the red and near-infrared bands to form the two-dimensional spectral features of each pixel; measure the spectral feature similarity and spatial distance of each pixel based on a linear iterative clustering algorithm, and aggregate pixels whose spectral feature similarity and spatial distance meet the preset requirements into homogeneous regions.

[0008] Furthermore, the spectral features are extracted as follows: for each homogeneous region, the red edge position is determined by the first derivative method based on the reflectance of all pixels within it in the red edge sensitive band; and the average reflectance of all pixels in the homogeneous region in the red edge sensitive band and the near-infrared band is calculated, and the normalized red edge index is obtained based on the average reflectance. The spatial texture features are extracted as follows: the reflectance of all pixels in the hyperspectral image in the near-infrared band is extracted, a near-infrared grayscale image is constructed, and grayscale co-occurrence matrices corresponding to each homogeneous region are generated. The energy, contrast and homogeneity of each grayscale co-occurrence matrix are calculated. The red edge position, the normalized red edge index, and the energy, contrast, and homogeneity of the gray-level co-occurrence matrix are used to form a multidimensional array, which serves as the initial feature of a graph node.

[0009] Furthermore, the spatial adjacency relationship refers to the fact that the boundaries of two homogeneous regions are directly adjacent in space, and the method of adding edges in the undirected graph is as follows: extract the boundary cells of each homogeneous region to form a boundary cell set; for any two homogeneous regions, determine whether there are any identical cells in their respective boundary cell sets; if so, establish an undirected edge between the graph node indices corresponding to the two homogeneous regions; traverse all homogeneous regions to generate an edge relationship list. The first graph data includes a graph node feature matrix and an edge relationship list; the graph node feature matrix is ​​composed of the initial features of all graph nodes.

[0010] Furthermore, the feature extraction model is a graph neural network model, and its pre-training adopts a mask feature reconstruction method, the specific steps of which are as follows: Collect historical wheat canopy hyperspectral images covering multiple scenes. For each image, perform steps such as segmenting homogeneous regions, adding undirected edges, and constructing graph data. For each constructed historical graph data, select a number of graph nodes to form the first validation set, and the remaining graph nodes to form the first training set. For each graph data in the first training set, randomly mask the initial features of some of the graph nodes; Using a graph neural network model, the initial features of nodes in a masked graph are predicted based on the initial features of nodes in the unmasked graph and a list of edge relationships. The mean squared error between the model's predicted results and the initial features is used as the loss function, and the parameters of the graph neural network model are optimized through the backpropagation algorithm. After each round of training, the prediction loss of the model is calculated based on the first validation set; Repeat the above steps until the model loss converges. Then, fix the model parameters obtained at this point and use them as the trained feature extraction model.

[0011] Furthermore, the nitrogen content estimation model is a supervised learning regression model, and its pre-training method is as follows: We collected historical wheat canopy hyperspectral images covering multiple scenes. For each image, we performed steps such as segmenting homogeneous regions, adding undirected edges, and constructing graph data. We selected all homogeneous regions with measured nitrogen content values ​​and used their corresponding graph node and edge relationship list as the ground truth dataset. We then divided the ground truth dataset into a second training set and a second validation set. Input the graph data from the ground truth dataset into the feature extraction model, and output the deep feature vector of each graph node; The supervised learning regression model is trained by taking the deep feature vectors of the graph nodes in the second training set as input and the corresponding measured nitrogen content as the regression target. The mean square error between the predicted and measured nitrogen content values ​​was used as the loss function, and the parameters of the supervised learning regression model were optimized through the backpropagation algorithm. After each round of training, the prediction loss of the model is calculated based on the second validation set; Repeat the above steps until the model loss converges. Fix the model parameters obtained at this point as the trained nitrogen content estimation model.

[0012] Furthermore, the convergence of the model loss means that the prediction loss of the feature extraction model on the first validation set and the prediction loss of the nitrogen content estimation model on the second validation set do not decrease in consecutive rounds.

[0013] Furthermore, the specific steps for generating the spatial distribution map of nitrogen content in wheat leaves are as follows: The nitrogen content estimation value output by the nitrogen content estimation model for each graph node is assigned to each pixel in the corresponding homogeneous region of that node, and the interpolation method is used to perform interpolation calculations for blank pixels that do not belong to any homogeneous region. The estimated nitrogen content values ​​of all pixels are arranged into a two-dimensional matrix, corresponding one-to-one with each pixel; Based on the preset nitrogen content-color mapping relationship, the numerical matrix is ​​converted into a color matrix, and a spatial distribution map of nitrogen content in wheat leaf layer is generated based on the color matrix.

[0014] The present invention also provides a wheat leaf layer nitrogen content estimation system based on hyperspectral imagery. This system is used to execute the aforementioned wheat leaf layer nitrogen content estimation method based on hyperspectral imagery, and includes: Feature extraction module: used to acquire hyperspectral images of the target wheat canopy and segment the images to obtain several homogeneous regions. An undirected graph is constructed with each homogeneous region as a graph node. The spectral features and spatial texture features corresponding to the graph nodes are extracted from the images and used as the initial features of the graph nodes. Graph data construction module: Used to add edges to an undirected graph to form an undirected graph network based on the spatial adjacency relationship between each graph node, and to construct the first graph data representing the spatial structure of wheat canopy based on the undirected graph network; Graph data augmentation module: It is used to input the first graph data into the pre-trained feature extraction model, and aggregate the neighborhood information of the initial features and edge connections of each graph node through the feature extraction model. After iterative update, it outputs the deep feature vector of each graph node to form the second graph data. The estimation and integration module is used to input the deep feature vectors of each graph node in the second graph data into the pre-established nitrogen content estimation model, obtain the estimated value of wheat leaf nitrogen content in the region corresponding to each graph node, integrate the estimated values ​​of all graph nodes, and generate a spatial distribution map of wheat leaf nitrogen content.

[0015] Compared with the prior art, the beneficial effects of the present invention are: This invention achieves explicit modeling of the spatial topology of wheat canopy, improving feature representation capabilities and estimation accuracy. By segmenting hyperspectral images into homogeneous regions and constructing a graph structure, this invention, for the first time, explicitly and mathematically expresses the spatial adjacency and interaction relationships of wheat canopy in the form of "node-edge" graph data. Through learning this structure using a graph neural network, the model can automatically aggregate neighborhood information and generate "deep feature vectors" containing rich spatial context. These features not only include the spectral attributes of the nodes themselves but also encode their local environmental information within the entire canopy structure, thus enabling a more accurate inference of the true leaf nitrogen content and effectively overcoming the high misclassification rate of traditional methods in complex, spatially heterogeneous regions.

[0016] This invention enhances the model's generalization ability and transferability. The two-level architecture of "graph neural network feature extractor and nitrogen content estimator" decouples spatial relationship learning from specific tasks. During the pre-training phase, a self-supervised task enables the graph neural network to extract universal spatial correlation patterns from wheat canopy structures. In practical applications, the feature extractor parameters can be fixed to serve as a general module. When applied to new regions, only a small number of new samples are needed to fine-tune the nitrogen content estimator to quickly obtain a high-precision model, greatly reducing reliance on large amounts of data from new regions. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the overall method flow of the present invention; Figure 2 This is a schematic diagram of undirected graph construction provided in an embodiment of the present invention; Figure 3 This is a spatial distribution map of nitrogen content provided in an embodiment of the present invention; Figure 4 This is a structural block diagram of the overall system of the present invention. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.

[0019] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0020] Example: Please see Figures 1 to 3 The present invention provides a technical solution: A method for estimating nitrogen content in wheat leaf layer based on hyperspectral imagery, comprising the following steps: Step 1: Acquire hyperspectral images of the target wheat canopy and segment the images to obtain several homogeneous regions. Construct an undirected graph with each homogeneous region as a graph node. Extract the spectral features and spatial texture features corresponding to the graph nodes from the images as the initial features of the graph nodes.

[0021] The spectral reflectance curve of each pixel in a hyperspectral image contains rich spectral information and can be used to reflect changes in nitrogen content in wheat leaves. However, due to factors such as the complex spatial structure of the crop canopy, uneven illumination, and mutual shading between leaves, the spectrum of a single pixel is easily affected by noise and cannot reflect the overall characteristics of the region. Therefore, this embodiment first segments the hyperspectral image into homogeneous regions with similar spectral and spatial attributes. Pixels within each homogeneous region have high spectral and spatial consistency, while the boundaries between homogeneous regions remain clear. Subsequent feature extraction is performed on a homogeneous region-by-region basis, which improves the stability and representativeness of the features.

[0022] Based on this, each homogeneous region is treated as a graph node, and an undirected graph network is constructed based on these nodes. The aim is to transform the natural spatial organization structure of the wheat canopy into a computable and learnable graph data representation. This design overcomes the problem of insufficient representation of the internal structure of the canopy by traditional pixel-level processing methods, and is more in line with the biological nature of the wheat canopy, which is composed of multiple relatively independent functional units with similar spectra and structures (such as leaf clusters and tiller groups).

[0023] Furthermore, the specific method for segmenting hyperspectral images into several homogeneous regions is as follows: extract the reflectance of all pixels in the hyperspectral image in the red and near-infrared bands to form the two-dimensional spectral features of each pixel; measure the spectral feature similarity and spatial distance of each pixel based on a linear iterative clustering algorithm, and aggregate pixels whose spectral feature similarity and spatial distance meet the preset requirements into homogeneous regions.

[0024] Since hyperspectral images are essentially full-spectrum reflectance data for each pixel, it is impossible to directly extract effective structural features and model spatial relationships from the entire image. Therefore, this embodiment first preprocesses the hyperspectral image by extracting the reflectance values ​​of each pixel in the red and near-infrared bands to construct two-dimensional spectral features. The red and near-infrared bands selected in this embodiment are key regions with clear physiological indicative significance in the spectral response of vegetation. The red band is located in the strong absorption range of chlorophyll, and its reflectance is closely related to the chlorophyll content of leaves; the near-infrared band is highly sensitive to the internal structure and biomass of leaves. By combining the reflectance of each pixel in these two bands into two-dimensional spectral features, a spectral feature space that combines physiological state representation and structural information description is constructed. Based on this two-dimensional spectral feature, pixel similarity measurement and region merging can more accurately aggregate wheat canopy pixels with consistent spectral responses and spatial continuity into homogeneous regions, thereby providing a reliable spatial unit foundation for subsequent graph structure construction with regions as nodes.

[0025] Based on the construction of the two-dimensional spectral features of each pixel, this embodiment employs the Linear Iterative Clustering (SLIC) algorithm for superpixel segmentation of the hyperspectral image. This algorithm achieves clustering under dual spectral and spatial constraints by jointly measuring the similarity between pixels in the two-dimensional spectral feature space and their proximity in the image coordinate space. Its aim is to generate superpixel regions with closely fitting boundaries and homogeneous internal structures, ensuring that pixels within each region exhibit highly consistent spectral responses in the red and near-infrared bands, and a continuous and compact spatial distribution.

[0026] The specific method for segmenting hyperspectral images into several homogeneous regions is as follows: Read the basic parameters of the hyperspectral image, including width W, height H, and resolution r, and calculate the area A actually covered by the image. The calculation formula is as follows: ; Based on the characteristics of the wheat canopy, the area S of the target superpixel region is defined, which is the area of ​​a cluster of wheat or a local continuous leaf region; the number K of cluster centers is calculated using the formula: ; The formula for calculating the interval l of cluster centers is: ; Extracting the two-dimensional spectral features of each pixel from hyperspectral images, specifically the reflectance in the red band. and reflectivity in the near-infrared band ,in This represents the reflectance value of a pixel at a wavelength of 670nm. This represents the reflectance value of a pixel at a wavelength of 800nm.

[0027] Setting the initial cluster centers: On the hyperspectral image, with the upper left corner of the image as the origin, draw a sampling grid along the row and column directions at intervals l. Use the intersection of the grid as the initial cluster centers, generating a total of K initial center coordinates, forming the initial center set, denoted as K0. , Represents the coordinates of the i-th original center; Optimize the original cluster centers: For Let l be the center of a square optimized neighborhood. Within this optimized neighborhood, the coordinates of any pixel satisfy the following: ; For the optimized neighborhood of each original center, calculate the mean of the two-dimensional spectral features of all pixels within the neighborhood, and calculate the spectral Euclidean distance from each pixel to this mean of two-dimensional spectral features. The calculation formula is as follows: ; ; Let represent the average red band reflectance and the average near-infrared band reflectance of all pixels in the optimized neighborhood of the i-th original center, respectively. This indicates the number of pixels in the optimized neighborhood; These represent the red light band reflectance and the near-infrared band reflectance of the j-th pixel within the optimized neighborhood, respectively. This represents the spectral Euclidean distance of the j-th pixel.

[0028] Within the optimized neighborhood of each original center, the pixel with the smallest spectral Euclidean distance is selected as the optimized initial cluster center, forming the initial center set, denoted as . , Represents the coordinates of the i-th initial center; Assigning cells: For A square search neighborhood with side length 2l is defined centered on the pixel. Within this search neighborhood, the coordinates of any pixel satisfy the following: ; For the search neighborhood of each initial center, calculate the spectral distance, spatial distance, and combined distance from each pixel in the neighborhood to the initial center. The calculation formula is as follows: ; ; ; as well as Let represent the spectral distance, spatial distance, and combined distance from the j-th pixel to the i-th initial center in the search neighborhood of the i-th initial center, respectively. These represent the red light band reflectance and the near-infrared band reflectance of the pixel, respectively. These represent the red light band reflectance and the near-infrared band reflectance of the initial center, respectively. This represents the x and y coordinates of the pixel. Represent the x and y coordinates of the initial center; This indicates the preset spectral weights.

[0029] After performing the above calculations for the search neighborhoods of all initial centers, for each pixel in the hyperspectral image, compare the comprehensive distance between the pixel and all the initial centers corresponding to its covering search neighborhoods, and assign it to the superpixel group corresponding to the initial center with the smallest comprehensive distance, forming K superpixel sets. Each superpixel set contains all pixels that are closest to each initial center, as expressed by: , Let represent the set of superpixels corresponding to the i-th initial center, and j represent the j-th pixel belonging to that set. This represents the combined distance from the pixel to the i-th initial center.

[0030] Update cluster centers: Start iterative updates from the initial cluster centers, the initial center set The corresponding round number t is 0. After each update of the cluster centers, the round number is incremented by 1. During each update, for each superpixel set, the mean spatial coordinates and mean spectral features of all pixels within the set are calculated and used as parameters for the next iteration. The calculation formula is as follows: ; ; Indicates the x and y coordinates of the i-th cluster center in the next iteration. This indicates its reflectivity in the red light band and its reflectivity in the near-infrared band; This represents the number of pixels in the i-th superpixel set in the current round; Represents the x and y coordinates of the j-th cell in the set. This indicates its reflectivity in the red light band and the near-infrared band.

[0031] The cluster center update in each iteration essentially involves first assigning pixels to the nearest center to form multiple superpixel sets, calculating the "average position" and "average spectral features" within each superpixel set, and using these two average values ​​to replace the original cluster center as the new center for the next iteration. This process is repeated until the center position no longer changes significantly. Finally, the superpixel sets corresponding to each cluster center are output as each homogeneous region.

[0032] In the process of segmenting homogeneous regions, two important parameters need to be set: the area S of the target superpixel region and the spectral weight. .

[0033] The area S needs to be set based on the biological characteristics of the wheat canopy, combined with the spatial resolution of the remote sensing image, the scale of the ground object, and the application requirements. First, the actual area of ​​a unit pixel is calculated based on the image resolution r. Then, the number of pixels contained in the superpixel is determined with reference to the actual size of the target ground object. Finally, the area S is dynamically adjusted according to the actual scene of the wheat canopy. In this embodiment, the value of S is limited to the range of 0.02m²-0.05m². The lower limit of this range corresponds to the typical area of ​​a single tiller cluster or a small area of ​​continuous leaves in wheat, which can capture the local differences in low-density or heterogeneous canopies. The upper limit corresponds to the aggregation area of ​​multiple tiller clusters in a high-density uniform canopy, which can balance computational efficiency and feature representation accuracy.

[0034] Spectral weight The core setting is to balance the contribution ratio of spectral similarity and spatial proximity in superpixel segmentation, which needs to be determined in combination with image data characteristics, spectral differences of ground features, and specific application objectives. This embodiment will The value range is limited to 0.6-0.9. Hyperspectral imagery has rich spectral dimensions, and ground cover differentiation mainly relies on spectral features; therefore, it is usually... Setting it to a higher value range strengthens the dominant role of spectral similarity in superpixel aggregation.

[0035] Furthermore, the spectral features are extracted as follows: for each homogeneous region, the red edge position is determined by the first derivative method based on the reflectance of all pixels within it in the red edge sensitive band; and the average reflectance of all pixels in the homogeneous region in the red edge sensitive band and the near-infrared band is calculated, and the normalized red edge index is obtained based on the average reflectance. The spatial texture features are extracted as follows: the reflectance of all pixels in the hyperspectral image in the near-infrared band is extracted, a near-infrared grayscale image is constructed, and grayscale co-occurrence matrices corresponding to each homogeneous region are generated. The energy, contrast and homogeneity of each grayscale co-occurrence matrix are calculated. The red edge position, the normalized red edge index, and the energy, contrast, and homogeneity of the gray-level co-occurrence matrix are used to form a multidimensional array, which serves as the initial feature of a graph node.

[0036] The core of spectral feature extraction is to screen and calculate key spectral indicators that accurately reflect the nitrogen content of wheat leaves in each homogeneous region. The selected indicators must have a strong correlation with nitrogen content and possess characteristics of noise resistance and high stability. Therefore, this embodiment first determines the spectral bands used for feature extraction based on the spectral characteristics of the wheat canopy, including: Red edge sensitive band: that is, the wavelength range of 700nm-760nm. This band is the "sensitive area" for changes in chlorophyll content. When nitrogen content is insufficient, chlorophyll decreases, the red edge position will shift towards the short wavelength direction, and the slope of the reflectance curve of the red edge band will also change significantly. It is the core indicator band of nitrogen content. Near-infrared band: that is, the wavelength range of 800nm-900nm. The reflectance of this band is related to the structure and biomass of wheat leaves. Nitrogen content affects the leaf development status, which in turn indirectly affects the reflectance of the near-infrared band, and can help verify the reliability of the red edge feature. Red band: the wavelength range of 650nm-680nm, is used for subsequent calculation of the normalized red edge index to ensure band consistency in the feature extraction and segmentation stages and reduce data errors.

[0037] Building upon this foundation, we selected Red Edge Position (REP) and Normalized Red Edge Index (NDRI) as spectral features, both closely aligned with the core physiological mechanism of "nitrogen content-chlorophyll-spectral response." REP directly quantifies the nitrogen content gradient through red edge wavelength shifts regulated by chlorophyll content, while NDRI amplifies the nitrogen content modulation effect by integrating pigment absorption in the red edge band with leaf structure information in the near-infrared band. These two features complement each other in terms of "position + intensity," accurately capturing core changes in nitrogen content while resisting field interferences such as light and soil background. Furthermore, their low-dimensionality and high-discrimination characteristics make them suitable for subsequent spectral fusion and model training, ultimately providing highly targeted and robust spectral support for high-precision, highly generalized estimation of nitrogen content in wheat leaves.

[0038] Using the first derivative method can highlight the rate of change of reflectance in the red-edge band and accurately locate the red-edge position; averaging over all pixels within the region can improve the stability of the feature—the higher the nitrogen content and the richer the chlorophyll, the more the red-edge position shifts towards longer wavelengths, and this parameter can directly quantify this pattern. The specific calculation method is as follows: Read the reflectance curves of all pixels within a homogeneous region in the red-edge sensitive band (700nm-760nm), and calculate the first derivative of the curve. The formula is: ; Indicates wavelength The first derivative of the reflectance at a given wavelength represents the rate of change of reflectance at that wavelength. This represents the reflectivity value at the i-th wavelength point; Indicates and The reflectance value of the (i+1)th adjacent wavelength point; This represents the interval between two adjacent wavelength points, and is set according to the resolution of the hyperspectral image to ensure the consistency of derivative calculation.

[0039] The red-edge position is essentially the wavelength with the fastest rate of reflectivity change, i.e., the wavelength corresponding to the maximum value of the first derivative. By iterating through all the first derivative values ​​of the pixels within the red-edge sensitive band, the wavelengths corresponding to the maximum values ​​are determined. As the red border position of this pixel; The formula for calculating the average red edge positions of all cells within a homogeneous region is: ; This represents the final value of the red edge position in the current homogeneous region, indicating the average red edge characteristic of that region; N is the number of pixels in that region. This indicates the position of the red border of the i-th pixel.

[0040] The normalized red edge index (NRI) enhances sensitivity to nitrogen content by combining the reflectance of the red edge sensitive band and the near-infrared band, while mitigating the influence of soil background and atmospheric correction residual errors. The calculation steps are as follows: Calculate the average reflectance of all pixels within a homogeneous region in the red-edge sensitive band (700nm-760nm). The calculation formula is: ; N represents the number of pixels in the current homogeneous region; M represents the number of bands within the red-edge sensitive band range; This represents the reflectance of the k-th pixel in the m-th band; Calculate the average reflectance of all pixels within a homogeneous region in the near-infrared band (800nm-900nm). The calculation formula is: ; P represents the number of bands in the near-infrared band range; This represents the reflectance of the k-th pixel in the p-th band; The normalization exponent is calculated using the normalization formula, which is: ; In this formula, Highlighting the difference in reflectance between the near-infrared and red-edge bands, when the nitrogen content increases, the near-infrared reflectance increases, the red-edge reflectance decreases, and the molecular value increases; The differences are normalized to eliminate the influence of external factors such as light intensity and atmospheric conditions, so that the index is comparable in different scenarios.

[0041] The calculated red-edge position and normalized index are used as spectral features of homogeneous regions. REP focuses on reflecting the "spectral position shift" caused by nitrogen content, i.e., the wavelength dimension; NDRI focuses on reflecting the "spectral intensity difference" caused by nitrogen content, i.e., the reflectance ratio dimension. The two complement each other, avoiding the one-sidedness of information from a single feature, and providing core information on the spectral dimension for the initial feature construction of subsequent graph nodes.

[0042] Since each pixel in a hyperspectral image is a set of full-spectrum reflectance data, it is impossible to directly model the spatial relationship of the whole. Furthermore, the near-infrared band is sensitive to the internal structure and biomass of leaves and is less affected by chlorophyll absorption, making it more suitable for characterizing the spatial structure and texture changes of the canopy. Therefore, this embodiment extracts the spatial texture features of each homogeneous region by constructing a near-infrared grayscale image.

[0043] The reflectance data of all pixels in the near-infrared band is extracted from the hyperspectral image. The near-infrared band ranges from 800nm ​​to 900nm. In this embodiment, the reflectance at the center wavelength of this band, i.e., 850nm, is selected. A grayscale image of the same size and resolution as the hyperspectral image is defined, with all pixel values ​​initialized to 0. Each pixel corresponds one-to-one with the position of a hyperspectral pixel. The reflectance of the hyperspectral pixel at 850nm wavelength is then calculated according to its coordinate position. The values ​​are assigned to each pixel in the grayscale image to form a near-infrared grayscale image.

[0044] In grayscale images, the Gray-Level Co-occurrence Matrix (GLCM) can effectively describe the spatial distribution pattern of grayscale values, reflecting the roughness, contrast, and uniformity of canopy texture, and facilitating the extraction of spatial texture features. GLCM describes the frequency of occurrence of a pair of grayscale values ​​under a specific spatial relationship, where the spatial relationship is determined by direction. And the distance d is defined. In this embodiment, four directions are set: 0°, 45°, 90°, and 135°, each direction corresponding to a displacement vector. The expression is as follows: ; For each homogeneous region in the hyperspectral image, it is marked in the near-infrared grayscale image according to its coordinate position, and the gray-level co-occurrence matrix of each homogeneous region is calculated as follows: Regarding direction Given a distance d, iterate through each pixel (x, y) within the homogeneous region to find its target pixel. Count the number of occurrences of grayscale value pairs (i, j), where i is the grayscale value of the current pixel and j is the grayscale value of the target pixel. The formula is: ; in, represents the element value in the i-th row and j-th column of the gray-level co-occurrence matrix; w and h are the width and height of the homogeneous region, respectively; This represents the grayscale value of the current pixel. Represents the grayscale value of the target pixel; This is an indicator function; the result is 1 if the condition within the parentheses is true, and 0 otherwise.

[0045] To eliminate the influence of the size of homogeneous regions and give the matrix elements probabilistic meaning, the constructed GLCM needs to be normalized. The formula is as follows: ; in, This is the normalized GLCM. This indicates that the normalized GLCM is in the direction , the probability of grayscale data pair (i, j) appearing at a distance d; L is the dimension of GLCM, i.e. and All The matrix.

[0046] based on Calculate three spatial texture features, namely energy. Contrast and homogeneity .

[0047] Calculate energy The formula is: ; right The sum of squares of all elements in a GLCM reflects the uniformity of grayscale distribution and the coarseness of texture, i.e., the energy of the GLCM. A higher energy value indicates that a few elements in the GLCM have very large values, while the rest are very small. This corresponds to a surface with highly uniform grayscale and gentle changes within a homogeneous region, such as a complete, healthy leaf. Conversely, a lower energy value indicates that the element values ​​in the GLCM are more dispersed. This corresponds to a surface with large grayscale variations and a coarse texture, such as areas with spots, gaps, or withered leaves.

[0048] Calculate contrast The formula is ; Will The sum of the products of each element and the square of its gray-level difference measures the intensity of local gray-level changes in an image, reflecting the clarity of texture and the sharpness of edges. The lower the gray-level difference, the greater its contribution. High contrast values ​​indicate the presence of many adjacent pixel pairs with large gray-level differences in the image, corresponding to regions with clear edges and distinct structures, such as the boundary between leaves and soil background, or the edges of dead spots formed by severe stress. Conversely, low contrast values ​​indicate that adjacent pixels have similar gray levels, corresponding to regions with smooth transitions and blurred boundaries, such as the interior of a uniform canopy.

[0049] Calculate homogeneity The formula is ; right Divide each element in by Then, summing the results, the larger the gray-level difference ij, the larger its absolute value and the larger the denominator, and the smaller the contribution of this parameter. In other words, only pixel pairs with similar gray levels (concentrated near the main diagonal of the GLCM) contribute significantly to homogeneity. Homogeneity reflects the consistency of local gray levels in an image, measuring the smoothness and continuity of texture. A high homogeneity value indicates that elements in the GLCM are highly concentrated near the main diagonal, resulting in smooth and continuous textures in the corresponding regions, with slow gray-level transitions between pixels. Conversely, a low homogeneity value indicates that elements in the GLCM are scattered far from the diagonal, resulting in discontinuous textures and abrupt changes in the corresponding regions.

[0050] For each spatial texture feature, calculate separately The average of the texture feature values ​​in the four directions is then taken as the final texture feature of the homogeneous region: ; ; ; The purpose of this design is to ensure that the extracted texture features are rotationally invariant, independent of the shooting orientation or crop ridge direction. If a region is uniform in all directions, the feature values ​​in the four directions will be very close, and the average value can represent its overall uniformity. However, if a region has texture only in a certain direction (such as shadow stripes caused by ridge direction), the features in that single direction will highlight this, but after taking the average of the four directions, this directional difference is weakened, and the features focus more on the presence and intensity of the texture itself.

[0051] Furthermore, the setting of distance d is based on the physical scale of the analyzed object and the perceptual range of the target texture. In this embodiment, d is set to 1. The analysis unit in this embodiment is a homogeneous region obtained after superpixel segmentation. Each region corresponds to a local functional unit (such as a leaf cluster) in the wheat canopy, and its spatial scale is usually within tens of pixels. Setting d=1 aims to capture the direct adjacency relationship between pixels, thereby most sensitively characterizing the micro-texture changes on the leaf surface. Larger distances would cross multiple leaves or mix void information, introduce macroscopic structural noise of the canopy that is independent of nitrogen content, and reduce the detection sensitivity to early stress. Therefore, d=1 is the best choice for achieving high-precision, fine-grained spatial estimation of nitrogen content.

[0052] These three complementary spatial texture features comprehensively describe the spatial structure of the wheat canopy from macroscopic, microscopic, and local continuous perspectives: a homogeneous region with sufficient nitrogen content and good health has an ideal combination of high E + low C + high V, while a nitrogen-deficient and stressed region may exhibit low E + high C + low V.

[0053] Based on the above, the calculated red edge position, the normalized red edge index, and the energy, contrast, and homogeneity of the gray-level co-occurrence matrix are combined to form a multidimensional array, which serves as the initial feature of a graph node.

[0054] Step 2: Based on the spatial adjacency relationship between the nodes in each graph, add edges to the undirected graph to form an undirected graph network, and construct the first graph data representing the spatial structure of the wheat canopy based on the undirected graph network.

[0055] Please see Figure 2 As shown, after constructing the graph nodes and their features, it is necessary to establish connecting edges between the graph nodes based on spatial adjacency relationships, thereby integrating the discrete nodes into an undirected graph network representing the spatial topology of the canopy. The essence of this step is to transform the natural spatial organization of the wheat canopy (such as the adjacency, competition, and stress diffusion relationships between leaf clusters) into computable and learnable graph structure data.

[0056] Furthermore, the spatial adjacency relationship refers to the fact that the boundaries of two homogeneous regions are directly adjacent in space, and the method of adding edges in the undirected graph is as follows: extract the boundary cells of each homogeneous region to form a boundary cell set; for any two homogeneous regions, determine whether there are any identical cells in their respective boundary cell sets; if so, establish an undirected edge between the graph node indices corresponding to the two homogeneous regions; traverse all homogeneous regions to generate an edge relationship list. The first graph data includes a graph node feature matrix and an edge relationship list; the graph node feature matrix is ​​composed of the initial features of all graph nodes.

[0057] First, boundary pixels are extracted for each homogeneous region obtained from superpixel segmentation. The 8-neighborhood decision method is used to traverse each pixel within the homogeneous region. Taking the current pixel as the center, the homogeneous regions to which the pixels in the surrounding 8 directions (up, down, left, right and the four diagonal directions) belong are checked. If at least one pixel in these 8 neighboring pixels does not belong to the same homogeneous region as the current pixel, then the current pixel is determined to be a boundary pixel and is included in the boundary pixel set of the homogeneous region.

[0058] For any two homogeneous regions, perform an intersection operation on their boundary cell sets. If the intersection is not empty, the two homogeneous regions are determined to be spatially adjacent. Record the graph node indices of these two homogeneous regions in the undirected graph, and map this spatial adjacency relationship to an undirected edge in the graph structure, forming an edge relationship data pair. After traversing all the boundary cells of homogeneous regions to complete the adjacency determination, summarize the generated edge relationship data pairs to form an edge relationship list.

[0059] By integrating the graph node data and edge relationship list generated from all homogeneous regions, the first graph data is constructed. The expression is: ; Where U is The feature matrix of graph nodes, The number of nodes in the graph. K is the number of cluster centers when segmenting homogeneous regions; each row of the graph node feature matrix represents the initial features of a graph node. B is... The edge relation matrix, also known as the edge relation list, is J, where J is the number of undirected edges. The two elements in each row of the edge relation matrix represent the graph node index numbers of two adjacent homogeneous regions.

[0060] Based on the above steps, this embodiment connects spatially adjacent homogeneous regions by explicitly defining "edges," enabling the model to capture spatial interactions and contextual dependencies within the canopy in the form of graph data. This provides a structural foundation for subsequent message passing and feature aggregation in graph neural networks, allowing the model to transcend the local information of individual nodes and understand the overall spatial heterogeneity of the canopy through neighborhood aggregation. This significantly improves the accuracy and robustness of nitrogen content estimation and provides crucial structural evidence for distinguishing between true nitrogen deficiency and spatial structural disturbances.

[0061] Step 3: Input the first graph data into the pre-trained feature extraction model. The feature extraction model aggregates the initial features of each graph node and its edge connection relationship to form neighborhood information. After iterative updates, it outputs the deep feature vector of each graph node to form the second graph data.

[0062] The design employs a "pre-trained feature extraction model + neighborhood information aggregation" approach, the core logic of which stems from considerations of the adaptability of wheat canopy analysis requirements to the characteristics of graph data. The first graph data mentioned earlier only achieves a preliminary association between node attributes and spatial topology. The initial features of a single node cannot reflect the collaborative characteristics of adjacent regions in the wheat canopy. Furthermore, the growth status and stress conditions of the wheat canopy are often reflected in the overall association of local regions. Therefore, it is necessary to use neighborhood information aggregation design to mine the association features between nodes to compensate for the limitations of single node features.

[0063] Furthermore, the feature extraction model is a graph neural network model, and its pre-training adopts a mask feature reconstruction method, the specific steps of which are as follows: Collect historical wheat canopy hyperspectral images covering multiple scenes. For each image, perform steps such as segmenting homogeneous regions, adding undirected edges, and constructing graph data. For each constructed historical graph data, select a number of graph nodes to form the first validation set, and the remaining graph nodes to form the first training set. For each graph data in the first training set, randomly mask the initial features of some of the graph nodes; Using a graph neural network model, the initial features of nodes in a masked graph are predicted based on the initial features of nodes in the unmasked graph and a list of edge relationships. The mean squared error between the model's predicted results and the initial features is used as the loss function, and the parameters of the graph neural network model are optimized through the backpropagation algorithm. After each round of training, the prediction loss of the model is calculated based on the first validation set; Repeat the above steps until the model loss converges. Then, fix the model parameters obtained at this point and use them as the trained feature extraction model.

[0064] This embodiment employs a graph neural network (GNN) model for pre-training to extract deep feature vectors from graph nodes. The GNN model naturally adapts to the "node-edge" topology of the first graph data, allowing direct input of graph data and accurate capture of connections and feature dependencies between nodes, meeting the needs of networked representation of wheat canopy. Simultaneously, its ability to dynamically aggregate neighborhood features adapts to complex scenarios with interwoven canopy organs, avoiding the adaptation shortcomings of traditional models to unstructured graph data. Furthermore, the use of masked feature reconstruction for pre-training addresses two main issues: first, it solves the problem of scarce labeled wheat canopy data, as its self-supervised paradigm eliminates the need for manual labeling; pre-training is achieved through masked node features and reconstruction, reducing labeling costs and improving feasibility; second, it strengthens the model's learning of canopy feature correlation patterns, uncovering the intrinsic relationships between nodes and neighborhood features, and learning common spatial patterns in the canopy, laying the foundation for subsequent fine-tuning.

[0065] The specific methods for pre-training graph neural network models are as follows: First, it is necessary to collect a certain number of historical samples, namely historical wheat canopy hyperspectral images covering multiple scenarios, including field areas with different growth stages (such as greening stage, jointing stage, heading stage, and grain filling stage), different planting densities (high density, medium density, and low density), different meteorological conditions (sunny day, cloudy day, and light haze), and different soil fertility levels.

[0066] For each historical hyperspectral image, a standardized data processing procedure is followed. First, a homogeneous region segmentation algorithm is used to divide the image into pixel units with similar spectral and spatial attributes. Then, undirected edges are added to the segmented homogeneous regions (i.e., graph nodes) based on adjacency rules to construct an undirected graph network. Finally, the historical graph data representing the spectral-spatial fusion characteristics of wheat canopy is constructed. All processed historical graph data are integrated to form the first pre-training dataset.

[0067] To enhance the adaptability of the pre-trained feature extraction model to scenarios with missing local features in wheat canopy map data and improve its ability to reconstruct features based on neighborhood associations, a node feature masking operation is performed on the first pre-training dataset before training: for each map data in the first pre-training dataset, a portion of nodes are selected for masking using a random sampling method. In this embodiment, the masking ratio is set between 10% and 30%. This range is designed based on prior knowledge. If the ratio is too low, the model will not have sufficient learning pressure and will not be able to fully explore neighborhood association patterns; while if the ratio is too high, there will be too little effective neighborhood information, making it difficult for the model to accurately reconstruct features, thus leading to training instability.

[0068] Set the initial features of the nodes in the masked graph to zero, and retain the features of the nodes in the unmasked graph; record the original features of the masked nodes as labels for loss calculation. By leveraging the adaptability of GNNs to graph data topology, the features of unmasked nodes are fused with spatial correlations through a neighborhood aggregation mechanism to achieve feature prediction of masked nodes. To measure the deviation between predicted and true features and to clarify the direction of parameter optimization, this embodiment uses mean squared error (MSE) as the loss function, calculating the squared mean of the differences between the predicted features of the masked node and the true initial features to quantify the fitting error; the formula for the MSE loss function is: ; in, This represents the mean squared error loss value. The number of nodes being masked; Let be the initial features of the i-th masked node. The model predicts the features for this node; Based on this loss function, the backpropagation algorithm is initiated, and the loss signal is transmitted backward from the output layer to the input layer along the model network hierarchy. The gradient of the loss value with respect to the core parameters such as weights and biases of each layer of the model is calculated one by one using the chain rule, so as to clarify the adjustment direction (opposite direction of gradient) and adjustment magnitude (gradient magnitude) of each parameter. A gradient descent optimization strategy is adopted, and combined with a preset learning rate, the weights and bias parameters of each layer are iteratively fine-tuned along the gradient in the opposite direction to gradually reduce the model loss value. The complete process of "loss calculation - backpropagation - parameter fine-tuning" is repeated until the loss value tends to stabilize and converge, that is, the fluctuation amplitude is lower than the preset threshold. Finally, the global optimization of the model parameters is completed, the optimized parameters are fixed, and the trained feature extraction model is obtained. Based on this model, the deep feature vectors of each graph node in the first graph data are output, and the second graph data is generated accordingly.

[0069] The deep feature vector is a high-dimensional numerical vector that is aggregated into complete neighborhood information by a pre-trained feature extraction model based on the initial features of each graph node and its edge connections, and then output after iterative updates. The deep feature vector also serves as the input to the nitrogen content estimation model.

[0070] The core significance of the above steps lies in breaking through the limitations of single node features and achieving deep integration of node attributes and spatial neighborhood information. This not only fully explores the structural and attribute correlation features of adjacent parts of the wheat canopy, but also improves the efficiency and accuracy of feature extraction by using pre-trained models. The resulting second map data can provide more representative and in-depth feature support, laying a solid data foundation for subsequent precise analysis of the wheat canopy (such as growth assessment and stress diagnosis).

[0071] Step 4: Input the deep feature vectors of each graph node in the second graph data into the pre-established nitrogen content estimation model to obtain the estimated value of wheat leaf nitrogen content in the region corresponding to each graph node. Integrate the estimated values ​​of all graph nodes to generate a spatial distribution map of wheat leaf nitrogen content.

[0072] The second graph data, constructed based on the deep feature vectors of each graph node, is equivalent to preparing high-quality, information-rich input data. On this basis, it is also necessary to build a computationally powerful and highly accurate estimation model to output an estimated value of wheat nitrogen content for each graph node in the second graph data. Based on the estimated values ​​of all graph nodes, the distribution of wheat leaf nitrogen content in the entire target area can be reflected, thus completing the final nitrogen content estimation task.

[0073] Furthermore, the nitrogen content estimation model is a supervised learning regression model, and its pre-training method is as follows: We collected historical wheat canopy hyperspectral images covering multiple scenes. For each image, we performed steps such as segmenting homogeneous regions, adding undirected edges, and constructing graph data. We selected all homogeneous regions with measured nitrogen content values ​​and used their corresponding graph node and edge relationship list as the ground truth dataset. We then divided the ground truth dataset into a second training set and a second validation set. Input the graph data from the ground truth dataset into the feature extraction model, and output the deep feature vector of each graph node; The supervised learning regression model is trained by taking the deep feature vectors of the graph nodes in the second training set as input and the corresponding measured nitrogen content as the regression target. The mean square error between the predicted and measured nitrogen content values ​​was used as the loss function, and the parameters of the supervised learning regression model were optimized through the backpropagation algorithm. After each round of training, the prediction loss of the model is calculated based on the second validation set; Repeat the above steps until the model loss converges. Fix the model parameters obtained at this point as the trained nitrogen content estimation model.

[0074] To accurately estimate nitrogen content in wheat leaves, this embodiment selects a supervised learning regression model for pre-training as the nitrogen content estimation model. This model is trained using paired labeled data ("input features - output labels"), guiding the learning of the quantitative correlation between deep features and nitrogen content through labels. The regression architecture is adapted to the prediction target of continuous nitrogen content values, directly outputting quantitative results to meet the needs of accurate field estimation and avoid the accuracy loss associated with category classification.

[0075] The specific methods for pre-training a supervised learning regression model are as follows: In the process of detecting nitrogen content in wheat leaves, regardless of the detection method used, it is necessary to set a certain proportion of measurement points and perform destructive sampling of the wheat leaf layer to detect its nitrogen content. The measured nitrogen content of wheat is not only the sole standard for measuring the accuracy of the machine detection method, but also an important parameter for machine model calibration, providing a reference direction for model optimization. Therefore, in each historical detection, there is always a certain proportion of wheat leaf areas with measured nitrogen content.

[0076] In the process of pre-training the graph neural network model described above, the collected historical hyperspectral images covering multiple scenes have been standardized. That is, each historical image has been segmented into homogeneous regions, undirected edges have been added, and graph data has been constructed. Among all the historical graph data, the graph nodes corresponding to wheat regions with measured nitrogen content values ​​are selected. These graph nodes and their features are used as the second pre-training dataset for training the nitrogen content estimation model.

[0077] The nitrogen content estimation model was pre-trained as follows: First, graph data from the second pre-training dataset was input into the pre-trained feature extraction model. Through neighborhood aggregation and depth mining, deep feature vectors integrating spectral and spatial information were output for each graph node, providing high-quality input for accurate estimation. Second, using the deep feature vectors as input and the measured nitrogen content of the corresponding region as the regression target, a supervised learning regression model was constructed using training samples. Training aimed to minimize the estimation error. The deviation was quantified using the mean squared error loss function, and the model parameters were iteratively optimized using backpropagation and gradient descent to improve fitting accuracy. Finally, the validation set error was monitored in real time. Training was stopped when the error reached its minimum and stabilized, and this model was determined as the pre-trained nitrogen content estimation model, ensuring its estimation stability and accuracy.

[0078] Furthermore, the convergence of the model loss means that the prediction loss of the feature extraction model on the first validation set and the prediction loss of the nitrogen content estimation model on the second validation set do not decrease in consecutive rounds.

[0079] Furthermore, the specific steps for generating the spatial distribution map of nitrogen content in wheat leaves are as follows: The nitrogen content estimation value output by the nitrogen content estimation model for each graph node is assigned to each pixel in the corresponding homogeneous region of that node, and the interpolation method is used to perform interpolation calculations for blank pixels that do not belong to any homogeneous region. The estimated nitrogen content values ​​of all pixels are arranged into a two-dimensional matrix, corresponding one-to-one with each pixel; Based on the preset nitrogen content-color mapping relationship, the numerical matrix is ​​converted into a color matrix, and a spatial distribution map of nitrogen content in wheat leaf layer is generated based on the color matrix.

[0080] Please see Figure 3 As shown, after obtaining the nitrogen content at each node of the graph, it is necessary to integrate all the numerical data into a concentration distribution map that can clearly reflect the nitrogen content distribution. The specific integration method is as follows: Construct a grayscale image with the same size and resolution as the hyperspectral image, with coordinate positions corresponding one-to-one, and initialize all pixel values ​​to 0; According to the coordinate position, the homogeneous region corresponding to each graph node in the grayscale image is marked. Since the segmented homogeneous region represents the average nitrogen content in that region, the estimated nitrogen content obtained from the graph node can be assigned to each pixel in the grayscale image of its homogeneous region. After all homogeneous regions have been assigned values, blank pixels on the grayscale image that have not been assigned values ​​are then assigned values ​​using interpolation. All pixel values ​​of the grayscale image are arranged into a two-dimensional matrix according to coordinates. For each element, the numerical matrix is ​​converted into a color matrix according to the preset nitrogen content-color mapping relationship. Based on this color matrix, a spatial distribution map of nitrogen content in wheat leaf layer is generated.

[0081] Please see Figure 4 The present invention also provides a wheat leaf nitrogen content estimation system based on hyperspectral imagery. This system is used to execute the aforementioned wheat leaf nitrogen content estimation method based on hyperspectral imagery, and includes: Feature extraction module: used to acquire hyperspectral images of the target wheat canopy and segment the images to obtain several homogeneous regions. An undirected graph is constructed with each homogeneous region as a graph node. The spectral features and spatial texture features corresponding to the graph nodes are extracted from the images and used as the initial features of the graph nodes. Graph data construction module: Used to add edges to an undirected graph to form an undirected graph network based on the spatial adjacency relationship between each graph node, and to construct the first graph data representing the spatial structure of wheat canopy based on the undirected graph network; Graph data augmentation module: It is used to input the first graph data into the pre-trained feature extraction model, and aggregate the neighborhood information of the initial features and edge connections of each graph node through the feature extraction model. After iterative update, it outputs the deep feature vector of each graph node to form the second graph data. The estimation and integration module is used to input the deep feature vectors of each graph node in the second graph data into the pre-established nitrogen content estimation model, obtain the estimated value of wheat leaf nitrogen content in the region corresponding to each graph node, integrate the estimated values ​​of all graph nodes, and generate a spatial distribution map of wheat leaf nitrogen content.

[0082] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.

[0083] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.

[0084] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0085] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for estimating nitrogen content in wheat leaf layer based on hyperspectral imagery, characterized in that, The specific steps include: Step 1: Acquire hyperspectral images of the target wheat canopy and segment the images to obtain several homogeneous regions. Construct an undirected graph with each homogeneous region as a graph node. Extract the spectral features and spatial texture features corresponding to the graph nodes from the images as the initial features of the graph nodes. Step 2: Based on the spatial adjacency relationship between the nodes in each graph, add edges to the undirected graph to form an undirected graph network, and construct the first graph data representing the spatial structure of the wheat canopy based on the undirected graph network; Step 3: Input the first graph data into the pre-trained feature extraction model. The feature extraction model aggregates the initial features of each graph node and its edge connection relationship through neighborhood information. After iterative updates, it outputs the deep feature vector of each graph node to form the second graph data. Step 4: Input the deep feature vectors of each graph node in the second graph data into the pre-established nitrogen content estimation model to obtain the estimated value of wheat leaf nitrogen content in the region corresponding to each graph node. Integrate the estimated values ​​of all graph nodes to generate a spatial distribution map of wheat leaf nitrogen content.

2. The method for estimating nitrogen content in wheat leaves based on hyperspectral imagery according to claim 1, characterized in that, The specific method for segmenting hyperspectral images into several homogeneous regions is as follows: extract the reflectance of all pixels in the hyperspectral image in the red and near-infrared bands to form the two-dimensional spectral features of each pixel; measure the spectral feature similarity and spatial distance of each pixel based on a linear iterative clustering algorithm, and aggregate pixels whose spectral feature similarity and spatial distance meet the preset requirements into homogeneous regions.

3. The method for estimating nitrogen content in wheat leaves based on hyperspectral imagery according to claim 2, characterized in that, The method for extracting the spectral features is as follows: For each homogeneous region, the red edge position is determined by the first derivative method based on the reflectance of all pixels in the red edge sensitive band; and the average reflectance of all pixels in the homogeneous region in the red edge sensitive band and the near-infrared band is calculated, and the normalized red edge index is obtained based on the average reflectance. The spatial texture features are extracted as follows: the reflectance of all pixels in the hyperspectral image in the near-infrared band is extracted, a near-infrared grayscale image is constructed, and grayscale co-occurrence matrices corresponding to each homogeneous region are generated. The energy, contrast and homogeneity of each grayscale co-occurrence matrix are calculated. The red edge position, the normalized red edge index, and the energy, contrast, and homogeneity of the gray-level co-occurrence matrix are used to form a multidimensional array, which serves as the initial feature of a graph node.

4. The method for estimating nitrogen content in wheat leaf layer based on hyperspectral imagery according to claim 3, characterized in that, The spatial adjacency relationship refers to the fact that the boundaries of two homogeneous regions are directly adjacent in space. The method of adding edges in the undirected graph is as follows: extract the boundary cells of each homogeneous region to form a boundary cell set; for any two homogeneous regions, determine whether there are any identical cells in their respective boundary cell sets. If so, establish an undirected edge between the graph node indices corresponding to the two homogeneous regions; traverse all homogeneous regions to generate an edge relationship list. The first graph data includes a graph node feature matrix and an edge relationship list; the graph node feature matrix is ​​composed of the initial features of all graph nodes.

5. The method for estimating nitrogen content in wheat leaves based on hyperspectral imagery according to claim 4, characterized in that, The feature extraction model is a graph neural network model, and its pre-training uses masked feature reconstruction. The specific steps are as follows: Collect historical wheat canopy hyperspectral images covering multiple scenes. For each image, perform steps such as segmenting homogeneous regions, adding undirected edges, and constructing graph data. For each constructed historical graph data, select a number of graph nodes to form the first validation set, and the remaining graph nodes to form the first training set. For each graph data in the first training set, randomly mask the initial features of some of the graph nodes; Using a graph neural network model, the initial features of nodes in a masked graph are predicted based on the initial features of nodes in the unmasked graph and a list of edge relationships. The mean squared error between the model's predicted results and the initial features is used as the loss function, and the parameters of the graph neural network model are optimized through the backpropagation algorithm. After each round of training, the prediction loss of the model is calculated based on the first validation set; Repeat the above steps until the model loss converges. Then, fix the model parameters obtained at this point and use them as the trained feature extraction model.

6. The method for estimating nitrogen content in wheat leaves based on hyperspectral imagery according to claim 5, characterized in that, The nitrogen content estimation model is a supervised learning regression model, and its pre-training method is as follows: We collected historical wheat canopy hyperspectral images covering multiple scenes. For each image, we performed steps such as segmenting homogeneous regions, adding undirected edges, and constructing graph data. We selected all homogeneous regions with measured nitrogen content values ​​and used their corresponding graph node and edge relationship list as the ground truth dataset. We then divided the ground truth dataset into a second training set and a second validation set. Input the graph data from the ground truth dataset into the feature extraction model, and output the deep feature vector of each graph node; The supervised learning regression model is trained by taking the deep feature vectors of the graph nodes in the second training set as input and the corresponding measured nitrogen content as the regression target. The mean square error between the predicted and measured nitrogen content values ​​was used as the loss function, and the parameters of the supervised learning regression model were optimized through the backpropagation algorithm. After each round of training, the prediction loss of the model is calculated based on the second validation set; Repeat the above steps until the model loss converges. Fix the model parameters obtained at this point as the trained nitrogen content estimation model.

7. The method for estimating nitrogen content in wheat leaf layer based on hyperspectral imagery according to claim 6, characterized in that, The convergence of model loss means that the prediction loss of the feature extraction model on the first validation set and the prediction loss of the nitrogen content estimation model on the second validation set do not decrease in consecutive rounds.

8. The method for estimating nitrogen content in wheat leaves based on hyperspectral imagery according to claim 7, characterized in that, The specific steps for generating a spatial distribution map of nitrogen content in wheat leaves are as follows: The nitrogen content estimation value output by the nitrogen content estimation model for each graph node is assigned to each pixel in the corresponding homogeneous region of that node, and the interpolation method is used to perform interpolation calculations for blank pixels that do not belong to any homogeneous region. The estimated nitrogen content values ​​of all pixels are arranged into a two-dimensional matrix, corresponding one-to-one with each pixel; Based on the preset nitrogen content-color mapping relationship, the numerical matrix is ​​converted into a color matrix, and a spatial distribution map of nitrogen content in wheat leaf layer is generated based on the color matrix.

9. A system for estimating nitrogen content in wheat leaves based on hyperspectral imagery, characterized in that: The wheat leaf nitrogen content estimation system based on hyperspectral imagery is used to execute the wheat leaf nitrogen content estimation method based on hyperspectral imagery as described in any one of claims 1-8, including: Feature extraction module: used to acquire hyperspectral images of the target wheat canopy and segment the images to obtain several homogeneous regions. An undirected graph is constructed with each homogeneous region as a graph node. The spectral features and spatial texture features corresponding to the graph nodes are extracted from the images and used as the initial features of the graph nodes. Graph data construction module: Used to add edges to an undirected graph to form an undirected graph network based on the spatial adjacency relationship between each graph node, and to construct the first graph data representing the spatial structure of wheat canopy based on the undirected graph network; Graph data augmentation module: It is used to input the first graph data into the pre-trained feature extraction model, and aggregate the neighborhood information of the initial features and edge connections of each graph node through the feature extraction model. After iterative update, it outputs the deep feature vector of each graph node to form the second graph data. The estimation and integration module is used to input the deep feature vectors of each graph node in the second graph data into the pre-established nitrogen content estimation model, obtain the estimated value of wheat leaf nitrogen content in the region corresponding to each graph node, integrate the estimated values ​​of all graph nodes, and generate a spatial distribution map of wheat leaf nitrogen content.

Citation Information

Patent Citations

  • Estimation method of nitrogen content in wheat leaf layer based on hyperspectral image fusion characteristics

    CN112557393B