A method for correcting seed inspection data of *Gynura divaricata* based on transfer learning
By constructing an equipment-environment error database and training a domain-adaptive transfer correction model, and dynamically updating the classification threshold, the standardization problem of *Gynostemma pentaphyllum* seed testing data under different equipment and environments was solved, enabling effective reuse and reliable correction of cross-laboratory data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-03-10
AI Technical Summary
In the existing technology, the test data of *Gynostemma pentaphyllum* seeds have systematic deviations under different testing equipment and environmental conditions. There is a lack of a unified benchmark data system and equipment-environment error quantification mechanism, which leads to insufficient data reusability across laboratories and makes it difficult to achieve standardization and unification.
By collecting benchmark data of standard equipment under standard environment and target data under different conditions, a device-environment error database is constructed, a domain adaptation transfer correction model is trained, gray value correction and spectral band alignment processing are performed, and classification thresholds are dynamically updated to achieve data standardization and consistency correction.
This has enabled the standardization of seed testing data under different conditions, improved the accuracy and consistency of data correction, and ensured the effective reuse and reliability of data across laboratories.
Smart Images

Figure CN121278494B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of seed quality inspection, and in particular to a rush-grass seed inspection data correction method based on transfer learning. BACKGROUND
[0002] Seed quality inspection is a core link for guaranteeing crop planting effectiveness and stability of variety quality, and rush-grass, as a crop with specific application value, is directly related to subsequent planting yield and quality performance. At present, the industry has generally adopted image acquisition, spectral analysis and other technical means to obtain seed morphological characteristics, internal biochemical components and other related data, and combined with seed quality index correlation data to carry out inspection work. With the increasing demand for cross-laboratory collaboration and data sharing, inspection data in different detection scenarios is increasingly widely used, and intelligent technologies such as transfer learning and data modeling are gradually introduced into the field of seed inspection, providing technical support for improving data processing efficiency and accuracy.
[0003] In the existing rush-grass seed inspection practice, the differences in hardware configuration of different detection equipment and the fluctuations in detection environment conditions will cause systematic deviation in the inspection data, and there is a lack of unified benchmark data system and equipment-environment error quantification mechanism. At the same time, there is a lack of effective domain adaptation transfer correction method in the existing technology to correct the difference data, and the classification threshold is mostly set in a fixed mode, which is difficult to adapt to the feature distribution difference of different source data, ultimately leading to the fact that the inspection data under different laboratories and different detection conditions cannot be standardized and unified, the cross-laboratory data reuse is insufficient, and it is difficult to provide consistent and reliable technical support for the unified evaluation of seed quality. SUMMARY
[0004] The present application aims to overcome one or more of the deficiencies of the prior art and provide a rush-grass seed inspection data correction method based on transfer learning.
[0005] The purpose of the present application is achieved by the following technical solutions:
[0006] A rush-grass seed inspection data correction method based on transfer learning is provided, which comprises the following steps:
[0007] S1. Collecting standard equipment under standard environment rush-grass seed inspection benchmark data, and collecting different detection equipment, different environment conditions rush-grass seed inspection target data, the inspection data including seed image data, spectral data and corresponding seed quality index correlation data;
[0008] S2. Establishing a device-environment error database based on the collected reference data and target data, fitting an error influence function by analyzing the differences between the reference data and the target data, setting the reference data of the standard device as the source domain data and the target data under different conditions as the target domain data, training a domain adaptation transfer correction model, and using the domain adaptation transfer correction model to correct the gray value and align the spectral band of the target domain data;
[0009] S3. Based on the feature distribution of the corrected target domain data and the reference data, dynamically updating the classification threshold of the seed test of Desmodium caudatum by using a statistical analysis algorithm to obtain standardized correction data and unified classification standards;
[0010] S4. Mapping the corrected data from different sources to a unified feature space to verify the consistency of the standardized data, and outputting the standardized results of the seed test of Desmodium caudatum and data traceability information that are universal across laboratories.
[0011] Further, the fitting error influence function in step S2 includes the following sub-steps:
[0012] S2.1. Extracting key factors affecting test data from the device-environment error database, the key factors including device model parameters, illumination condition parameters, temperature and humidity parameters, quantifying discrete type key factors using one-hot encoding, normalizing continuous type key factors to eliminate dimension differences, and selecting factors with correlation meeting preset conditions through Pearson correlation coefficient and removing redundant factors;
[0013] S2.2. Fitting the error influence function using a multiple linear regression algorithm, the expression being:
[0014] ;
[0015] Where ΔF is the error value of the test data, X1 to X n are the quantized key factors, α1 to α n are the influence coefficients of the key factors, and β is the error constant term. After fitting, the function effectiveness is verified through residual analysis, and the data samples with excessive residuals are re-selected and fitted with the function, and the error function is iteratively optimized until the fitting degree meets the preset requirements.
[0016] Further, the training domain adaptation transfer correction model in step S2 includes the following sub-steps:
[0017] S201. Extracting features from the source domain data and the target domain data respectively, obtaining high-dimensional feature vectors through the feature extraction layer of the deep neural network, and quantifying the feature distribution difference between the source domain and the target domain after L2 normalization of the feature vectors using the maximum mean difference algorithm, the expression being: ;
[0018] wherein MMD is the maximum mean discrepancy, X is the source domain feature set, Y is the target domain feature set, is a kernel function mapping to adapt high-dimensional features, is an expectation operator, and the distribution distance between the source domain and the target domain in the reproducing kernel Hilbert space is calculated by the formula;
[0019] S202. An adversarial training network including a feature extractor, a domain discriminator, and a corrector is constructed, the feature extractor is responsible for outputting domain-invariant features, the domain discriminator distinguishes whether the features come from the source domain or the target domain through a binary classification task, and the corrector corrects the target domain data based on the domain-invariant features. The classification loss is used to ensure the prediction accuracy of the quality index of the source domain data, the domain adaptation loss is used to minimize the difference between the domains based on the calculation result of the MMD, and the model training is completed by alternately training the feature extractor and the domain discriminator.
[0020] Further, in step S1, the collected reference data and target data are preprocessed, the adaptive median filtering algorithm is used to denoise the seed image data, the environmental noise and device sensor noise are removed, the box plot analysis method is used to eliminate outliers in the spectral data and quality index associated data, and the preprocessed data is packaged according to the unified data format specification.
[0021] Further, in step S2, the device-environment error database adopts an incremental updating mechanism, a data quality verification module is set, the verification data collected under the new detection device or environmental condition is verified for integrity and effectiveness, the device parameters, environmental parameters and data error information under this scene are automatically extracted after the verification is passed, and are supplemented to the error database, and the incremental updating of the error influence function is triggered.
[0022] Further, in step S3, when the classification threshold is dynamically updated, a probability density distribution model is constructed based on the statistical characteristics of the corrected data, a kernel density estimation algorithm is used to estimate the feature distribution curve corresponding to different quality indexes, the inflection point interval of the feature distribution curve is determined as the initial range of the classification threshold, the initial range is adjusted by shrinking in combination with the classification threshold distribution law of the reference data, and the classification threshold adapted to the standardized data is obtained.
[0023] Further, in step S4, when verifying the consistency of the standardized data, the cosine similarity between different source correction data is calculated, and the K nearest neighbor algorithm is used to calculate the clustering purity of the same quality index data. When the average cosine similarity and the clustering purity both meet the preset requirements, it is determined that the data meets the cross-laboratory reuse standard. If the requirements are not met, the model parameter migration correction model is re-optimized from step S2.
[0024] Further, the domain adaptation migration correction model in step S2 adopts a deep neural network architecture, the feature extraction layer of the neural network adopts a structure combining a convolutional neural network and a fully connected layer, the domain adaptation layer realizes domain invariant feature learning through a gradient inversion layer, and the data correction output layer adopts a linear regression unit to map and convert the feature vectors after domain adaptation processing and output corrected target domain data.
[0025] Further, the standardized results output in step S4 include unified quantitative values of the purity, maturity and vigor grade quality indicators of the seeds of the herba siegesbeckiae, and the uncertainty evaluation results of the indicators are calculated, and the uncertainty is comprehensively calculated based on the error propagation law and data distribution dispersion in the correction process.
[0026] Further, the spectrum data collected in step S1 include reflection spectrum information in the visible light to near-infrared wave band, the characteristic response of the biochemical components in the seeds is obtained through continuous wave band sampling, and the seed image data include two-dimensional morphological contour, color space distribution and surface texture detail visual feature information of the seeds.
[0027] The beneficial effects of the present application are:
[0028] (1) By collecting reference and target data, constructing an error database, training a migration correction model and dynamically updating classification thresholds, standardized testing data under different conditions is realized, and effective reuse of cross-laboratory data is supported.
[0029] (2) By quantifying equipment and environmental interference through fitting error influence functions, and combining the domain adaptation migration correction model, systematic errors of the testing data are effectively eliminated, and the precision and consistency of data correction are improved.
[0030] (3) Through data preprocessing, dynamic threshold adjustment and traceability information and uncertainty evaluation, the reliability and traceability of the standardized results are ensured, and technical support is provided for seed testing standardization. BRIEF DESCRIPTION OF DRAWINGS
[0031] Figure 1 It is a step flow chart of a herba siegesbeckiae seed testing data correction method based on migration learning.
[0032] Figure 2 It is a specific step division diagram of a herba siegesbeckiae seed testing data correction method based on migration learning provided by the embodiment.
[0033] Figure 3 It is an S1 testing data collection and preprocessing sub-step flow chart provided by the embodiment.
[0034] Figure 4 It is an S2 error modeling and migration correction model training sub-step flow chart provided by the embodiment.
[0035] Figure 5 S3 classification threshold dynamic updating sub-step flowchart provided for the embodiment;
[0036] Figure 6 S4 data standardization verification and result output sub-step flowchart provided for the embodiment. DETAILED DESCRIPTION
[0037] The technical solutions of the present application will be described below in conjunction with the embodiments, apparently, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0038] Embodiment 1
[0039] Referring to Figure 1 , a kind of based on migration learning's chase yellow grass seed inspection data correction method is provided, comprising the following steps:
[0040] S1. standard equipment is collected under standard environment chase yellow grass seed inspection datum, different detection equipment, different environmental conditions under chase yellow grass seed inspection target data are collected, the inspection data include seed image data, spectral data and corresponding seed quality index associated data;
[0041] S2. based on the reference data and target data collected equipment-environment error database is established, the difference between the reference data and target data is analyzed to fit error influence function, the reference data of standard equipment is set as source domain data, the target data under different conditions is set as target domain data, the domain adaptation transfer correction model is trained, and the domain adaptation transfer correction model is used to correct the gray value of target domain data, spectral band alignment processing;
[0042] S3. based on the feature distribution of the reference data and the corrected target domain data, the classification threshold of chase yellow grass seed inspection is dynamically updated using statistical analysis algorithm, to obtain standardized correction data and unified classification standard;
[0043] S4. map the corrected data of different sources to a unified feature space, verify the consistency of the standardized data, and output the standardized results and data traceability information of chase yellow grass seed inspection that can be used across laboratories.
[0044] In some embodiments, a distributed data acquisition method can be used to acquire baseline and target data. The acquired seed image and spectral data are preprocessed (e.g., noise filtering, format conversion) via edge computing nodes before being transmitted to the core processing unit, reducing data transmission volume and processing pressure on the core unit. Simultaneously, when training the domain adaptation transfer correction model, a semi-supervised learning strategy can be introduced, utilizing unlabeled target domain data to assist training. A pseudo-label generation mechanism expands the training sample set, improving the model's adaptability to data from different devices and environments without additional manual labeling. Subsequently, the classification threshold dynamic update and data standardization consistency verification are completed according to the original steps to ensure that the output cross-laboratory test results meet standardization requirements.
[0045] The fitting error influence function in step S2 includes the following sub-steps:
[0046] S2.1. Extract key factors affecting test data from the equipment-environment error database. The key factors include equipment model parameters, illumination condition parameters, and temperature and humidity parameters. Use one-hot coding to quantify the categorized key factors and normalize the continuous key factors to eliminate dimensional differences. Use Pearson correlation coefficient to screen factors whose correlation meets the preset conditions and remove redundant factors.
[0047] S2.2. The error influence function is fitted using a multiple linear regression algorithm, and its expression is:
[0048] ;
[0049] Where ΔF is the error value of the test data, X1 to X n The key factors, α1 to α, are quantified. n β represents the influence coefficients corresponding to each key factor, and β is the error constant term. After fitting, the effectiveness of the function is verified by residual analysis. For data samples with excessive residuals, factor screening and function fitting are performed again, and iterative optimization is carried out until the goodness of fit of the error function meets the preset requirements.
[0050] In some embodiments, key categorical factors can be quantified using a combination of label encoding and feature hashing to avoid the feature dimension explosion problem caused by one-hot encoding. Simultaneously, principal component analysis (PCA) is used to reduce the dimensionality of the quantified key factors, preserving their main feature information to simplify data dimensions. When fitting the error influence function, support vector regression (SVR) can be used instead of multiple linear regression. Kernel function mapping transforms the linear relationship between key factors and error values into a non-linear relationship, adapting to the complex correlation that may exist between equipment-environment factors and test data errors. After fitting, residual analysis is used to verify the effectiveness of the function. Samples with excessive residuals are re-selected for factors and iteratively optimized until the goodness of fit of the error function meets the preset requirements.
[0051] Step S2, training the domain adaptation transfer correction model, includes the following sub-steps:
[0052] S201. Feature extraction is performed on the source domain data and the target domain data respectively. High-dimensional feature vectors are obtained through the feature extraction layer of a deep neural network. After L2 normalization of the feature vectors, the maximum mean difference algorithm is used to quantify the difference in feature distribution between the source domain and the target domain. The expression is: ;
[0053] Where MMD represents the maximum mean difference, X is the feature set of the source domain, and Y is the feature set of the target domain. To adapt kernel function mapping for high-dimensional features, As the expectation operator, the distribution distance between the source domain and the target domain in the reproducing kernel Hilbert space is calculated using this formula;
[0054] S202. Construct an adversarial training network containing a feature extractor, a domain discriminator, and a corrector. The feature extractor is responsible for outputting domain-invariant features. The domain discriminator distinguishes whether the features come from the source domain or the target domain through a binary classification task. The corrector corrects the target domain data based on the domain-invariant features. The classification loss and the domain adaptation loss are used as parameters of the joint loss function to optimize the model. The classification loss is used to ensure the accuracy of the prediction of the quality index of the source domain data. The domain adaptation loss minimizes the inter-domain difference based on the MMD calculation result. The model training is completed by alternately training the feature extractor and the domain discriminator.
[0055] In some embodiments, feature extraction of source and target domain data can employ a Transformer architecture instead of a combination of convolutional neural networks and fully connected layers. This self-attention mechanism captures global morphological correlations in seed image data and inter-band correlations in spectral data, improving the comprehensiveness of high-dimensional feature extraction. When quantifying differences in feature distributions between domains, Wasserstein distance can be used instead of maximum mean difference (MMD), more accurately measuring the degree of difference by calculating the optimal transmission distance between the two distributions. The adversarial training network retains the feature extractor, domain discriminator, and corrector structure, using classification loss and a domain adaptation loss based on Wasserstein distance as the joint loss function. Alternating training is performed to complete model construction, achieving accurate correction of the target domain data.
[0056] In step S1, the collected baseline data and target data are preprocessed. An adaptive median filtering algorithm is used to denoise the seed image data to remove environmental noise and device sensor noise. Outliers in the spectral data and quality index correlation data are removed by box plot analysis. The preprocessed data is then packaged according to a unified data format specification.
[0057] In some embodiments, bilateral filtering can be used instead of adaptive median filtering for denoising seed image data. This algorithm considers both spatial distance and grayscale similarity, removing environmental noise and device sensor noise while more accurately preserving seed surface texture details and edge features. For outlier removal in spectral data and quality indicator correlation data, DBSCAN clustering can be used instead of box plot analysis. Density clustering divides the data into core samples, boundary samples, and noise samples, directly identifying noise samples as outliers, thus avoiding the dependence of box plot analysis on data distribution type. The preprocessed seed image data, spectral data, and quality indicator correlation data are still packaged according to a unified format specification to ensure compatibility in subsequent data processing stages.
[0058] In step S2, the equipment-environment error database adopts an incremental update mechanism and sets up a data quality verification module to verify the completeness and validity of the test data collected under newly added testing equipment or environmental conditions. After the verification is passed, the equipment parameters, environmental parameters and data error information under the scenario are automatically extracted and added to the error database, while triggering the incremental update of the error influence function.
[0059] In some embodiments, incremental updates to the device-environment error database can be set with dual triggering conditions. Besides adding new testing equipment or environmental conditions, incremental updates are also triggered when the accumulated amount of new test data under the same device or environment reaches a preset threshold, or when the feature similarity between the new data and historical data in the database is lower than a set threshold. The data quality verification process can employ cross-validation, comparing newly collected data with multiple sets of historical data from similar devices and environments in the database, rather than comparing a single set of historical data, further improving verification accuracy. After successful verification, device parameters, environmental parameters, and error information for the new scenario are automatically extracted and added to the database, triggering an incremental update of the error impact function. This allows for adaptation to the new scenario without retraining the entire function.
[0060] In step S3, when dynamically updating the classification threshold, a probability density distribution model is constructed based on the statistical characteristics of the corrected data. The kernel density estimation algorithm is used to estimate the feature distribution curves corresponding to different quality indicators. The inflection point interval of the feature distribution curve is determined as the initial range of the classification threshold. Combined with the classification threshold distribution pattern of the benchmark data, the initial range is shrunk and adjusted to obtain the classification threshold adapted to the standardized data.
[0061] In some embodiments, when dynamically updating the classification threshold, a Bayesian optimal classifier can be used instead of the kernel density estimation algorithm to determine the classification threshold. By calculating the prior probability and likelihood function of feature values under different quality indicators, the posterior probability distribution is obtained, and the optimal classification threshold is determined with the goal of minimizing the classification error rate. When adjusting the threshold, a multi-round iterative adjustment strategy can be adopted. First, an initial threshold is determined based on the corrected data, and then it is adjusted for the first time after being compared with the benchmark data threshold. Then, the adjusted threshold is applied to a portion of the corrected data to verify the classification effect. Based on the verification results, it is fine-tuned again until the threshold is both adapted to the feature distribution of the standardized data and consistent with the classification standard of the benchmark data, thereby improving the accuracy and applicability of the classification threshold.
[0062] In step S4, when verifying the consistency of data standardization, the cosine similarity between calibration data from different sources is calculated. At the same time, the K-nearest neighbor algorithm is used to statistically analyze the cluster purity of data of the same quality index. When the mean cosine similarity and cluster purity both meet the preset requirements, the data is determined to meet the cross-laboratory reuse standard. If the requirements are not met, the process is backtracked to step S2 to re-optimize the migration calibration model parameters.
[0063] In some embodiments, when verifying the consistency of data standardization, the Jaccard similarity coefficient can be used instead of cosine similarity to measure the similarity of calibration data from different sources. By calculating the ratio of the intersection to the union of feature sets, it is more suitable for sparse feature data scenarios (such as local texture features of seeds). When statistically analyzing the clustering of similar quality index data, hierarchical clustering algorithms can be used instead of the K-nearest neighbor algorithm. By progressively merging or splitting clusters, clustering results that better reflect the actual distribution of the data are obtained, and then the cluster purity is calculated. When the mean cosine similarity and cluster purity do not meet the requirements, in addition to backtracking and optimizing the transfer calibration model parameters, additional target domain data can be collected, reprocessed, and added to the model training to further improve the model's calibration effect on the target domain data and ensure that the data meets the cross-laboratory reuse standards.
[0064] The domain adaptation transfer correction model in step S2 adopts a deep neural network architecture. The feature extraction layer of this neural network adopts a structure combining convolutional neural network and fully connected layer. The domain adaptation layer realizes domain-invariant feature learning through gradient inversion layer. The data correction output layer adopts linear regression unit to map and transform the feature vector after domain adaptation processing and output the corrected target domain data.
[0065] In some embodiments, the feature extraction layer of the domain adaptation transfer correction model can use a residual network (ResNet) instead of the combination of convolutional neural networks and fully connected layers. The residual connection solves the gradient vanishing problem in deep network training, improving the depth and efficiency of feature extraction. The domain adaptation layer can introduce an attention mechanism to assign different weights to different feature dimensions, strengthen domain-invariant features related to seed quality preset conditions (such as seed core morphology and key spectral bands), and weaken interference features related to the device environment. The data correction output layer can use a multilayer perceptron (MLP) instead of a linear regression unit. Through nonlinear transformation, it adapts to complex correction requirements, accurately maps domain-invariant features to the corrected target domain data, and improves the accuracy of data correction.
[0066] The standardized results output in step S4 include unified quantitative values of quality indicators such as purity, maturity, and vigor level of *Gynostemma pentaphyllum* seeds. At the same time, the uncertainty assessment results of each indicator are calculated. The uncertainty is calculated based on the error propagation law and data distribution dispersion during the correction process.
[0067] In some embodiments, when calculating the uncertainty of each quality indicator, the Monte Carlo simulation method can be used instead of the comprehensive calculation based on the error propagation law and the dispersion of data distribution. By randomly sampling each error source (such as data acquisition error and model training error) during the calibration process, the complete calibration process of a large number of data samples is simulated, and the distribution characteristics of the output results are statistically analyzed. The standard deviation of the distribution is used as the uncertainty, which more intuitively and accurately reflects the impact of error accumulation on the quality indicators. In addition to the unified quantitative value and uncertainty of the quality indicators, the standardized output results can also include the stability assessment results of the quality indicators (such as the fluctuation of calibration data in different batches), providing more comprehensive reference information for cross-laboratory data comparison and reuse.
[0068] The spectral data collected in step S1 includes reflectance spectral information from the visible to near-infrared bands. The characteristic responses of the internal biochemical components of the seed are obtained through continuous band sampling. The seed image data includes visual feature information such as the two-dimensional morphological outline, color space distribution, and surface texture details of the seed.
[0069] In some embodiments, when collecting spectral data, a characteristic band sampling method can be used instead of continuous band sampling. Based on the characteristic absorption bands of the biochemical components (such as chlorophyll and oil) inside the seeds of *Gynostemma pentaphyllum*, only the reflectance spectral information of key bands is collected. This reduces sampling time and data storage while ensuring the response of core biochemical features. When collecting seed image data, three-dimensional imaging technology can be used to obtain the three-dimensional morphological features of the seeds (such as seed volume and surface roughness), replacing some two-dimensional visual features. Together with color space distribution and surface texture details, these features constitute the feature dimension of the seed image data, providing richer morphological information support for subsequent feature extraction and data correction, and helping to improve the accuracy of data correction and quality indicator evaluation.
[0070] Example 2
[0071] See Figure 2 This embodiment provides an implementation process for a method to correct test data of *Gynostemma pentaphyllum* seeds based on transfer learning. By standardizing the collection and preprocessing of test data, constructing an error modeling system, training a domain-adaptive transfer correction model, dynamically updating classification thresholds, and verifying data standardization consistency, it achieves standardized processing of *Gynostemma pentaphyllum* seed test data under different testing equipment and environmental conditions, providing technical support for the reuse of test data in cross-laboratory scenarios. The implementation steps are as follows:
[0072] S1. Test Data Acquisition and Preprocessing:
[0073] S1, as a fundamental step in the data correction method, focuses on acquiring high-quality benchmark and target data. It then uses targeted preprocessing to eliminate noise, outliers, and format differences in the original data, providing a reliable data foundation for subsequent error modeling and model training. Figure 3 As shown, the specific steps include the following:
[0074] S1.1 Baseline and Target Data Acquisition:
[0075] The data collection process must adhere to the following specifications: Select standard equipment that meets industry testing standards, and perform data collection operations on *Gynostemma pentaphyllum* seed samples under preset standard environmental conditions. The obtained baseline data must cover seed image data, spectral data, and corresponding seed quality index related data. Simultaneously, for different models of testing equipment and different environmental conditions, collect *Gynostemma pentaphyllum* seed test target data. The type of target data must be completely consistent with the baseline data, that is, it also includes seed image data, spectral data, and corresponding seed quality index related data. During the collection process, the equipment parameters (such as equipment model, core hardware configuration parameters, etc.) and environmental parameters (such as light intensity parameters, temperature and humidity parameters, etc.) corresponding to each set of target data must be recorded in detail.
[0076] The spectral data needs to cover the reflectance spectrum from visible light to near-infrared bands. The characteristic responses of the internal biochemical components of the seeds are captured by continuous band sampling. These biochemical component characteristics are directly related to the core quality indicators of the seeds, such as purity, maturity, and vigor level. The seed image data needs to be captured by high-definition imaging equipment from multiple angles without obstruction, to fully record the two-dimensional morphological outline, color space distribution, and surface texture details of the seeds, so as to ensure that comprehensive seed feature information can be obtained in the subsequent feature extraction stage.
[0077] In some embodiments, the acquisition of spectral data can adopt a segmented sampling method instead of continuous band sampling. Based on the characteristic response patterns of the internal biochemical components of *Gynostemma pentaphyllum* seeds, key response bands are selected for focused sampling. This reduces the amount of data collected and storage resources occupied while ensuring the integrity of the feature information. Seed image data acquisition can be combined with multispectral imaging technology to simultaneously acquire the visual features of seeds in different spectral channels, further enriching the data dimensions and providing more information support for subsequent feature fusion and correction.
[0078] S1.2 Data Preprocessing:
[0079] The collected baseline and target data are preprocessed to eliminate noise, outliers, and format differences. Specific operations include the following:
[0080] S1.2.1 Denoising of seed image data:
[0081] To address environmental noise (such as light reflection interference and noise from stray light projection) and device sensor noise (such as electronic noise from the imaging sensor itself and signal interference noise) present in the acquired seed image data, an adaptive median filtering algorithm is employed for denoising. This algorithm dynamically adjusts the size of the filtering window and statistically analyzes the grayscale value of each pixel and its neighboring pixels. While preserving key features such as seed morphology and texture details, it effectively filters out various types of noise interference. During processing, the filtering window is adaptively adjusted based on the noise intensity of local image regions: for noise-dense areas, the window size is increased to enhance denoising; for feature-dense areas (such as areas with detailed seed surface textures), the window size is reduced to avoid blurring or loss of key features, achieving a balance between denoising effectiveness and feature preservation.
[0082] S1.2.2 Outlier Removal:
[0083] For the collected spectral data and quality index-related data, box plot analysis was used to remove outliers. First, statistical analysis was performed on the reflectance values of each band of the spectral data and the quantized values of the quality index-related data. A box plot was constructed, and the quartiles (lower quartile Q1, median Q2, upper quartile Q3) and interquartile range (IQR = Q3 - Q1) were calculated. Data exceeding the range [Q1 - 1.5 × IQR, Q3 + 1.5 × IQR] were identified as outliers. For spectral data samples identified as outliers, the equipment and environmental parameters recorded during the acquisition process were checked to confirm whether the data anomalies were caused by temporary equipment malfunctions (such as spectrometer optical path deviation) or sudden environmental changes (such as rapid changes in temperature and humidity). For outliers in the quality index-related data, the actual condition of the corresponding seed samples was reviewed (e.g., whether the seeds were damaged or moldy) to ensure the accuracy of outlier removal and avoid the accidental deletion of valid data.
[0084] S1.2.3 Data Format Encapsulation:
[0085] Following a unified data format specification, the baseline and target data, after denoising and outlier removal, are encapsulated. A standardized data storage structure is established, clearly defining the storage paths, file formats, and metadata information (such as data acquisition time, acquisition device model, acquisition environment parameters, and preprocessing algorithm parameters) for seed image data, spectral data, and quality indicator-related data. Seed image data is stored in a lossless compression format, fully preserving pixel-level feature information; spectral data is stored in matrix form, with each row corresponding to the full-band reflectance value of a seed sample and each column corresponding to the reflectance value of a specific band; quality indicator-related data is stored in a structured table format, clearly labeling the names of each quality indicator for each seed sample (such as purity, maturity, and viability level) and their corresponding quantitative values. This format encapsulation ensures that test data from different sources and of different types have a unified structural standard, guaranteeing compatibility for subsequent data processing stages.
[0086] In some embodiments, wavelet thresholding can be used to replace adaptive median filtering for seed image data denoising. By performing wavelet decomposition on the image, the image signal is decomposed into low-frequency approximation components and high-frequency detail components. After applying a threshold to the noise in the high-frequency detail components, inverse wavelet transform is performed to remove the noise. Outlier removal can be achieved by using Z-score normalization instead of box plot analysis. By calculating the mean and standard deviation of the data samples, data that deviate from the mean by more than a preset multiple of the standard deviation are identified as outliers. Both alternatives can achieve the core objective of data preprocessing. The appropriate processing method can be selected based on the type of data noise and the data distribution characteristics.
[0087] S2. Error Modeling and Transfer Correction Model Training:
[0088] S2 is the step that implements data correction. It involves constructing a device-environment error database, fitting an error influence function, dividing the data into source and target domains, and training a domain-adaptive transfer correction model to achieve accurate correction of the target domain data. Figure 4 As shown, the specific steps include the following:
[0089] S2.1 Equipment-Environment Error Database Establishment:
[0090] Based on the baseline and target data collected and preprocessed in S1, a device-environment error database is constructed. This database stores the differences between the test data and the baseline data under different devices and environmental conditions, providing data support for subsequent error modeling and transfer correction. The specific construction process is as follows:
[0091] S2.1.1 Initial Database Construction:
[0092] The initial data for the database comes from collected baseline data and multiple sets of target data. Data storage dimensions must cover the following: equipment parameter dimensions (equipment model, core hardware parameters, equipment calibration status, usage time, etc.), environmental parameter dimensions (lighting conditions, temperature and humidity, atmospheric pressure, environmental cleanliness, etc.), and data difference dimensions (grayscale value differences in seed image data, band reflectance differences in spectral data, quantitative value differences in quality indicator correlation data, etc.). For each set of target data and baseline data, a sample-by-sample, feature-by-feature difference calculation is performed, recording the corresponding equipment and environmental parameters for each difference value to form the initial database records. The database adopts a structured storage method (such as a relational database), supporting data retrieval and filtering by key fields such as equipment type, environmental conditions, and data type, facilitating subsequent key factor extraction and error analysis.
[0093] S2.1.2 Incremental Database Update:
[0094] The equipment-environment error database employs an incremental update mechanism and includes a dedicated data quality verification module. This module verifies the completeness and validity of test data collected from newly added testing equipment or under new environmental conditions. During the verification process, the data quality verification module first checks the structural integrity of the new data, confirming whether it includes necessary fields such as equipment parameters, environmental parameters, test data, and corresponding baseline data differences. Secondly, it checks the validity of the data by comparing the new data with historical data from similar equipment and environmental conditions in the database to determine whether the differences are within a reasonable range and whether there are any obvious data anomalies (such as differences far exceeding the historical data fluctuation range).
[0095] After successful verification, the database automatically extracts the device parameters, environmental parameters, and data error information for the newly added scenario and adds them to the error database according to the preset data storage specifications, forming a new database record. At the same time, it triggers an incremental update of the error impact function. There is no need to retrain the entire error impact function. It only adjusts and optimizes the key factor influence coefficients and error constant terms in the function based on the new data, so that the error impact function can quickly adapt to new device or environmental scenarios, improving the adaptability of the database and the timeliness of error modeling.
[0096] In some embodiments, the triggering mechanism for incremental database updates can be a combination of timed updates and event-triggered updates: in addition to triggering immediate updates when new devices or environmental conditions are added, a fixed time period (such as once a month) can be set to re-verify and integrate the data stored in the database, remove invalid data records (such as abnormal difference records caused by device failure), optimize data distribution, and further improve the accuracy of error modeling.
[0097] S2.2 Error Influence Function Fitting:
[0098] By analyzing the differences between baseline and target data, fitting an error influence function, and quantifying the influence of equipment and environmental parameters on the test data, the specific operations include the following:
[0099] S2.2.1 Key Factor Extraction and Processing:
[0100] Key factors influencing the test data are extracted from the equipment-environment error database. The initial set of key factors includes equipment model parameters, lighting condition parameters, temperature and humidity parameters, etc., covering the core influencing factors of equipment and environment. For different types of key factors, corresponding quantization methods are adopted: for categorical key factors (such as equipment model, lighting type, etc.), one-hot encoding is used to convert them into binary quantization vectors to avoid modeling bias caused by the disorder of categorical variables; for continuous key factors (such as light intensity, temperature and humidity values, etc.), normalization processing (such as Min-Max normalization) is used to map them to the [0,1] interval to eliminate the influence of different dimensions on error modeling, while preserving the original distribution characteristics of the key factors.
[0101] After quantification, the correlation between each key factor and the error value of the test data is analyzed using the Pearson correlation coefficient. The Pearson correlation coefficient r (ranging from -1 to 1) is calculated for each key factor and the error value; the closer the absolute value is to 1, the stronger the correlation. A correlation screening threshold is set, retaining key factors with correlation coefficients greater than the threshold and removing redundant factors with weak correlations, forming the final set of key factors. By removing redundant factors, the interference of irrelevant variables on the function fitting is reduced, improving the efficiency and accuracy of function fitting.
[0102] S2.2.2 Error Influence Function Fitting and Optimization:
[0103] The relationship between key factors and test data error values was fitted using a multiple linear regression algorithm, and an error influence function was constructed, the expression of which is:
[0104] ;
[0105] Where ΔF is the error value of the test data, that is, the quantified difference between the target data and the benchmark data; X1 to X n These are the key factors after quantification; α1 to α n β represents the influence coefficients corresponding to each key factor. The absolute value of each key factor reflects the degree of influence of the corresponding key factor on the error value. The sign indicates the direction of influence (positive sign indicates that the error value increases when the key factor increases, and negative sign indicates that the error value decreases when the key factor increases); β is the error constant term, representing the basic error component that is not explained by the key factor.
[0106] During the fitting process, the influence coefficients α1 to α2 are solved using the least squares method. n The optimal estimate of the error constant term β minimizes the fitting error of the error influence function to the differences in historical data. After fitting, the effectiveness of the function is verified by residual analysis: the difference between the actual error value and the function's predicted error value for each data sample (i.e., the residual) is calculated, and residual distribution plots and residual-fit value scatter plots are plotted to analyze whether the residuals conform to a normal distribution, whether there is heteroscedasticity (i.e., the residual variance changes with the fitted value) or autocorrelation (i.e., there is a correlation between adjacent residuals). For data samples with excessive residuals, the extraction and quantification process of key factors is re-examined for deviations. If deviations exist, they are corrected and re-included in the fitting; if no deviations exist, new key factors (such as equipment usage time, environmental cleanliness, etc.) are considered for addition or the fitting algorithm is adjusted to iteratively optimize the error influence function until the goodness of fit of the error function (such as the coefficient of determination R²) meets the preset requirements, ensuring that the error influence function can accurately quantify the influence of equipment and environmental factors on the test data.
[0107] In some embodiments, the error influence function can be fitted using support vector regression instead of multiple linear regression. By constructing an optimal hyperplane, the nonlinear relationship between key factors and error values can be fitted. This is suitable for scenarios where there is a complex nonlinear relationship between key factors and error values (such as the nonlinear characteristics of the influence of light intensity on spectral data), thereby improving the adaptability and accuracy of error modeling.
[0108] S2.3 Source Domain Data and Target Domain Data Settings:
[0109] The benchmark data collected by standard equipment in a standard environment is set as the source domain data. The source domain data has the characteristics of high data quality, small error and stable feature distribution, and serves as the reference benchmark in the transfer learning process. The target data collected by different detection equipment and under different environmental conditions and preprocessed is set as the target domain data. The target domain data has certain systematic errors due to the influence of equipment differences and environmental changes, and needs to be corrected by the transfer correction model.
[0110] The separation of source and target domain data must maintain consistency in data type: both source and target domain data must include seed image data, spectral data, and corresponding quality index-related data, and the preprocessing standards (such as denoising algorithms, outlier removal rules, and format encapsulation specifications) must be completely consistent to ensure feature comparability between the two. Simultaneously, detailed records must be kept of the standard equipment parameters (such as equipment model, calibration time, and hardware configuration) and standard environmental parameters (such as light intensity, temperature, humidity, and atmospheric pressure) corresponding to the source domain data, serving as a reference benchmark for domain adaptation during subsequent transfer correction model training.
[0111] S2.4 Domain Adaptation Transfer Correction Model Training:
[0112] A training domain adaptation transfer correction model is used to achieve feature adaptation between source domain data and target domain data, and target domain data correction. The model adopts a deep neural network architecture, and the specific training process is as follows:
[0113] S2.4.1 High-dimensional feature extraction and normalization:
[0114] High-dimensional feature extraction is performed on both source and target domain data: The model's feature extraction layer adopts a structure combining convolutional neural networks (CNNs) and fully connected layers. For seed image data, visual features such as seed morphology, color distribution, and surface texture are gradually extracted through convolutional layers (responsible for extracting local features) and pooling layers (responsible for feature dimensionality reduction and spatial invariance) of the CNN. After multiple rounds of convolution and pooling operations, an image feature vector is obtained. For spectral data, the reflectance values of continuous bands are nonlinearly transformed and dimensionally compressed through fully connected layers to extract spectral feature vectors that can characterize the seed's biochemical components (such as chlorophyll and oil content). The image feature vector and the spectral feature vector are concatenated and fused to form high-dimensional fused feature vectors for both source and target domain data. This vector can comprehensively reflect the visual and biochemical characteristics of the seed.
[0115] The extracted high-dimensional feature vectors are subjected to L2 normalization. The normalization formula is as follows:
[0116] ;
[0117] Where v is a high-dimensional feature vector, from v1 to v k These are the components of a vector; for example, v1 might correspond to the seed morphology feature dimension, v2 to the seed color feature dimension, v3 to the seed spectral feature dimension, etc. This is the magnitude of the feature vector after L2 normalization (i.e., the "length" of the vector in high-dimensional space). Normalization maps the magnitudes of feature vectors to the same range, eliminating the impact of differences in the dimensions of different features on model training, and improving the comparability of feature vectors and the stability of model training.
[0118] S2.4.2 Quantification of differences in inter-domain feature distribution:
[0119] The maximum mean difference (MMD) algorithm is used to quantify the difference in high-dimensional feature distributions between the source domain data and the target domain data. The expression is as follows:
[0120] ;
[0121] Where MMD is the maximum mean difference, X is the source domain feature set, which contains high-dimensional normalized feature vectors of all source domain data; Y is the target domain feature set, which contains high-dimensional normalized feature vectors of all target domain data. To adapt to the kernel function mapping of high-dimensional features, a kernel function is used to map high-dimensional feature vectors to the reproducing kernel Hilbert space (RKHS). The choice of kernel function needs to be adapted to the distribution characteristics of the feature data (e.g., using a Gaussian kernel function to adapt to normal distribution characteristics) to ensure that the mapped data has good separability. The expectation operator is used to calculate the mean vector of the feature set in the reproducing kernel Hilbert space; The distance is the square of the L2 norm. This formula is used to calculate the distribution distance between the source domain and the target domain in the reproducing kernel Hilbert space. The larger the distance value, the greater the difference in the characteristic distribution of the two domains. The smaller the distance value, the closer the characteristic distribution of the two domains.
[0122] The calculation results of the MMD algorithm clarify the degree of difference in feature distribution between the source domain and the target domain, providing a quantitative basis for the domain adaptation training of the transfer correction model. One of the core objectives of model training is to minimize this difference and achieve alignment of feature distribution between the two domains.
[0123] S2.4.3 Construction and Training of Adversarial Training Network:
[0124] An adversarial training network is constructed, comprising a feature extractor, a domain discriminator, and a corrector. The feature extractor, as described above, combines a convolutional neural network with a fully connected layer and is responsible for outputting domain-invariant features (i.e., features that are unaffected by differences in equipment and environment and can characterize the essential attributes of seed quality, such as the inherent morphological features and core biochemical components of seeds). The domain discriminator adopts a fully connected neural network structure and distinguishes whether the input features come from the source domain or the target domain through a binary classification task (outputting "source domain" or "target domain"). Its training objective is to identify the domain source of the features as accurately as possible. The corrector adopts a linear regression unit structure and corrects the target domain data based on the domain-invariant features output by the feature extractor, outputting the corrected target domain data.
[0125] The model training process optimizes the model parameters using a joint loss function of "classification loss + domain adaptation loss": the classification loss is used to ensure the accuracy of the prediction of the quality index of the source domain data, and the cross-entropy loss function is used to calculate the difference between the quality index value predicted by the model and the actual quality index value of the source domain data features; the domain adaptation loss is constructed based on the MMD calculation results and is used to minimize the feature distribution difference between the source domain and the target domain, so that the features output by the feature extractor have domain invariance.
[0126] The training process employs an alternating training strategy: First, the parameters of the feature extractor are fixed, and the domain discriminator is trained. Backpropagation optimizes the parameters of the domain discriminator to ensure accurate differentiation between source and target domain features. Then, the parameters of the domain discriminator are fixed again, and the feature extractor and corrector are trained. A gradient reversal layer (reversing the gradient direction when backpropagating the classification loss of the domain discriminator to the feature extractor) guides the feature extractor to learn domain-invariant features. Simultaneously, the parameters of the corrector are optimized using the classification loss to improve the accuracy of quality metric predictions. This alternating training is iterated until the joint loss function converges to a preset threshold (i.e., the loss value no longer significantly decreases with increasing training iterations), completing the training of the domain adaptation transfer correction model.
[0127] In some embodiments, the convolutional neural network part of the feature extractor can use a residual network (ResNet) instead of a traditional convolutional neural network. The residual connection (skipping some convolutional layers to directly pass features) solves the gradient vanishing problem in deep network training and improves the effectiveness of high-dimensional feature extraction. The domain discriminator can use a convolutional neural network structure instead of a fully connected neural network, which is suitable for domain source identification of high-dimensional feature vectors and further improves the effect of domain adaptation training.
[0128] S2.5 Target Domain Data Correction Processing:
[0129] The trained domain adaptation transfer correction model is used to perform grayscale value correction and spectral band alignment on the target domain data. The preprocessed target domain data is input into the model's feature extractor to obtain a domain-invariant feature vector. The corrector adjusts the grayscale values and spectral bands of the target domain data based on this feature vector. For seed image data, grayscale value correction eliminates grayscale shifts caused by differences in imaging from different devices (such as lens focal length differences and sensor sensitivity differences), ensuring that the grayscale distribution of the corrected seed image data is consistent with that of the source domain seed image data. For spectral data, spectral band alignment corrects feature misalignments caused by band shifts from different spectrometers (such as wavelength calibration deviations), ensuring that the band positions of the corrected spectral data accurately match those of the source domain spectral data. During the correction process, the model automatically calls upon the domain adaptation rules and correction parameters learned during training, achieving automated correction of the target domain data without manual intervention.
[0130] S3. Classification threshold is dynamically updated:
[0131] Based on the feature distribution of the corrected target domain data and the baseline data, the classification threshold for *Gnaphalium affine* seed testing is dynamically updated, forming standardized corrected data and a unified classification standard, such as... Figure 5 As shown, the specific operation includes the following sub-steps:
[0132] S3.1 Feature Distribution Analysis:
[0133] Joint feature distribution analysis was performed on the corrected target domain data and the baseline data to extract core features related to the quality inspection of *Gynostemma pentaphyllum* seeds from both types of data. These features included morphological characteristics reflecting seed purity (such as seed outline regularity and impurity ratio), color characteristics reflecting seed maturity (such as seed surface color grayscale value and color distribution uniformity), and spectral characteristics reflecting seed vigor (such as specific band reflectance and inter-band difference). Based on these core features, feature distributions of the corrected target domain data and the baseline data were constructed separately. Statistical analysis methods (such as histogram plotting and probability density curve fitting) were used to analyze the overlap, peak position, and dispersion (such as standard deviation and variance) of the two distributions. This clarified the distribution relationship between the corrected target domain data and the baseline data in the feature space and confirmed whether the corrected target domain data had been effectively aligned with the feature distribution of the baseline data, providing a distribution basis for the dynamic updating of the classification threshold.
[0134] S3.2 Classification Threshold Calculation and Adjustment:
[0135] A probability density distribution model is constructed based on the statistical characteristics of the corrected data, and the kernel density estimation algorithm is used to estimate the characteristic distribution curves corresponding to different quality indicators. The kernel density estimation algorithm constructs a continuous probability density distribution curve by applying a kernel function (such as a Gaussian kernel function) to the feature values of each data sample. It can accurately reflect the distribution law of feature values and avoid the assumptions about distribution type that traditional parameter estimation methods (such as normal distribution estimation) impose, making it suitable for non-normally distributed feature data.
[0136] For each feature distribution curve, its inflection point interval is determined as the initial range of the classification threshold. The inflection point interval is the region where the slope of the feature distribution curve changes significantly, corresponding to the key dividing point of the feature value distribution, which can effectively distinguish seed samples of different quality levels (such as the inflection point interval of color feature distribution between mature and immature seeds). After determining the initial range, the initial range is adjusted by shrinking it based on the classification threshold distribution pattern of the benchmark data: using the classification threshold of the benchmark data as a reference, the deviation between the initial range and the benchmark threshold is calculated. According to the magnitude of the deviation, the initial range is shifted (to bring the center of the initial range closer to the benchmark threshold) and scaled (to reduce the width of the initial range to improve classification accuracy), so that the adjusted classification threshold both adapts to the feature distribution of the corrected target domain data and remains consistent with the classification standard of the benchmark data.
[0137] Through the above process, a classification threshold suitable for standardized data is obtained. This threshold accurately reflects the characteristic distribution pattern of the corrected data and is compatible with the classification threshold of the baseline data, forming a unified classification standard. The dynamic updating of the classification threshold ensures that corrected data from different sources can be classified into quality levels using consistent judgment criteria, providing core support for data standardization.
[0138] In some embodiments, the classification threshold can be determined by using a Bayesian optimal classifier instead of a kernel density estimation algorithm. By calculating the posterior probability of feature values at different quality levels (based on prior probability and likelihood function), the optimal classification threshold that minimizes the classification error rate can be determined, thereby further improving the accuracy and reliability of the classification threshold.
[0139] S4. Data Standardization Validation and Result Output:
[0140] S4 is the final step in the data correction method. It maps the corrected data to a unified feature space, verifies standardization consistency, and ultimately outputs standardized results and data traceability information applicable across laboratories. Figure 6 As shown, the specific operation includes the following sub-steps:
[0141] S4.1 Data Mapping to a Unified Feature Space:
[0142] Corrected data from different sources (including target domain data corrected under different devices and environmental conditions) are mapped to a unified feature space. The unified feature space is a standardized feature space built on the core features of the benchmark data. It has fixed feature dimensions, feature meanings and quantification standards (such as feature dimensions being the fusion dimensions of seed morphology, color and spectrum, feature meanings being the quality correlation attributes corresponding to each dimension, and quantification standards being a unified normalization range).
[0143] During the mapping process, the same method as the feature extraction in S2 (i.e., the same feature extraction algorithm and parameter settings) is used to extract the core features of the corrected data from each source. Then, the extracted core features are transformed into a unified feature space through the feature mapping matrix. The feature mapping matrix is constructed based on the feature distribution of the benchmark data to ensure that the transformed features can be compared in a unified dimension, eliminate the data incomparability problem caused by the difference in feature space, and make the corrected data from different sources in the same feature coordinate system.
[0144] S4.2 Standardized Conformity Verification:
[0145] Standardization consistency verification is performed on the calibration data from different sources mapped to a unified feature space. The specific verification process is as follows: First, the cosine similarity between calibration data from different sources is calculated. The cosine similarity is used to measure the cosine value of the angle between two feature vectors. The value range is [0,1]. The closer the value is to 1, the more similar the two feature vectors are, that is, the closer the distribution of the corresponding data samples in the feature space is. For each quality indicator (such as clarity and maturity), the cosine similarity between all data samples from different sources is calculated to obtain the mean cosine similarity, which reflects the degree of similarity between data from different sources under the quality indicator.
[0146] Meanwhile, the K-nearest neighbor algorithm is used to calculate the cluster purity of similar quality indicator data: all data samples in the unified feature space are clustered according to quality indicator categories (such as high purity, medium purity, and low purity), and the proportion of samples belonging to the same quality level in each cluster is calculated (i.e., cluster purity). The higher the cluster purity, the better the clustering of similar quality indicator data and the stronger the standardization consistency.
[0147] Set thresholds for the mean cosine similarity and cluster purity. When both indicators reach the preset thresholds, the data is deemed to meet the cross-laboratory reuse standard. If either indicator fails to reach the preset threshold, backtrack to step S2, re-optimize the transfer correction model parameters (e.g., adjust the weights of the joint loss function, increase the number of training iterations), and perform secondary correction on the target domain data until the data standardization consistency meets the requirements. Through consistency verification, ensure that the output standardized data has good cross-laboratory compatibility and can be reused in different detection scenarios.
[0148] S4.3 Standardization Results and Traceability Information Output:
[0149] Output standardized test results for *Gynostemma pentaphyllum* seeds that are applicable across laboratories. These results include uniform quantitative values for quality indicators such as seed purity, maturity, and vigor level. The quantitative values are determined based on corrected data and dynamically updated classification thresholds. For example, based on the comparison between seed characteristic values and classification thresholds, the purity is quantified into a specific percentage value, and the maturity and vigor level are quantified into corresponding grade codes or scores.
[0150] Simultaneously, the uncertainty assessment results of each quality indicator are calculated: the uncertainty is calculated based on the error propagation law and the data distribution dispersion during the correction process. The error propagation law reflects the cumulative impact of errors in each stage of data acquisition, preprocessing, and correction on the final result (such as the propagation of preprocessing denoising error and model correction error). The data distribution dispersion reflects the stability of the corrected data (such as the standard deviation of data of the same quality level). By combining these two factors, the uncertainty of each quality indicator (such as ±x%) is obtained, providing a quantitative reference for the reliability of the standardization results.
[0151] In addition to standardized results, complete data traceability information must also be output. This traceability information includes: equipment parameters, environmental parameters, and acquisition time during data acquisition; denoising algorithm type and parameters, outlier removal criteria, and format packaging specifications during data preprocessing; error impact function parameters (such as key factor influence coefficients), transfer correction model training parameters (such as joint loss function weights and training iterations), and classification threshold update records during data correction; and consistency verification index values (such as mean cosine similarity and cluster purity) and whether secondary correction was performed during data validation. Through this data traceability information, the generation process of each set of standardized results can be fully traced, providing a basis for cross-laboratory data comparison and problem identification.
[0152] In some embodiments, the consistency verification index can use the Jaccard similarity coefficient instead of the cosine similarity. By calculating the ratio of the intersection to the union of feature sets from different sources, the similarity of the data is measured. Both indices can effectively reflect the consistency of data standardization. The appropriate verification index can be selected according to the type of feature data (such as sparse features or dense features).
[0153] The method for correcting seed inspection data of *Gynura divaricata* based on transfer learning described in this embodiment has achieved significant technical results through the coordinated implementation of technical solutions in each stage. First, by constructing an equipment-environment error database and an error impact function, the impact of equipment differences and environmental changes on test data was accurately quantified, providing a scientific error modeling foundation for data correction and avoiding the inaccurate error quantification problem caused by relying on experience judgment in traditional correction methods. Second, the correction model built based on domain adaptation transfer learning, through feature extraction, inter-domain difference quantification, and adversarial training, achieved feature adaptation between source domain data and target domain data, effectively eliminating systematic errors in the target domain data, improving the accuracy of data correction, and enabling the corrected data to accurately reflect the true quality status of the seeds. Third, by mapping correction data from different sources to a unified feature space, dynamically updating classification thresholds, and verifying consistency, standardized processing of test data from different equipment and environments was achieved, ensuring effective data reuse across laboratory scenarios. This effect can be directly achieved through the complete process of data acquisition, correction, threshold update, and verification without additional adaptation operations. Finally, complete data traceability information and uncertainty assessment provide assurance for the reliability and traceability of the standardized results, enhancing the practicality and credibility of the method in actual testing work. The entire technical solution effectively solved the problem of inconsistent test data for *Gynostemma pentaphyllum* seeds under different equipment and environments, providing strong technical support for the standardization and normalization of seed quality inspection.
[0154] The above description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the concept described herein through the above teachings or related technologies or knowledge. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.
Claims
1. A method for correcting the data of the seed test of Patrinia villosa based on transfer learning, characterized in that, Comprise the following steps: S1. Collect standard equipment in standard environment under the chase seed test data, while collecting different detection equipment, different environmental conditions under the chase seed test target data, the test data include seed image data, spectrum data and corresponding seed quality index correlation data; S2. Based on the collected reference data and target data to establish equipment-environment error database, through the analysis of the differences between the reference data and the target data fitting error influence function, the reference data of the standard equipment is set as the source domain data, the target data under different conditions is set as the target domain data, the domain adaptation transfer correction model is trained, and the domain adaptation transfer correction model is used to correct the gray value of the target domain data and align the spectrum band; S3. Based on the feature distribution of the corrected target domain data and the reference data, the classification threshold of the chase seed test is dynamically updated by using statistical analysis algorithm, and the standardized correction data and unified classification standard are obtained; S4. Map the corrected data of different sources to the unified feature space, verify the consistency of the standardized data, and output the chase seed test standardized results and data traceability information of the laboratory; Wherein, the training domain adaptation transfer correction model in step S2 comprises the following substeps: S201. Feature extraction is performed on the source domain data and the target domain data respectively, high-dimensional feature vectors are obtained through the feature extraction layer of the deep neural network, and after L2 normalization processing is performed on the feature vectors, the maximum mean difference algorithm is used to quantify the feature distribution difference degree of the source domain and the target domain, and the expression is: ; Wherein, MMD is the maximum mean difference, X is the source domain feature set, Y is the target domain feature set, For the kernel function mapping of high-dimensional features, is the expected operator, and the distribution distance of the source domain and the target domain in the reproducing kernel Hilbert space is calculated by the formula; S202. Construct an adversarial training network comprising a feature extractor, a domain discriminator and a corrector, the feature extractor is responsible for outputting domain invariant features, the domain discriminator distinguishes whether the features come from the source domain or the target domain through a binary classification task, and the corrector corrects the target domain data based on the domain invariant features. The classification loss and the domain adaptation loss are used as the joint loss function to optimize the parameters of the model. The classification loss is used to ensure the quality index prediction accuracy of the source domain data, and the domain adaptation loss is based on the MMD calculation result to minimize the difference between the domains. The model training is completed by alternately training the feature extractor and the domain discriminator; Wherein, in step S3, when dynamically updating the classification threshold, a probability density distribution model is constructed based on the statistical characteristics of the corrected data, a kernel density estimation algorithm is used to estimate the feature distribution curve corresponding to different quality indicators, and the inflection point interval of the feature distribution curve is determined as the initial range of the classification threshold. Combined with the classification threshold distribution rule of the reference data, the initial range is contracted and adjusted to obtain the classification threshold of the standardized data.
2. The method of claim 1, wherein, The fitting error influence function in step S2 comprises the following substeps: S2.
1. Extract the key factors affecting the test data from the equipment-environment error database, the key factors include equipment model parameters, illumination condition parameters, temperature and humidity parameters, the discrete type key factors are quantified by one-hot encoding, the continuous type key factors are normalized to eliminate dimension difference, and the factors with correlation meeting the preset condition are selected by Pearson correlation coefficient, and the redundant factors are removed; S2.
2. Fit the error influence function by using multivariate linear regression algorithm, the expression is: ; Wherein, ΔF is the error value of the test data, X1 to X n are the quantized key factors, α1 to α n are the influence coefficients corresponding to the key factors, and β is an error constant term. After fitting, the effectiveness of the function is verified through residual analysis. The data samples with excessive residuals are re-screened for factors and fitted for functions, and the iteration is optimized until the fitting goodness of the error function meets the preset requirements.
3. The method of claim 1, wherein, The reference data and target data collected in step S1 are preprocessed, the seed image data are denoised by using an adaptive median filtering algorithm to remove environmental noise and device sensor noise, outliers in the spectral data and quality index associated data are removed by a box plot analysis method, and the preprocessed data are packaged according to a unified data format specification.
4. The method of claim 1, wherein, In step S2, the device-environment error database adopts an incremental updating mechanism, a data quality verification module is set, the test data collected under the new detection device or environmental condition are verified for integrity and effectiveness, the device parameters, environmental parameters and data error information under the scene are automatically extracted after the verification passes, and are supplemented into the error database, and the incremental updating of the error influence function is triggered.
5. The method of claim 1, wherein, In step S4, when verifying the standardization consistency of the data, the cosine similarity between different sources of correction data is calculated, and the K nearest neighbor algorithm is used to calculate the clustering purity of the same quality index data, when the average cosine similarity and the clustering purity both meet the preset requirements, it is determined that the data meet the cross-laboratory reuse standard, if the requirements are not met, the step S2 is returned to optimize the migration correction model parameters.
6. The method of claim 1, wherein, The domain adaptation migration correction model in step S2 adopts a deep neural network architecture, the feature extraction layer of the neural network adopts a structure combining a convolutional neural network and a fully connected layer, the domain adaptation layer realizes domain invariant feature learning through a gradient reversal layer, the data correction output layer adopts a linear regression unit, maps and converts the feature vectors processed by the domain adaptation, and outputs the corrected target domain data.
7. The method of claim 1, wherein, The standardization result output in step S4 includes the unified quantitative values of the purity, maturity and vigor grade quality indexes of the seeds of Descurainia sophia, and the uncertainty evaluation results of each index are calculated, the uncertainty is calculated based on the error propagation law and data distribution dispersion in the correction process.
8. The method of claim 1, wherein, The spectral data collected in step S1 include reflection spectrum information in the visible light to near-infrared waveband, the characteristic response of the biochemical components inside the seeds is obtained by continuous waveband sampling, and the seed image data include two-dimensional morphological contour, color space distribution and surface texture detail visual feature information of the seeds.
Citation Information
Patent Citations
Intelligent crop seed vigor detection method and system
CN119969003A
Soil organic matter determination method and system
CN120668606A