Corn variety identification method and system based on hyperspectral imaging

CN122967259APending Publication Date: 2026-10-23ZHANGYE JINZHONGYUAN SEED IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610995687.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-06
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0003]现有高光谱品种鉴别技术普遍采用统计机器学习或深度学习框架,通过拟合光谱特征与品种标签之间的统计相关性构建分类模型,但高光谱数据采集过程易受光照强度、环境温度、样本含水率、仪器基线漂移等多种混杂因素干扰,导致光谱特征与品种标签之间的统计关联包含大量由混杂因素驱动的伪相关,而非品种基因型决定的真实因果关联,基于统计相关性训练的模型高度依赖训练集的采集条件分布,当实际检测场景的环境条件与训练集存在差异时,数据分布发生偏移,模型鉴别精度会出现断崖式下降,无法适配田间、仓储、实验室等多场景的检测需求

Benefits of technology

本发明通过构建因果结构有向无环图明确品种基因型与光谱特征间的真实因果路径,利用后门准则与前门准则双机制分别阻断可观测混杂因子和不可观测混杂因子引入的虚假关联,从因果层面提取仅由基因型决定的本质光谱特征,解决传统统计相关模型在跨场景检测时精度断崖式下降的问题;同时,引入前门准则使得无需测量全部干扰因素即可实现无偏特征提取,兼容多种应用场景。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122967259A_ABST
    Figure CN122967259A_ABST
Patent Text Reader

Abstract

The application discloses a corn variety identification method and system based on hyperspectral imaging, relates to the technical field of hyperspectral information processing, and determines the causal relationship among the variety genotype, environmental confounding factors, spectral characteristics and variety labels by constructing a causal structure directed acyclic graph, blocks false correlations introduced by observable confounding factors and unobservable confounding factors by using a backdoor criterion and a frontdoor criterion double mechanism, extracts essential spectral characteristics determined only by the genotype from the causal level, and solves the problem of cliff-like decline in precision of traditional statistical correlation models in cross-scene detection; meanwhile, the frontdoor criterion is introduced, so that unbiased feature extraction can be realized without measuring all interference factors, and multiple application scenes are compatible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of hyperspectral information processing technology, specifically to a method and system for identifying maize varieties based on hyperspectral imaging. Background Technology

[0002] As the most widely planted and highest-yielding grain crop, corn's varietal purity and authenticity directly determine its yield and quality, making it a core indicator for seed market supervision and agricultural production management. Traditional corn variety identification relies on field planting identification, biochemical markers, or molecular marker methods, which suffer from drawbacks such as long testing cycles, high costs, and destructive testing, making it difficult to meet the demands of large-scale, fast-paced seed quality inspection. Hyperspectral imaging technology, combining spatial imaging and continuous spectral resolution capabilities, can acquire reflectance spectral information across hundreds of bands of a sample under non-destructive conditions. It captures the spectral differences among different corn varieties caused by variations in biochemical components and kernel structure, and has become the mainstream technical approach for rapid crop variety identification.

[0003] Existing hyperspectral variety identification technologies generally employ statistical machine learning or deep learning frameworks, constructing classification models by fitting the statistical correlation between spectral features and variety labels. However, the hyperspectral data acquisition process is easily affected by various confounding factors such as light intensity, ambient temperature, sample moisture content, and instrument baseline drift. This results in the statistical correlation between spectral features and variety labels containing a large number of spurious correlations driven by confounding factors, rather than true causal relationships determined by variety genotypes. Models trained based on statistical correlations are highly dependent on the distribution of acquisition conditions in the training set. When the environmental conditions of the actual detection scenario differ from those of the training set, the data distribution shifts, and the model's identification accuracy drops sharply, making it unsuitable for detection needs in various scenarios such as field, storage, and laboratory settings.

[0004] Existing technical solutions for improving model robustness mostly employ methods such as spectral preprocessing, transfer learning, and domain adaptation, which only alleviate data distribution bias at the statistical level. They do not distinguish between intrinsic differences in varieties and environmental interference at the causal mechanism level, and cannot eliminate spurious associations caused by confounding factors at the root. The improvement in robustness is limited and it is difficult to cope with complex and ever-changing actual data collection environments. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a method and system for identifying maize varieties based on hyperspectral imaging. By constructing a causal structure directed acyclic graph, the causal relationship between variety genotype, environmental confounding factors, spectral features and variety labels is clarified. Based on the backdoor and frontdoor criteria, spurious associations of confounding factors are blocked. Causal features determined solely by variety genotype are extracted. Furthermore, counterfactual data is combined to enhance and expand the environmental coverage. This addresses the problem of model performance degradation caused by environmental changes at the causal mechanism level, thereby achieving highly robust variety identification across different data acquisition scenarios.

[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a method for identifying maize varieties based on hyperspectral imaging, the method comprising the following specific steps: S1. Collect hyperspectral image data of different maize varieties, record environmental contamination factor data during the collection process, preprocess the hyperspectral images and extract the spectral features of the samples to construct the original hyperspectral dataset; S2. Construct a causal structure directed acyclic graph model for hyperspectral maize variety identification to clarify the variable set and the causal paths between variables; S3. Based on the backdoor criterion and the frontdoor criterion, the backdoor path in the causal graph is identified, and the original spectral features are mapped to causal features that are only affected by genotype based on the calculated post-intervention distribution. S4. Build a counterfactual data augmentation framework, perform intervention sampling on environmental confounding factors based on causal structure, generate counterfactual hyperspectral samples under different confounding conditions, and construct an augmented training set by combining the original samples with causal features; S5. Train a maize variety identification classifier based on the augmented training set. Extract causal features from the hyperspectral data of the maize sample to be tested and input them into the classifier to output the variety identification result.

[0007] Furthermore, in S2, a set of causal graph variables is defined. Among them, the genotype T of the variety takes a value of K represents the total number of maize varieties, corresponding to the genotype categories of different maize varieties, and is the fundamental reason that determines the intrinsic spectral characteristics of varieties. Environmental confounding factor set U: a set of exogenous variables, including light intensity. Ambient temperature Sample moisture content Observable mixing And instrument drift, unobservable confounding factors such as grain surface morphology, etc. This is a major source of pseudocorrelation in spectral data; Spectral feature X: an endogenous high-dimensional continuous variable, namely the extracted 224-dimensional spectral reflectance vector, which is simultaneously affected by the genotype T of the variety and the environmental confounding factor U. Variety label Y: an endogenous discrete variable with the same value as T, corresponding to the maize variety category, directly determined by the variety genotype T. The model uses spectral features X to predict Y.

[0008] Furthermore, in S2, causal paths between variables are defined, and a directed acyclic graph is constructed: The true cause-and-effect path: That is, the genotype of a variety determines its intrinsic spectral characteristics by regulating the biochemical components and structure of the grain. This pathway reflects the essential causal relationship between variety and spectrum. Fake backdoor path: This means that environmental confounding factors affect the spectral acquisition results by interfering with the propagation of light signals and changing the physical state of the samples, resulting in a statistical pseudo-correlation between spectral features X and variety label Y dominated by the environment.

[0009] Furthermore, in S3, the backdoor path identification is adjusted based on the backdoor criterion: Based on the causal graph structure, identify all backdoor paths from U to T and confirm the set of observable confounding factors. The backdoor criterion is satisfied, meaning that the set blocks all backdoor paths between T and X that contain arrows pointing to T; Based on the backdoor adjustment formula, calculate the spectral characteristic conditional distribution after intervention on genotype T of the variety. ; By weighted summing of all values ​​of the confounding factors, the interference of environmental confounding on spectral characteristics is eliminated, and the initial causal characteristics determined solely by the genotype of the variety are obtained.

[0010] Furthermore, the spectral characteristic condition distribution The expression is: Where u is the combination of observable confounding factors, The spectral characteristic conditional distribution for genotype t and confounding factor combination u was obtained by fitting with Gaussian kernel density estimation. The marginal distribution of the confounding factor set is obtained from the training set statistics.

[0011] Furthermore, in S3, the specific steps for performing causal adjustment using the front-door criterion are as follows: Estimating the causal effect of genotype T on mediating variable M: ​​Since there is no backdoor path between T and M, therefore This can be directly obtained from statistics on the training set; Estimating the causal effect of mediator variable M on spectral feature X: Calculated by adjusting T to block the backdoor path: ; The overall causal effect of variety genotype on spectral characteristics was obtained by integration: It extracts unbiased causal features based on total causal effect, and is compatible with unobservable mixed scenarios.

[0012] Furthermore, in S3, principal component analysis is used to reduce the dimensionality of the initial causal features, and the top 15 principal components with a cumulative variance contribution rate of 99% are selected as the final causal feature set, thereby reducing computational complexity while retaining core causal information.

[0013] Furthermore, in S4, the specific process of counterfactual data enhancement is as follows: Constructing a fully connected neural network as a causal structural equation model to model the spectral feature generation mechanism. Where f is a nonlinear mapping function, The noise term is Gaussian random noise; the model is trained using the training set data, and the loss function is the mean squared error. For each real sample, with its genotype T fixed, Latin hypercube sampling is used to perform multi-gradient intervention sampling of environmental confounding factors to generate a combination of confounding factors covering the full range of fluctuations. The values ​​of the confounding factors after intervention are input into the causal structural equation model to generate counterfactual spectral features, and a spectral angle matching algorithm is used to perform quality screening. The selected counterfactual virtual samples are mixed with the original training set to construct an enhanced training set.

[0014] Furthermore, in step S4, the selected counterfactual samples are mixed with the original training set samples at a ratio of 4:1 to construct an enhanced training set, ensuring that the training set covers sufficient environmental fluctuation scenarios.

[0015] Furthermore, in S5, the corn variety identification classifier is a radial basis function kernel support vector machine, which uses grid search combined with cross-validation to optimize the penalty coefficient and kernel function parameters.

[0016] On the other hand, a maize variety identification system based on hyperspectral imaging, the system comprising: Data acquisition and preprocessing module: used to acquire hyperspectral images of corn samples and environmental contamination factor data, perform preprocessing and extract raw spectral features; Causal graph construction module: used to define genotype, environmental confounding factors, spectral characteristics and genotype label variables, construct a directed acyclic graph of causal structure, and verify conditional independence between variables; Causal feature extraction module: used to process observable confounding based on the backdoor criterion and unobservable confounding based on the frontdoor criterion, blocking spurious associations in the backdoor path and outputting a causal feature set; Counterfactual data augmentation module: used to train causal structural equation models, perform intervention sampling on confounding factors, generate and filter counterfactual samples, and construct an augmented training set; Variety identification output module: used to train the classifier and output variety identification results for the samples to be tested.

[0017] Compared with existing technologies, this method and system for identifying maize varieties based on hyperspectral imaging has the following advantages: This invention clarifies the true causal path between genotype and spectral features by constructing a directed acyclic graph of causal structure. It utilizes a dual mechanism of backdoor and frontdoor criteria to block spurious associations introduced by observable and unobservable confounding factors, respectively, and extracts essential spectral features determined solely by genotype from a causal perspective. This solves the problem of a sharp drop in accuracy of traditional statistical correlation models when detecting across different scenarios. At the same time, the introduction of the frontdoor criterion enables unbiased feature extraction without measuring all confounding factors, making it compatible with various application scenarios.

[0018] 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

[0019] 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.

[0020] Figure 1 This is a flowchart of a maize variety identification method based on hyperspectral imaging; Figure 2 This is a flowchart of step S3 in the maize variety identification method based on hyperspectral imaging; Figure 3 This is a block diagram of a maize variety identification method based on hyperspectral imaging. Detailed Implementation

[0021] 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.

[0022] Figure 1 This is a flowchart illustrating the hyperspectral imaging maize variety identification method based on causal inference provided by the present invention, as shown below. Figure 1 As shown, the method includes the following steps: S1: Collect hyperspectral image data of different maize varieties, simultaneously record environmental contamination factors during the collection process, preprocess the hyperspectral images and extract the spectral features of the samples to construct the original hyperspectral dataset.

[0023] The execution entity of this embodiment is the processing unit of a hyperspectral imaging detection system, which provides a hyperspectral imaging method for corn variety identification based on causal inference, used to achieve robust non-destructive identification of corn kernel varieties across acquisition environments.

[0024] Specifically, firstly, experimental samples of corn kernels were prepared. K corn varieties to be identified were selected, and several plump, undamaged, and mold-free kernels of each variety were selected as experimental samples. A visible-near-infrared hyperspectral imaging system was used to perform data acquisition. The wavelength range of the hyperspectral imaging system covers 400-1000nm, includes 224 continuous spectral bands, has a spectral sampling interval of 2.68nm, and a spatial resolution of 960×720 pixels. During acquisition, the corn kernels were laid flat on a black stage with the germ side facing up. Two sets of symmetrically arranged 50W halogen lamps were used to provide uniform diffuse illumination. The stage moving speed was set to 1.2mm / s, the camera exposure time was set to 15ms, and the lens working distance was 30cm.

[0025] Furthermore, multiple environmental contamination factors were set, and hyperspectral images of samples under different contamination conditions were acquired using the controlled variable method, with the corresponding contamination factor values ​​recorded simultaneously for each group of acquisitions. The environmental contamination factors included light intensity, ambient temperature, and sample moisture content. Light intensity was set at four gradients (400 lx, 800 lx, 1200 lx, and 1600 lx) by adjusting the power of the light source, and calibrated using an illuminance meter on the stage plane. Ambient temperature was set at four gradients (10℃, 20℃, 30℃, and 40℃) using a constant temperature incubator, with a temperature control accuracy of ±0.5℃. Sample moisture content was set at four gradients (8%, 12%, 16%, and 20%) through hygroscopic drying and humidification balancing treatments, and calibrated using an oven-drying method.

[0026] Preprocessing is performed on the raw hyperspectral image: For black and white reflectance correction: acquire the reflectance image of a standard white board with 99% reflectance and a completely dark field image with the lens completely blocked, and calculate the corrected reflectance image pixel by pixel and band by band: ,in, Wavelength Next pixel The corrected spectral reflectance characterizes the sample's ability to reflect light of that wavelength. wavelength Next pixel The original grayscale value, For the corresponding dark field grayscale value, R(i,j,λ) represents the corresponding grayscale value of the whiteboard, and R(i,j,λ) represents the corrected spectral reflectance. For smoothing and denoising: a 7-point window, second-order polynomial SG convolution kernel is used to perform convolution smoothing and denoising on the single-pixel spectral curve to suppress detector random noise and light source fluctuation noise during the acquisition process; For Standard Normal Transform (SNV): SNV correction is performed on each spectral curve to eliminate the light scattering baseline shift caused by sample surface roughness and grain curvature; specifically, for each spectral vector... Calculate its mean μ and standard deviation σ. The corrected spectrum satisfies: ,in, Wavelength Spectral reflectance after SNV correction Wavelength The original spectral reflectance after smoothing, μ is the mean reflectance of all 224 bands of a single spectral curve, and σ is the standard deviation of the reflectance of all 224 bands of a single spectral curve. For Region of Interest (ROI) extraction: Otsu's maximum inter-class variance method was used to perform threshold segmentation on the single-band image to extract the corn kernel region and remove background pixels. The kernel core endosperm region was selected as the ROI, and the average spectral reflectance vector of all pixels in this region across 224 bands was calculated as the original spectral features of a single kernel sample. .

[0027] After preprocessing, all samples were randomly divided into training set, validation set and test set in a ratio of 7:2:1. The test set used a confounding factor combination of light intensity 950 lx, ambient temperature 22℃ and water content 15%. This combination was different from the gradient values ​​collected in the training set and was used to verify the model's ability to generalize to unseen environmental conditions.

[0028] S2: Construct a directed acyclic graph model of the causal structure for hyperspectral maize variety identification, clarify the variable set and the causal paths between variables; use the PC algorithm to verify the conditional independence assumption of the causal graph.

[0029] Specifically, define the set of variables for the cause-effect graph. The specific definitions of each variable are as follows: Variety genotype T: an exogenous discrete variable, taking values ​​of K represents the total number of maize varieties, corresponding to the genotype categories of different maize varieties, and is the fundamental reason that determines the intrinsic spectral characteristics of varieties. Environmental confounding factor set U: a set of exogenous variables, including light intensity. Ambient temperature Sample moisture content Observable confounding, as well as unobservable confounding such as instrument drift and grain surface morphology, are the main sources of spurious correlations in spectral data. Spectral feature X: an endogenous high-dimensional continuous variable, namely the extracted 224-dimensional spectral reflectance vector, which is simultaneously affected by the genotype T of the variety and the environmental confounding factor U. Variety label Y: an endogenous discrete variable with the same value as T, corresponding to the maize variety category, directly determined by the variety genotype T. The model uses spectral features X to predict Y.

[0030] Define causal paths between variables and construct a directed acyclic graph (DAG): The true cause-and-effect path: That is, the genotype of a variety determines its intrinsic spectral characteristics by regulating the biochemical components and microstructure of the grain, thereby supporting variety identification. This path reflects the essential causal relationship between variety and spectrum, which is the core mechanism that the model needs to learn. Fake backdoor path: In other words, environmental confounding factors affect the spectral acquisition results by interfering with the propagation of light signals and changing the moisture state of samples, resulting in a statistical pseudo-correlation between spectral features X and variety label Y dominated by the environment. This is the fundamental reason for the decline in model performance across different scenarios.

[0031] The conditional independence hypothesis of the causal graph was verified using the PC algorithm based on the training set data, confirming the consistency between the preset causal structure and the actual data distribution. The specific process is as follows: Variety genotype T, light intensity Ambient temperature Sample moisture content First principal component of the spectrum Variety label Y is used as the test variable set; among which The first principal component of the original 224-dimensional spectral features represents the overall trend of spectral feature variation, reducing the computational complexity of high-dimensional variable testing; Construct an undirected complete graph containing 6 variables, where there is an initial undirected edge between any two variables; Perform a Pearson correlation coefficient test on each pair of variables, with a significance level of α=0.05; if the p-value of the corresponding test is greater than 0.05, the two variables are considered to be independent without any conditions, and the undirected edge between them is deleted. Starting with the condition set order d=1, the order is gradually increased. For each pair of adjacent variables in the current graph, all adjacent subsets containing d variables are traversed as condition sets, and partial correlation coefficient tests are performed. If there exists a condition set that makes the two variables independent under the condition (p>0.05), the edge between the two variables is deleted, and the condition set is recorded as a separating set. This process continues until all pairs of adjacent variables have completed the corresponding order test, or the condition set order reaches the maximum number of adjacent nodes.

[0032] Traverse all V-shaped structures (ABC). If node B is not in the separation set of A and C, then orient the edge as A→B←C. Then, propagate the edge direction according to the rules of avoiding cycle structures and avoiding additional V-shaped structures, and output the final causal structure directed acyclic graph.

[0033] The causal graph output by the PC algorithm is compared with the preset causal structure to confirm T→X. All five core paths from T to Y exist, and there are no reverse edges such as U pointing to Y or X pointing to T that do not conform to the prior knowledge, thus verifying the consistency between the preset causal graph and the data distribution.

[0034] S3: Based on the backdoor criterion and the frontdoor criterion, the backdoor path in the causal graph is identified. The causal adjustment algorithm blocks the false associations caused by environmental confounding factors, estimates the causal effect of variety genotype on spectral features, and extracts the causal feature set determined only by variety genotype.

[0035] Specifically, such as Figure 2 As shown, this step performs causal adjustment using the backdoor criterion and the frontdoor criterion for both observable and unobservable promiscuous scenarios, extracting unbiased causal features: Perform backdoor path identification: Based on the causal graph structure, identify all backdoor paths from U to X, and confirm the set of observable confounding factors. The set satisfies the backdoor criterion, meaning that the set blocks all backdoor paths between T and X that contain arrows pointing to T, and the set does not contain any descendant nodes of T.

[0036] Subsequently, confounding interference is eliminated through weighted summation, and 224-dimensional initial causal features are extracted. The specific process is as follows: The three observable confounding factors were discretized according to the acquisition gradient: light intensity was divided into 4 layers, ambient temperature into 4 layers, and sample moisture content into 4 layers, resulting in a total of 4×4×4=64 possible combinations of confounding factor values, denoted as […]. .

[0037] Based on the training set data, statistics were compiled for each combination of confounding factors. Frequency of occurrence of samples Given a training set with a total sample size of N, calculate the marginal probability of each mixed combination: ,in, It is the marginal probability of the i-th combination of confounding factors. is the number of samples in the training set corresponding to the i-th confounding factor combination, and N is the total number of samples in the training set; For each maize variety genotype t, the statistical training set genotype t and confounding factor combinations are: Calculate the average spectral vector for this group by analyzing the spectral characteristics of all samples. Gaussian kernel density estimation is used to fit the conditional distribution. The kernel function is a Gaussian kernel, and the bandwidth h is determined using the Silverman criterion. In the formula, σ is the standard deviation of the corresponding spectral band. The total number of samples with genotype t.

[0038] Based on the backdoor adjustment formula, the intervention is calculated for each genotype t. The expected spectral vector below, i.e., the baseline causal spectrum for this genotype: ,in, It is the 224-dimensional baseline causal spectral vector of the variety with genotype t. It is a genotype of t with a combination of confounding factors of t. The 224-dimensional average spectral vector under the given conditions is determined solely by the genotype of the variety, eliminating the overall spectral shift caused by confounding factors.

[0039] For any original sample, its genotype is t, and the corresponding confounding factor combination is... The original spectrum is Calculate the initial causal characteristics of this sample: ,in, It is a 224-dimensional initial causal feature vector for a single sample, where each element is the corrected spectral reflectance. It is the 224-dimensional original spectral feature vector of a single sample. This represents the offset of the current confounding conditions relative to the baseline causal spectrum; by eliminating the interference of confounding factors on the spectrum of this sample, we obtain an initial causal feature of 224 dimensions that reflects only genotypic differences.

[0040] The front-door criterion adjustment for unobservable confounding factors addresses unobservable confounding factors in practical applications. It employs the front-door criterion to perform causal adjustment, achieving unbiased estimation without measuring all confounding factors.

[0041] The 450-550nm visible light band and the 650-750nm red edge band were selected as the intermediate variable set M. This band set corresponds to the characteristic absorption peaks of biochemical components such as chlorophyll and protein, is directly regulated by the genotype of the variety, and is not directly affected by unobservable confounding factors, thus meeting the requirements of the front door criterion.

[0042] Then, perform a three-step calculation for front door adjustment: Estimating the causal effect of genotype T on mediating variable M: ​​Since there is no backdoor path between T and M, therefore This can be directly obtained from statistics on the training set; Estimating the causal effect of mediator variable M on spectral feature X: Calculated by adjusting T to block the backdoor path: ; The overall causal effect of variety genotype on spectral characteristics was obtained by integration: It extracts unbiased causal features based on total causal effect, and is compatible with unobservable mixed scenarios.

[0043] Principal component analysis was used to reduce the dimensionality of the initial 224-dimensional causal features. Principal components were selected by sorting them from largest to smallest according to their variance contribution rate. The specific process is as follows: Arrange the initial causal features of all samples in the training set by row to construct a sample matrix. , where N is the number of training set samples, and each row corresponds to the 224-dimensional initial causal features of a sample.

[0044] For each column of the sample matrix, perform centering by subtracting the mean of all samples in that column to obtain the centered matrix. This ensures that the mean of each column is 0, eliminating the difference in units and numerical range.

[0045] Calculate the covariance matrix between feature dimensions based on the centered matrix: Where C is a 224×224 symmetric positive semidefinite covariance matrix. yes A dimensional centered sample matrix, with each column having a mean of 0; It is the transpose of the centered sample matrix, with dimensions 224×N, and N-1 is the unbiased estimation correction coefficient, used to obtain an unbiased estimate of the covariance.

[0046] Performing eigenvalue decomposition on the covariance matrix C yields 224 eigenvalues. and the corresponding orthogonal eigenvectors .

[0047] Rearrange all eigenvalues ​​in descending order to obtain the sorted eigenvalues. The corresponding sorted feature vectors Each eigenvector corresponds to a principal component direction. The larger the eigenvalue, the more variance information that direction carries.

[0048] Calculate the variance contribution rate. The variance contribution rate of the k-th principal component is the proportion of its eigenvalues ​​to the sum of all eigenvalues. ,in It is the variance contribution rate of the k-th principal component, with a value range of [0,1], representing the proportion of original information carried by this principal component; It is the cumulative variance contribution rate of the first k principal components, with a value range of [0,1], representing the proportion of original information carried by the first k principal components. It is the k-th eigenvalue after sorting in descending order, a non-negative real number, obtained by eigenvalue decomposition of the covariance matrix; k is the principal component index, a positive integer, with a range of values. The cumulative variance contribution rate of the first k principal components is the proportion of the sum of the first k eigenvalues ​​to the sum of the total eigenvalues. , ; Iterate through the values ​​of k from smallest to largest to find those that satisfy the cumulative variance contribution rate. The minimum value of k, denoted as d, is given in this embodiment. .

[0049] Arrange the first d sorted eigenvectors column-wise to form a 224×d dimensional projection matrix. ; Given any 224-dimensional initial causal features By combining the projection matrix W, we obtain the final d-dimensional causal features after dimensionality reduction: ,in, It is the d-dimensional final causal feature vector after dimensionality reduction, in this embodiment .

[0050] S4: Build a counterfactual data augmentation framework, perform intervention sampling on environmental confounding factors based on causal structural equations, generate counterfactual hyperspectral samples under different confounding conditions, and then construct an augmented training set after converting the generated counterfactual spectra into causal features.

[0051] Specifically, a causal structural equation model is constructed and trained using a three-layer fully connected neural network to model the spectral feature generation mechanism. The input layer has a dimension of 4 (1-dimensional genotype one-hot encoding + 3-dimensional normalized confounding factor), the first hidden layer has a dimension of 128, the second hidden layer has a dimension of 256, the activation function is ReLU, the output layer has a dimension of 224, corresponding to the spectral feature dimension; ε is a Gaussian random noise term following N(0,0.01), used to simulate random fluctuations in the spectrum and individual differences.

[0052] The network was trained using the T, U, and X data from the training set. The loss function was the mean squared error (MSE), the optimizer was Adam, the initial learning rate was set to 0.001, and the learning rate was reduced to 0.5 times every 50 rounds. The total number of training rounds was 200. Early stopping was triggered when the validation set loss no longer decreased for 10 consecutive rounds to prevent overfitting.

[0053] For each real sample in the training set, with its genotype T=t fixed, multi-gradient intervention sampling beyond the training set range is performed on three types of environmental confounding factors: Illumination intensity: 31 gradients were sampled at 50 lx intervals within the range of 300-1800 lx; Ambient temperature: 41 gradients were sampled at 1℃ intervals within the range of 5-45℃; Sample moisture content: 33 gradients were sampled at 0.5% intervals within the range of 6%-22%.

[0054] The Latin hypercube sampling method is used to combine different confounding factor gradients to generate intervention sample points covering the entire fluctuation range, ensuring the uniformity of sampling in the parameter space and avoiding combinatorial explosion.

[0055] The values ​​of confounding factors after intervention are input into the trained causal structural equation model along with the corresponding genotypes to generate counterfactual spectral features. The Spectral Angle Matching (SAM) algorithm is then used to perform quality screening on the generated counterfactual samples. The calculation formula is as follows: ,in, It is the spectral angle matching value, and its range is... The smaller the value, the higher the similarity in shape between the two spectral curves; It is a generated 224-dimensional counterfactual spectral vector; It is the baseline causal spectral vector of genotype t, i.e. , It is the L2 norm of the counterfactual spectral vector; The L2 norm of the baseline causal spectral vector is used to eliminate outlier samples with spectral angles greater than 5°, ensuring the physical plausibility of counterfactual samples.

[0056] The selected counterfactual samples were mixed with the original training set samples at a ratio of 4:1 to construct an enhanced training set, ensuring that the training set covers a sufficiently rich range of environmental fluctuation scenarios.

[0057] S5: Train a maize variety identification classifier based on the augmented training set. Extract causal features from the hyperspectral data of the maize sample to be tested and input them into the classifier to output the variety identification result.

[0058] Specifically, a radial basis function kernel support vector machine (RBF-SVM) is used as the variety classifier. The model is trained using the final causal features of the enhanced training set as input and the variety label as output. A grid search method combined with 5-fold cross-validation is used to optimize the penalty coefficient C and the kernel function parameter γ, where the search range of C is

[10] . -2 10 3 The search range for γ is

[10] . −4 10 2 The goal is to optimize the classification accuracy of the validation set.

[0059] When performing inference on the test samples, first acquire hyperspectral images and extract the original spectral features, then map them to the final causal features by PCA projection according to the causal adjustment process; input the causal features into the trained support vector machine classifier, and output the corn variety category discrimination result and the corresponding confidence score.

[0060] Furthermore, the present invention also provides a hyperspectral imaging maize variety identification system based on causal inference, such as... Figure 3As shown, it includes a data acquisition and preprocessing module, a cause-effect graph construction module, a cause-effect feature extraction module, a counterfactual data enhancement module, and a variety identification output module. The data acquisition and preprocessing module is used to acquire hyperspectral images of corn samples and environmental contamination factor data, perform preprocessing, and extract raw spectral features. The causal graph construction module is used to define variety genotype, environmental confounding factors, spectral characteristics and variety label variables, construct a directed acyclic graph of causal structure, and verify the conditional independence between variables; The causal feature extraction module is used to process observable confounding based on the backdoor criterion and unobservable confounding based on the frontdoor criterion, blocking false associations in the backdoor path and outputting a causal feature set. The counterfactual data augmentation module is used to train the causal structural equation model, perform intervention sampling on confounding factors, generate and screen counterfactual samples, and construct an augmented training set. The variety identification output module is used to train the classifier and output the variety identification results for the samples to be tested.

[0061] To verify the effectiveness of this method, this embodiment selected 12 major maize varieties cultivated in the Huang-Huai-Hai region for comparative testing. The test set consisted of independent scenarios with completely different environmental conditions from the training set. The discriminative performance of the traditional RBF-SVM model, the transfer domain adaptation SVM model, and the method of this invention were compared. The results are as follows: Traditional RBF-SVM 65.30% 0.62 Migration Domain Adaptation SVM 78.60% 0.76 Method of the present invention 95.10% 0.94 The results show that the method of the present invention can effectively eliminate the interference of environmental confounding factors, significantly improve the accuracy of maize variety identification under different collection conditions, and its robustness is significantly better than that of traditional statistical methods and conventional domain adaptation methods.

[0062] 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 identifying maize varieties based on hyperspectral imaging, characterized in that, The method includes the following specific steps: S1. Collect hyperspectral image data of different maize varieties, record environmental contamination factor data during the collection process, preprocess the hyperspectral images and extract the spectral features of the samples to construct the original hyperspectral dataset; S2. Construct a causal structure directed acyclic graph model for hyperspectral maize variety identification to clarify the variable set and the causal paths between variables; S3. Based on the backdoor criterion and the frontdoor criterion, the backdoor path in the causal graph is identified, and the original spectral features are mapped to causal features that are only affected by genotype based on the calculated post-intervention distribution. S4. Build a counterfactual data augmentation framework, perform intervention sampling on environmental confounding factors based on causal structure, generate counterfactual hyperspectral samples under different confounding conditions, and combine the generated counterfactual spectral features with the original samples and causal features to construct an augmented training set after causal adjustment and dimensionality reduction. S5. Train a maize variety identification classifier based on the augmented training set. Extract causal features from the hyperspectral data of the maize sample to be tested and input them into the classifier to output the variety identification result.

2. The method for identifying maize varieties based on hyperspectral imaging according to claim 1, characterized in that, In S2, a set of causal graph variables is defined. Among them, the genotype T of the variety takes a value of K represents the total number of maize varieties, corresponding to the genotype categories of different maize varieties; the set of environmental confounding factors U includes light intensity. Ambient temperature Sample moisture content Observable mixing And instrument drift, unobservable confounding factors such as grain surface morphology, etc. The spectral feature X is a vector of spectral reflectance, which is influenced by both the genotype T and the environmental contamination factor U. The genotype label Y has the same value as T, corresponding to the maize variety category, and is directly determined by the genotype T.

3. The method for identifying maize varieties based on hyperspectral imaging according to claim 1, characterized in that, In S2, the specific steps for defining causal paths between variables and constructing a directed acyclic graph are as follows: The true cause-and-effect path: That is, the genotype of a variety determines its intrinsic spectral characteristics by regulating the biochemical components and structure of the grain. This pathway reflects the essential causal relationship between variety and spectrum. Fake backdoor path: This means that environmental confounding factors affect the spectral acquisition results by interfering with the propagation of light signals and changing the physical state of the samples, resulting in a statistical pseudo-correlation between spectral features X and variety label Y dominated by the environment.

4. The method for identifying maize varieties based on hyperspectral imaging according to claim 1, characterized in that, In step S3, the backdoor path identification is adjusted based on the backdoor criterion: Based on the causal graph structure, identify all backdoor paths from U to X and confirm the set of observable confounding factors. Satisfy the backdoor criteria; Based on the backdoor adjustment formula, calculate the spectral characteristic conditional distribution after intervention on genotype T of the variety. ; By weighted summing of all values ​​of the confounding factors, the interference of environmental confounding on spectral characteristics is eliminated, and the initial causal characteristics determined solely by the genotype of the variety are obtained.

5. The method for identifying maize varieties based on hyperspectral imaging according to claim 4, characterized in that, The spectral characteristic condition distribution The expression is: Where u is the combination of observable confounding factors, The spectral characteristic conditional distribution for genotype t and confounding factor combination u was obtained by fitting with Gaussian kernel density estimation. The marginal distribution of the confounding factor set is obtained from the training set statistics.

6. The method for identifying maize varieties based on hyperspectral imaging according to claim 1, characterized in that, In S3, the specific steps for performing causal adjustment using the front-door criterion are as follows: The visible light band and the red-edge band are selected as the set of intermediate variables M; Estimate the causal effect of genotype T on mediating variable M. Estimate the causal effect of mediating variable M on spectral feature X. The integral yields the total causal effect of variety genotype on spectral features, enabling unbiased causal feature extraction in unobservable mixed scenarios.

7. The method for identifying maize varieties based on hyperspectral imaging according to claim 1, characterized in that, In S4, the specific process of counterfactual data enhancement is as follows: Constructing a fully connected neural network as a causal structural equation model to model the spectral feature generation mechanism. Where f is a nonlinear mapping function, The noise term is Gaussian random noise; the model is trained using the training set data, and the loss function is the mean squared error. For each real sample, with its genotype T fixed, Latin hypercube sampling is used to perform multi-gradient intervention sampling of environmental confounding factors to generate a combination of confounding factors covering the full range of fluctuations. The values ​​of the confounding factors after intervention are input into the causal structural equation model to generate counterfactual spectral features, and a spectral angle matching algorithm is used to perform quality screening. The selected counterfactual virtual samples are mixed with the original training set to construct an enhanced training set.

8. The method for identifying maize varieties based on hyperspectral imaging according to claim 1, characterized in that, In S5, the maize variety identification classifier is a radial basis function kernel support vector machine, which uses grid search combined with cross-validation to optimize the penalty coefficient and kernel function parameters.

9. A maize variety identification system based on hyperspectral imaging, the system being applicable to the maize variety identification method based on hyperspectral imaging as described in any one of claims 1-8, characterized in that, The system includes: Data acquisition and preprocessing module: used to acquire hyperspectral images of corn samples and environmental contamination factor data, perform preprocessing and extract raw spectral features; Causal graph construction module: used to define genotype, environmental confounding factors, spectral characteristics and genotype label variables, construct a directed acyclic graph of causal structure, and verify conditional independence between variables; Causal feature extraction module: used to process observable confounding based on the backdoor criterion and unobservable confounding based on the frontdoor criterion, blocking spurious associations in the backdoor path and outputting a causal feature set; Counterfactual data augmentation module: used to train causal structural equation models, perform intervention sampling on confounding factors, generate and filter counterfactual samples, and construct an augmented training set; Variety identification output module: used to train the classifier and output variety identification results for the samples to be tested.