Grain hyperspectral image classification method based on incremental learning
By using a spectral-spatial feature-driven generation architecture and an adaptive distillation algorithm, the problems of dynamic data growth and insufficient model adaptability in grain material detection of traditional hyperspectral classification technology are solved. This enables rapid access to new categories, retention of historical knowledge, and high-precision classification, thus meeting the real-time sorting needs of modern agriculture.
Patent Information
- Application Number
- CN202511928986.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-03-03
AI Technical Summary
Traditional hyperspectral classification technology faces challenges in grain material quality testing due to the dynamic growth of data and insufficient model adaptability. This results in the need to collect a large number of samples when adding new grain categories, which is time-consuming and labor-intensive, has poor real-time performance, and limited classification accuracy.
A spectral-spatial feature mutual-driven generation architecture is adopted, combined with a two-way verification mechanism and multi-scale feature anchoring pooling. A multi-dimensional collaborative statistical memory module for seed hyperspectral adaptation is designed. Virtual samples are generated through historical feature anchoring and dynamic fidelity verification. A dual-constraint adaptive distillation algorithm with category similarity awareness is used to achieve rapid access to new categories and prevent forgetting of historical knowledge.
It achieves efficient learning of new categories under limited sample conditions, maintains high classification accuracy, meets the needs of accelerated variety iteration and diversified detection scenarios in modern agricultural production, and reduces data dependence and resource consumption.
Smart Images

Figure CN121600408A_ABST
Abstract
Description
Technical Field
[0001] This invention application relates to image classification. Background Technology
[0002] In modern agricultural quality testing, grain storage and sorting, and seed breeding, the quality classification of grain materials (such as wheat, corn, rice, and soybeans) (e.g., degree of mold, variety identification, and component content grading) is a core step. Hyperspectral imaging technology, because it can simultaneously acquire spatial morphological information and spectral characteristic information of grains, can achieve precise characterization of internal chemical components (such as moisture, protein, and toxins) and external defects (such as damage and insect infestation) of grains, and has become one of the mainstream technologies for grain classification.
[0003] With the accelerated iteration of grain varieties (dozens of new specialty varieties are added every year) and the expansion of detection scenarios (such as sorting mixed grains from multiple production areas and detecting grain quality variations under extreme conditions), traditional hyperspectral classification technology faces the dual challenges of "dynamic data growth" and "insufficient model adaptability": it needs to continuously incorporate hyperspectral data of new categories of grains, and the model is required to quickly learn the characteristics of new categories without forgetting historical category knowledge.
[0004] Known technologies and defects: Known technologies have developed two core solutions for classifying grain materials using hyperspectral images, but neither has addressed the core challenges of "dynamic data growth" and "insufficient model adaptability." Specific technical characteristics and shortcomings are as follows: I. Traditional machine learning methods (such as SVM, random forest) This approach relies on manually extracted spectral features (such as those extracted by PCA principal component analysis or SPA successive projection algorithm) to construct a fixed classification model. Its drawbacks are as follows: When adding a new grain category, a large number of samples need to be collected again and a completely new model needs to be trained, which completely wastes the value of existing model parameters and historical data.
[0005] The data dependence is extremely high, and collecting new category sample data requires a lot of cost, time and effort.
[0006] The real-time performance is extremely poor, and the entire process of model redevelopment is required to introduce new categories, which cannot meet the real-time sorting needs in scenarios such as harvest season.
[0007] The feature adaptability is insufficient, and the classification accuracy is limited because it is not optimized for the characteristics of "large intraclass differences" and "high interclass overlap" in the hyperspectral data of grains.
[0008] II. Conventional deep learning methods (such as CNN, ResNet, Transformer-based spectral classification models) This method automatically extracts deep features from hyperspectral images using an end-to-end learning model, achieving classification accuracy superior to traditional machine learning methods. However, it can only employ a "full data retraining" approach when faced with new categories. Its limitations are as follows: There is a contradiction between catastrophic forgetting and storage. When fine-tuning is done using only new category data, the classification accuracy of historical categories drops sharply. On the other hand, full retraining requires storing all historical data, which consumes a lot of resources.
[0009] The data dependency problem remains unresolved, and a large number of new category labeled samples are still needed to ensure model convergence. The labeling cost is not fundamentally different from that of traditional methods.
[0010] The lack of real-time capability and long training time make it unsuitable for the rapid integration of new agricultural production categories.
[0011] The feature adaptation deficiency is significant. Although it can automatically extract features, it lacks an adaptation mechanism designed for the specific characteristics of grain hyperspectral data. Similar to traditional incremental learning methods (such as EWC and SI), it only focuses on parameter regularization, leading to confusion between features of new and historical categories, making it difficult to improve classification accuracy. Summary of the Invention
[0012] This application proposes a spectral-spatial feature mutual-driven generation architecture, which uses core spectral features as seeds to drive the generation of accurate spatial features, and then uses spatial features as feedback to purify spectral features. Combined with a two-way verification mechanism and multi-scale feature anchoring pooling, it achieves a strong correlation characterization of "chemical composition-morphological features", solves the problems of feature disconnection and redundancy in traditional branch fusion, and adapts to the characteristics of "large intra-class differences and high inter-class overlap" of grain hyperspectral data.
[0013] The design incorporates a multi-dimensional collaborative statistical memory module for grain hyperspectral adaptation, storing historical category "spectral mean / variance / PCA principal components + spatial texture / contour statistics". It also adds a dynamic update mechanism that adapts to intra-class differences and inter-class similarity, replacing full data storage with statistical parameters, which differs from traditional general statistical compression schemes.
[0014] An innovative three-dimensional constrained diffusion generation algorithm, which combines "historical feature anchoring + grain characteristic guidance + dynamic fidelity verification," anchors the sample distribution to historical category statistical parameters, injects prior knowledge of grain component sensitive wavelengths and morphological defect distribution, and ensures the physical compliance and incremental adaptability of virtual samples through multi-dimensional dynamic verification. This reduces the number of real labeled samples for new categories to 20-50, solving the problem of traditional small sample generation that "only supplements quantity but not quality," and differing from the "feature analogy" approach of transfer learning.
[0015] We propose a category similarity-aware dual-constraint adaptive distillation algorithm. Based on spectral similarity, we dynamically adjust the distillation weights, which is different from the global static protection of the traditional "soft mask". At the same time, we construct a dual-objective distillation loss of "feature output constraint + classification boundary parameter constraint" to avoid classification confusion when the spectra of new and old categories overlap, and achieve a two-way balance between "efficient learning of new categories and no forgetting of old category knowledge".
[0016] This technology addresses the core challenges of "dynamic data growth" and "insufficient model adaptability" faced by traditional hyperspectral classification techniques in grain classification scenarios. It aims to achieve rapid access to new categories, retention of historical knowledge, efficient learning with few samples, and high-precision classification, thus meeting the practical needs of accelerated variety iteration and diversified detection scenarios in modern agricultural production. Attached Figure Description
[0017] Figure 1 This is the overall logical framework diagram; Figure 2 This is a diagram of the spectral-spatial feature mutual-driven generation architecture; Figure 3 shows the virtual sample generation process; Figure 4 Flowchart for calculating adaptive distillation weights; Figure 5 Schematic diagram of real-time feature calibration logic. Detailed Implementation
[0018] This experimental design revolves around the entire hyperspectral image classification process, comprising four core stages: data preparation, initial modeling, incremental training, and classification validation. The overall logical framework is shown in the attached figure. Figure 1 As shown.
[0019] 1. Construction of experimental dataset Ten existing rice grain categories were selected as the old categories (C1~C1). 10 In addition, eight newly introduced rice grains that were not included were selected as new categories (C). 11 ~C 18Multiple rounds of incremental training were set up to simulate extreme conditions for various classes. 1500 samples were collected for each class, covering different origins, storage durations, and forms to ensure intra-class diversity. For the old class, 1000 samples were extracted from each class's 1500 samples to construct a "historical total sample pool," which was then divided into a historical training set and a historical test set in a 7:3 ratio for initial model training and historical knowledge verification. For the new class, all 1500 samples from each class were used as the new class dataset. A portion of these samples was randomly selected as the new class training set (containing real samples and virtual samples generated by the diffusion model), and the remaining samples were used as the new class test set. Finally, the accuracy of the historical class, the new class, and the overall classification accuracy were verified, achieving the experimental goal of "no forgetting of old class knowledge and excellent learning performance of the new class." Simultaneously, the data was standardized by converting the original hyperspectral data (.bip format) to Tensor format, with the spectral dimensions normalized to [0,1]. The formula is: This is the spectral dimension normalization formula for hyperspectral data, used to eliminate differences in spectral intensity of individual grains at different wavelengths and to focus on the relative changes in spectral shape. wavelength The original spectral values at that location, , These are the minimum and maximum values of the original spectrum of a single seed at all wavelengths (e.g., the extreme values of reflectance of the seed in the 400nm-1000nm range).
[0020] 2. Experimental Procedure Step 1: Initial Model Training (1) Data preprocessing Hyperspectral imager sensors may produce abnormal pixels due to hardware failures, which can lead to distorted spectral curves if not repaired. The first step is to repair bad pixels in the hyperspectral image. This involves iterating through each pixel in the hyperspectral image; if a pixel value deviates from the mean of its four neighboring pixels by more than three times the standard deviation... If a pixel is identified as a bad pixel, it is repaired using four-neighbor linear interpolation. This involves taking the average of the four neighboring pixels (top, bottom, left, and right) of the bad pixel as the repaired pixel value. The formula is: in, For the original image in coordinates ,wavelength Pixel value at that location, To ensure that the pixel values are repaired and that individual pixel anomalies do not affect the overall spectral curve.
[0021] Then, Savitzky-Golay filtering was used to smooth the spectrum. The window size was 5, the polynomial order was 2, and the filter coefficients were obtained by least squares fitting. The formula is: in, The smoothed spectral curve, The original spectrum, The SG filter coefficients (obtained by least squares fitting) ).
[0022] Finally, feature splitting was performed, dividing the preprocessed data into two core feature classes, and extracting a 1×600-dimensional spectral vector for each seed as the spectral feature: in =400nm, =1000nm.
[0023] PCA dimensionality reduction is performed on the smoothed hyperspectral data to extract spatial features, and the covariance matrix is calculated: Solve for eigenvalues and eigenvectors, select the first 3 principal components, and generate a 200×200×3 RGB pseudo-color image: in, =1,2,3 are the principal component channels. For the first The coefficients of the principal components at the k-th wavelength.
[0024] (2) Spectral-spatial feature mutual generation training An innovative architecture of "seed-driven - feature generation - bidirectional verification - anchored fusion" is designed to replace the traditional dual-branch parallel extraction mode. Through the mutual optimization of spectral and spatial features, a strong correlation representation of "chemical composition - morphological features" is achieved, effectively solving the problems of feature disconnection and redundancy in traditional fusion. The model structure is as follows: Figure 2 : The spectral seed extractor extracts core spectral features based on 1D-CNN. As a "seed template" for spatial feature generation, it focuses on key information about the internal chemical composition of the grain: the input is a preprocessed 1×600-dimensional spectral vector. , Network structure: 3 convolutional layers + batch normalization (BN) + ReLU activation + 2 max pooling layers (stride 2) + global average pooling + fully connected layers. Convolutional layer 1: 1 input channel → 64 output channels, kernel size 3×1, stride 1, padding=1. Convolutional layer 2: 64 input channels → 128 output channels, kernel size 3×1, stride 1, padding=1. Convolutional layer 3: 128 input channels → 256 output channels, kernel size 3×1, stride 1, padding=1. Pooling layer: max pooling, kernel size 2×1, stride 2. Output is 128-dimensional spectral core features. The formula is: in, For convolution operations, For batch normalization, For activation function, For global average pooling, This is a fully connected mapping.
[0025] The spatial feature generator is based on an improved U-Net architecture, using RGB pseudo-color images after PCA dimensionality reduction. To input the data, a "spectral constraint layer" is added to the decoder to force the generated spatial features to align with the core spectral information: The encoder's first-layer convolutional kernel was adjusted from 7×7 to 3×3 to preserve minute morphological details such as grain surface damage and insect infestation. The spectral constraint layer: Constrains feature consistency by calculating the mapping error between generated spatial features and spectral core features; the loss function is: in, This is the spectral-spatial mapping matrix. For matrix multiplication, To generate accurate spatial features, This represents the mean square error.
[0026] A wavelength attention gating mechanism is employed, using the generated spatial features as feedback to filter wavelength ranges strongly correlated with morphology and eliminate redundant spectral information: The first step calculates each wavelength. and Mutual information, quantifying correlation: in, For information entropy, This represents the probability distribution of eigenvalues. The second step involves selecting the top 30% of wavelengths with the highest mutual information to form the purified spectral features. : in, Finally, set dual thresholds for verification. and If the correlation is not satisfied, iterative optimization is performed, and the cosine similarity between the two is calculated simultaneously. Ensure it is greater than the threshold, then verify. Wavelength matching degree with the original spectral characteristics: in, This is the set of key wavelengths in the original spectrum that are strongly correlated with the grain components. If the dual threshold conditions are not met, feedback is sent to the spectral seed extractor to adjust the convolutional layer parameters and re-extract until the dual verification is passed.
[0027] (3) Initialization of feature memory module Traditional incremental learning's "data-level storage" requires saving the entire historical sample set, resulting in high storage overhead and redundancy of historical features. Existing "statistical compression storage" solutions only use general statistical measures and are not optimized for the characteristics of seed hyperspectral data, such as large intra-class differences and high inter-class overlap, leading to insufficient feature representation accuracy and inability to support subsequent incremental learning with few samples and anti-forgetting training. This invention designs a multi-dimensional collaborative statistical memory module adapted to seed hyperspectral data. Through "targeted statistical parameter selection + dynamic adaptation mechanism + cross-module collaborative design," it achieves a two-way balance between "storage compression" and "feature fidelity," specifically implemented as follows: To address the core requirement of hyperspectral analysis of grains that "spectral data reflects internal components and spatial data reveals morphological defects," multi-dimensional collaborative statistical parameters were selected to both compress storage and retain discriminative information. First, based on the purified spectral features output by the "spectral-spatial mutual-driven generation architecture," three types of core statistical parameters were calculated: spectral core mean, spectral intraclass variance, and spectral PCA principal components.
[0028] The mean value of the spectral core reflects the basic chemical composition characteristics of this type of seed, and the formula is: Where c=1,2,...,10 is the category index. The number of historical training samples for each class. For the first c Class 1 i The spectral embedding features of each sample. The spectral within-class variance, adapted to the characteristic of large intra-class variability in seeds, characterizes the spectral fluctuation range of this class of samples. The formula is: Spectroscopic PCA principal component pairs cThe purified spectral features of the class were subjected to PCA dimensionality reduction, and the top 10 principal components were selected to preserve key differences in spectral shape and avoid the loss of detailed information by traditional statistical methods. The formula is as follows: in, For the calculation of the covariance matrix, The projection operation is used to select the first 10 principal components.
[0029] Based on the precise spatial features output by the "spectral-spatial mutual-driven generation architecture", morphology-related statistical parameters are extracted to replace general texture features: The grain contour curve was obtained using Canny edge detection, and Fourier descriptors were used to reduce the dimensionality of the contour curve: contour coordinates... Calculate the Fourier transform: A 50-dimensional contour vector is obtained, and the average value within the class is taken as the representative contour feature of the class.
[0030] Meanwhile, to address the issues of large intra-class differences and uneven inter-class similarity, a dynamic adaptation mechanism is proposed, and a dynamic parameter update strategy is designed to avoid feature distortion caused by "one-size-fits-all" statistics. Calculate the first c Spectral variance If the value exceeds the set threshold, then sub-statistical parameters will be generated based on storage conditions. This preserves key differences within the class and improves the adaptability of subsequent calibration mechanisms; When the spectral cosine similarity between the newly added category and the historical category c When the value exceeds a certain threshold, the "differentiation statistic" of historical category c—the mean of spectral peak positions—is automatically supplemented. With half-width variance This strengthens the differentiation between categories and avoids confusion of characteristics among closely related varieties.
[0031] Step 2: Incremental Training for New Categories The goal of this step is to achieve efficient learning of new category features without storing all historical data and using only a small number of new category samples, while avoiding forgetting historical category knowledge.
[0032] (1) Generation of diffusion model The experiment employed a diffusion generation algorithm combining "historical feature anchoring + grain characteristic guidance + dynamic fidelity verification," reducing the number of real labeled samples required for each new category from 500-1000 to 20-50. The generated virtual samples not only supplemented the quantity but also accurately aligned with the feature distribution of the new category, while also meeting the anti-forgetting requirements of subsequent adaptive distillation. The generation process is as follows: Figure 3 .
[0033] Step 1: Extract the core statistical parameters of all historical categories from the feature memory module to construct a "historical feature anchoring pool": in, For the history category c The spectral mean, For spectral variance, It is the principal component of spectral PCA. For spatial texture statistical features, These are the statistical features of spatial contours.
[0034] Step 2: Calculate the mean of the purified spectral characteristics of the new category samples. With all historical categories The cosine similarity is used to select the top-3 historical categories with the highest similarity as "anchor categories", rather than a single similar category. Step 3: The statistical parameters are embedded into the forward noise addition process of the diffusion model as generation constraints: in, The noise coefficient is the diffusion step size t. To anchor the constraint weights, The feature projection operation for anchoring parameters forces the feature distribution of virtual samples to closely approximate the reasonable range between historical and new categories, thus avoiding feature drift.
[0035] In the U-Net denoising network of the diffusion model, a new "seed-specific prior layer" is added to inject prior knowledge from two major domains, guiding the generated samples to conform to the physical characteristics of the seeds: Spectral prior injection: The sensitive wavelength range of the core components of the seed is preset, and "wavelength attention gating" is added to the encoder of the denoising network to enhance the feature generation accuracy of the sensitive wavelength range. in, Wavelength attention weights are used to enhance the generation of features for sensitive wavelengths, ensuring that the spectral features of virtual samples conform to the physical laws of grain chemical composition.
[0036] Spatial Prior Injection: Based on the spatial distribution patterns of grain morphological defects, a "morphological constraint layer" is added to the decoder of the denoising network to guide the generation of spatial features through morphological masks. in, For example Distance to the edge of the grain, The distance threshold was set to 20 pixels through experimentation. The morphological constraint mask forces the generation of features in the edge region to conform to the distribution pattern of damage, thus avoiding the generation of virtual samples that do not conform to the morphological logic of the grains.
[0037] A "multi-dimensional dynamic verification" mechanism is designed to replace the fixed similarity constraint, ensuring that virtual samples are adapted to the incremental learning process. Calculate virtual sample fusion features Features fused with real samples of the new category Cosine similarity, with a dynamically adjusted threshold (the smaller the sample size of the new category, the higher the threshold): The generated virtual samples are input into a pre-trained adaptive distillation model to calculate their confusion with historical category features. (The lower the confusion level, the better it is suited for anti-forgetting training): Set confusion threshold ,like > If the virtual sample is fed back into the diffusion model for regeneration, it avoids confusion between the virtual sample and historical category features, thus reducing the pressure of subsequent distillation.
[0038] Virtual samples with dual dynamic verification are merged with real samples to form a new category training set, ensuring that the model can learn new category features under conditions of few samples, and can also meet the anti-forgetting requirements of subsequent adaptive distillation.
[0039] (2) Adaptive weight distillation training Traditional incremental learning is prone to "catastrophic forgetting." This experiment addresses this issue through a category similarity-aware dynamic distillation mechanism. This differs from traditional "soft masking" strategies and strengthens boundary parameter protection, preventing classification confusion when there is high overlap between new and old categories. The adaptive distillation training process is as follows: Figure 4 .
[0040] First, a training dataset is constructed by merging real samples of the new category with generated virtual samples to form a new category training set, ensuring the model has sufficient data to learn the features of the new category. Since the similarity between the new category and historical categories differs, the protection strength for historical categories needs to be designed differently. The core difference from the "soft mask" strategy is that traditional "soft masks" generate a global static mask using fixed rules (such as parameter importance), applying a uniform protection strength to all historical categories; this scheme dynamically adjusts the distillation weights based on the similarity of spectral feature distributions and simultaneously associates them with classification boundary constraints, achieving "category-level differentiated protection + boundary-level precise constraints," rather than simply balancing the weights of the loss function. Distillation weight calculation: based on the spectral cosine similarity between the new category and "similar historical categories." Weights are dynamically generated; the higher the similarity, the larger the distillation weight, strengthening the dual protection of historical knowledge and classification boundaries; the lower the similarity, the lower the weight, preserving the model's flexibility in learning new category features. The formula is as follows: in, For distillation weighting, a minimum weight of 0.3 is preset. The average spectral cosine similarity between the new category and the Top-3 similar historical categories ensures that the protection strength of closely related varieties is significantly higher than that of non-closely related varieties.
[0041] To address the classification confusion issue when there is high spectral overlap between new and old categories, a bi-objective distillation loss is designed, consisting of "feature output constraints + boundary parameter constraints," rather than constraining only the feature output. in, To balance the boundary constraint weights and the boundary protection strength, Classification loss for new categories, The characteristic output is the distillation loss. Distillation loss at the classification boundary.
[0042] The new category classification loss uses cross-entropy loss to optimize the model's ability to classify samples of the new category. The loss function for the newly added classification output node is as follows: in For the new category label, , , Add a new category layer.
[0043] Feature output distillation loss The constraint on the consistency between the feature output of the incremental model and the historical features in the feature memory module is expressed by the following formula: in =1000 represents the number of historical memory samples. This is the fusion feature output of the incremental model for historical samples. Reconstruct values for historical features to ensure that historical features are not forgotten.
[0044] Classification boundary distillation loss A protection mechanism is designed for the classification boundary parameters to constrain the historical category boundaries from shifting during the training of new categories. The formula is as follows: Where D=128 is the feature dimension, and K=10 is the number of historical categories. , The historical class boundary parameters for the initial model training. , For the historical category boundary parameters after incremental training, by constraining the change of boundary parameters, boundary confusion is avoided when the spectra of new and old categories overlap.
[0045] Step 3: Classification Reasoning and Accuracy Verification This step verifies the model's classification accuracy for historical and new categories through real-time feature calibration and classification inference. The classification inference and accuracy verification process is as follows: Figure 5 .
[0046] (1) Real-time feature calibration The spectral characteristics of seeds of the same variety may shift due to differences in origin and storage conditions. Direct classification would lead to a decrease in accuracy, so real-time calibration to align the feature distribution is necessary: extract the spectral embedding features of the input sample to be classified. Calculate the deviation between the mean of this feature and the mean of the target category features. The larger the deviation, the more severe the spectral shift. in M is the mean number of spectral features of adjacent pixels. Spectral mean of the target category Cross-validation was used to set a bias threshold τ=0.1. If the sample bias exceeded the threshold, then the spectral characteristics were... Perform standardized processing: in , The spectral standard deviation of the target category is used as a benchmark. The spectral characteristics of the samples to be classified are adjusted to make the calibrated sample characteristics consistent with the distribution of the target category characteristics, thereby eliminating the influence of spectral shift caused by place of origin and storage conditions and improving intra-class robustness.
[0047] (2) Classification Reasoning and Precision Calculation Classification reasoning process: The calibrated spectral features... Spatial features Input the incremental model, fuse the features from both branches, input the classification layer, and output the classification probabilities for each category through the Softmax function: in, The category with the highest probability is selected as the final classification result.
[0048] Experimental data analysis evaluates model performance from three dimensions: historical categories, new categories, and overall performance, ensuring comprehensive metric coverage. Historical category accuracy is calculated as the percentage of correctly classified samples in the historical test set, reflecting whether the model has forgotten historical knowledge. in, The number of correctly categorized historical data. The number of correctly classified non-historical categories. , These represent the number of misclassified and missed classifications for the historical categories, respectively. New category accuracy is calculated as the percentage of correctly classified samples in the new category test set, reflecting the model's learning performance on the new category. in, and These represent the number of correctly classified samples and the number of missed classifications for the new category, respectively. Overall accuracy is calculated as the percentage of correctly classified samples after merging the historical test set and the new category test set, reflecting the model's comprehensive classification ability. in This represents the number of samples in the historical test set. This represents the number of samples in the new category test set.
[0049] This embodiment has the following effects: Breaking through the data dependency bottleneck: By generating virtual samples through a diffusion model, the number of new category labeled samples is reduced, solving the core problem of "high data collection cost and long cycle" in traditional methods.
[0050] Solving the problem of catastrophic forgetting: An innovative adaptive weight distillation algorithm dynamically adjusts the strength of historical knowledge protection based on spectral similarity. Compared with traditional regularization methods such as EWC and SI, the loss of historical category accuracy is reduced, achieving a two-way balance between "learning new categories and remembering old categories".
[0051] Adapting to the characteristics of grain data: The spectral-spatial dual-branch model is specifically optimized to address the problem of "large intra-class differences and high inter-class overlap" in grain hyperspectral data. Combined with the attention mechanism to dynamically allocate feature weights, the classification accuracy is improved compared to a single CNN model and surpasses traditional methods such as SVM and ResNet.
[0052] Reduced resource consumption: The feature-level memory module replaces full data storage with statistical parameter storage, reducing storage costs; at the same time, it simplifies the model structure and training process, shortens incremental training time, and adapts to the real-time sorting needs of agricultural production.
Claims
1. A seed hyperspectral image classification method based on incremental learning, characterized in that, The steps are as follows: S1: Experimental dataset construction: Select several old categories of rice grains and several new categories of rice grains, collect a fixed number of samples for each category, divide the dataset into historical training set, historical test set, new category training set and new category test set, convert the original hyperspectral data into Tensor format and normalize it to [0,1]; S2: Initial model training: Repairing bad pixels in hyperspectral images, smoothing the spectrum using Savitzky-Golay filtering, and extracting 1×600 dimensional spectral vectors and PCA-reduced RGB pseudo-color images as spatial features; The core spectral features are extracted using 1D-CNN, spatial features are generated based on the improved U-Net and the spectral features are purified by feedback, and after double verification, the feature memory module storing multi-dimensional statistical parameters is initialized. S3: Incremental Training for New Categories: Extract historical category statistical parameters from the feature memory module to construct an anchor pool, select the top-3 similar historical categories, embed the diffusion model noise addition process, inject spectral and spatial prior knowledge to generate virtual samples and perform double dynamic verification, merge real and virtual samples to form a new category training set; calculate distillation weights based on spectral similarity, and train the model through bi-objective distillation loss; S4: Classification Reasoning and Accuracy Verification: Extract the spectral embedding features of the sample to be classified, calculate the deviation from the mean of the target category, and standardize and calibrate if the deviation exceeds the threshold; input the calibrated spectral and spatial features into the model, fuse them, and output the classification probability through Softmax; select the category with the highest probability as the result, and calculate the historical category, the new category, and the overall classification accuracy respectively.
2. The seed hyperspectral image classification method based on incremental learning according to claim 1, characterized in that, The formula for normalizing the spectral dimension to [0,1] is: 。 3. The seed hyperspectral image classification method based on incremental learning according to claim 2, characterized in that, The method for repairing bad pixels in hyperspectral images is as follows: Iterate through each pixel of the hyperspectral image; if the pixel value deviates from the mean of its four neighbors by more than three times the standard deviation... If a pixel is identified as a bad pixel, it is repaired using four-neighbor linear interpolation. This involves taking the average of the four neighboring pixels (top, bottom, left, and right) of the bad pixel as the repaired pixel value. The formula is: 。 4. The seed hyperspectral image classification method based on incremental learning according to claim 3, characterized in that, The feature splitting method is as follows: The preprocessed data is split into two core features, and a 1×600-dimensional spectral vector of each seed is extracted as the spectral feature: in =400nm, =1000nm.
5. The seed hyperspectral image classification method based on incremental learning according to claim 1, characterized in that, Incremental training for new categories includes: extracting core statistical parameters of all historical categories from the feature memory module to construct a "historical feature anchoring pool": in, For the history category c The spectral mean, For spectral variance, It is the principal component of spectral PCA. For spatial texture statistical features, These are the statistical features of spatial contours.
6. The seed hyperspectral image classification method based on incremental learning according to claim 5, characterized in that, Incremental training for new categories also includes calculating the mean of the purified spectral features of the new category samples. With all historical categories The cosine similarity is used to select the top-3 historical categories with the highest similarity as "anchor categories", rather than a single similar category. 。 7. The seed hyperspectral image classification method based on incremental learning according to claim 6, characterized in that, New categories of incremental training include... The statistical parameters are embedded into the forward noise addition process of the diffusion model as generation constraints: in, The noise coefficient is the diffusion step size t. To anchor the constraint weights, Feature projection operation for anchoring parameters.
Citation Information
Cited By
Marine litter fine granularity identification method and system based on unmanned aerial vehicle image
CN121963002A