Hyperspectral small sample intelligent data analysis method based on SSC-GAN

By designing a semi-supervised single-stage controllable generative adversarial network (SSC-GAN) and optimizing the network training strategy based on the characteristics of hyperspectral data, the problems of training instability and sample distribution bias in the analysis of small sample hyperspectral data are solved. This achieves efficient and accurate virtual sample generation and analysis, improves the accuracy and robustness of the analysis, and is applicable to multiple application fields.

CN122244677APending Publication Date: 2026-06-19CHENGDU RUIXING CHANGYI TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHENGDU RUIXING CHANGYI TECHNOLOGY CO LTD
Filing Date
2026-03-27
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing methods for analyzing small hyperspectral data suffer from problems such as unstable training, mode collapse, large deviations between generated and real sample distributions, and difficulty in uncovering deep nonlinear features. Furthermore, they fail to fully utilize unlabeled small sample data, resulting in insufficient analytical accuracy and robustness.

Method used

We designed a semi-supervised single-stage controllable generative adversarial network (SSC-GAN), optimized the network training strategy by combining the characteristics of hyperspectral data, and generated virtual samples consistent with the distribution of real samples through the synchronous optimization of the generator, discriminator and analyzer. We then used labeled and unlabeled samples for semi-supervised training to achieve efficient analysis.

Benefits of technology

It improves the accuracy and robustness of data analysis in hyperspectral small sample scenarios. The generated virtual samples have the same spectral distribution as real samples and are suitable for a variety of hyperspectral data analysis tasks, including agricultural product quality testing, Chinese medicinal material analysis, and land cover classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122244677A_ABST
    Figure CN122244677A_ABST
Patent Text Reader

Abstract

This invention belongs to the field of hyperspectral data processing technology and discloses a hyperspectral small-sample intelligent data analysis method based on SSC-GAN. The method includes the following steps: collecting hyperspectral small-sample data, including labeled and unlabeled samples; preprocessing the raw data to eliminate noise and redundant information, resulting in a standardized hyperspectral sample dataset; the SSC-GAN network comprising three modules: generator G, discriminator D, and analyzer A; employing a semi-supervised training mode, training the generator, discriminator, and analyzer in stages, and simultaneously optimizing the three through a multi-objective loss function; and using the trained SSC-GAN network to perform intelligent data analysis on the preprocessed hyperspectral test samples. This invention, using the above-mentioned SSC-GAN-based hyperspectral small-sample intelligent data analysis method, improves the accuracy and generalization ability of small-sample data analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of hyperspectral data processing technology, and in particular to a hyperspectral small-sample intelligent data analysis method based on SSC-GAN. Background Technology

[0002] Hyperspectral data contains rich spectral dimensional information, accurately reflecting the core characteristics of target substances such as physical properties and chemical composition, and has irreplaceable application value in many fields. However, the acquisition of hyperspectral data often faces many limitations. High-precision hyperspectral acquisition equipment is expensive, sample preprocessing procedures are complex, and sample acquisition in some special scenarios (such as rare Chinese medicinal materials and objects in extreme environments) is extremely difficult, leading to the dilemma of high dimensionality and small sample size in practical applications.

[0003] Existing methods for analyzing small sample hyperspectral data can be mainly divided into two categories: one is based on traditional machine learning methods, which reduce the dimensionality redundancy of hyperspectral data through feature dimensionality reduction (such as PCA and LDA) and then combine it with classifiers such as SVM and random forest for analysis. However, this type of method has poor adaptability to small sample data, is prone to overfitting, and is difficult to explore deep nonlinear features in hyperspectral data, resulting in limited analytical accuracy. The other category is based on generative adversarial networks (GANs), which fill the sample quantity gap by generating virtual samples to alleviate the small sample problem. However, traditional GANs have inherent defects such as unstable training, pattern collapse, and large deviations between the generated samples and the distribution of real samples. Moreover, most GAN models rely on a large number of labeled samples for supervised training, which cannot make full use of unlabeled small sample data, further limiting their application effect in hyperspectral small sample scenarios.

[0004] Furthermore, existing GAN-based hyperspectral analysis methods are not specifically designed to address the characteristics of hyperspectral data, such as spectral continuity and band correlation. The generated virtual spectral samples often suffer from spectral distortion and feature blurring, making it difficult to meet the requirements of high-precision analysis. At the same time, existing methods do not achieve synchronous optimization of the generation network and the analysis network, so the validity of the generated samples cannot be fully verified, making it difficult to improve the accuracy and robustness of data analysis.

[0005] Therefore, developing a method that can adapt to hyperspectral small sample scenarios, solve training instability and mode collapse problems, and achieve accurate data analysis has become a pressing technical challenge in this field. Summary of the Invention

[0006] The purpose of this invention is to provide a hyperspectral small-sample intelligent data analysis method based on SSC-GAN. By designing a semi-supervised single-stage controllable generative adversarial network structure (SSC-GAN) and optimizing the network training strategy in combination with the characteristics of hyperspectral data, the method can achieve accurate generation of virtual samples and efficient analysis of hyperspectral data, thereby improving the accuracy, robustness and generalization ability of data analysis in small-sample scenarios.

[0007] To achieve the above objectives, this invention provides a hyperspectral small-sample intelligent data analysis method based on SSC-GAN, comprising the following steps: Step S1: Hyperspectral small sample data preprocessing: Collect hyperspectral small sample data, including labeled and unlabeled samples, preprocess the raw data to eliminate noise and redundant information, and obtain a standardized hyperspectral sample dataset. Step S2: Construct the SSC-GAN network structure: The SSC-GAN network consists of three main modules: generator G, discriminator D, and analyzer A; Step S3, SSC-GAN network training: A semi-supervised training mode is adopted, and the generator, discriminator and analyzer are trained in stages. The synchronous optimization of the three is achieved through a multi-objective loss function. Step S4: Intelligent data analysis of small hyperspectral samples: Using the trained SSC-GAN network, intelligent data analysis is performed on the preprocessed hyperspectral test samples.

[0008] Preferably, in step S1, the hyperspectral small sample data preprocessing is performed, and the specific process is as follows: Step S11, Data Acquisition: Acquire hyperspectral data of the target scene using a hyperspectral imaging device to obtain the original spectral matrix. As shown below: ; in, The total number of samples, labeled with the sample number. The number of samples was not labeled. , ; This represents the number of hyperspectral bands. Step S12, Noise Removal: A wavelet thresholding denoising algorithm is used to eliminate spectral noise. The wavelet basis is db4, the decomposition level is 3, and the threshold... The calculation method is as follows: ; in, The standard deviation of noise; Step S13, Spectral Normalization: The min-max normalization method is used to map the preprocessed spectral data to the [0,1] interval. The normalization formula is: ; in, For the first The first sample Normalized values ​​for each band; This is the denoised spectral matrix; This represents the minimum value of all samples in the b-th band. This represents the maximum value of all samples in the b-th band. Step S14: Dataset partitioning: The normalized spectral data is divided into a training set and a test set in a 4:1d ratio. The training set contains all labeled samples and some unlabeled samples, while the test set contains only labeled samples. This is used to verify the accuracy of the data analysis.

[0009] Preferably, in step S2, the generator G adopts a structure combining single-stage fully connected and convolutional methods to receive random noise vectors and category conditional information, and generates virtual spectral samples that are consistent with the distribution of real hyperspectral samples, as shown below: (1) Input layer: receives a random noise vector and a class condition vector; where the random noise vector is represented as It follows a normal distribution. The category condition vector is represented as , The number of categories is represented using one-hot encoding; the two are concatenated to obtain the input vector. As shown below: ; (2) Hidden layers: consisting of 3 fully connected layers and 2 1D convolutional layers: The first fully connected layer has an input dimension of 100+K, an output dimension of 256, an activation function of LeakyReLU, and a slope of 0.2. Second fully connected layer: input dimension is 256, output dimension is 512, activation function is LeakyReLU, slope is 0.2; Third fully connected layer: Input dimension is 512, output dimension is... , The number of hyperspectral bands is given, the activation function is LeakyReLU, and the slope is 0.2. The first 1D convolutional layer: kernel size 3, stride 1, padding type same, input dimension [missing information]. The output dimension is The activation function is LeakyReLU with a slope of 0.2; The second 1D convolutional layer has a kernel size of 3, a stride of 1, and the same padding pattern. The input dimension is... The output dimension is The activation function is tanh, which maps the output to the [0,1] interval to obtain the generated spectral sample. ; (3) The generator introduces a style jump connection mechanism to convert the input category condition vector By injecting skip connection paths between each hidden layer and the output layer, and adjusting the style features of each layer through a residual learning mapping function, the semantic accuracy of the generated samples is ensured, while preserving spectral continuity and avoiding spectral distortion.

[0010] Preferably, in step S2, the discriminator D adopts a semi-supervised structure to distinguish whether the input sample is a real sample or a generated sample, and at the same time extracts the deep spectral features of the sample to provide feature support for the analyzer, with the following structure: (1) Input layer: receives real spectral samples Or generate spectral samples The input dimension is ; (2) Hidden layers: consisting of two 1D convolutional layers and two fully connected layers: The first 1D convolutional layer: kernel size 5, stride 2, padding type same, input dimension... The output dimension is The activation function is LeakyReLU with a slope of 0.2; The second 1D convolutional layer has a kernel size of 5, a stride of 2, and the same padding pattern. The input dimension is... The output dimension is The activation function is LeakyReLU with a slope of 0.2; First fully connected layer: Input dimension is The output dimension is 256, the activation function is LeakyReLU, and the slope is 0.2; Second fully connected layer: input dimension is 256, output dimension is 128, activation function is LeakyReLU, slope is 0.2; (3) Output layer: It is divided into two branches, which respectively implement true / false discrimination and feature output: True / False Detection Branch: Output dimension is 1, activation function is sigmoid, output value is or This is used to determine whether a sample is genuine or fake. Feature output branch: The output dimension is 64, and it serves as the input feature of the analyzer, denoted as... or ; Category semantic regularization is incorporated into the feature space of the discriminator to maximize the mutual information between the category condition vector and the generated sample features, guiding the discriminator to better capture category-related features. At the same time, a sample distribution matching penalty factor is added to guide the probability distribution of generated samples to actively move towards the low-density area of ​​real samples, thus alleviating the pattern collapse problem.

[0011] Preferably, in step S2, analyzer A is used to realize feature fusion and analysis of hyperspectral data, and its input is the deep features output by the discriminator, with the following structure: (1) Input layer: receives features output by the discriminator or The input dimension is 64; (2) Hidden layer: contains one fully connected layer and one Gaussian cross-attention fusion layer: Fully connected layer: input dimension 64, output dimension 32, activation function is ReLU; Gaussian cross-attention fusion layer: Combines the features output by the fully connected layer with the class condition vector of the generator. To achieve fusion, the fusion weights are parameterized using a Gaussian function, dynamically balancing the contributions of local spectral features and global class features. The fusion formula is as follows: ; in, Features after fusion; Output features for fully connected layers; For weighting; (3) Output layer: Designed according to the type of analysis task. If it is a classification task, the output dimension is... The activation function is softmax, and the output is the probability distribution of each category; if it is a quantitative analysis task, the output dimension is 1, the activation function is linear, and the output is the quantitative analysis result.

[0012] Preferably, in step S3, the discriminator loss function is designed. It includes a true / false discrimination loss, a semi-supervised classification loss, and a distribution matching penalty term, as shown below: ; in, To combat the losses; This is the semi-supervised classification loss; For distribution matching penalty terms; , This is the penalty coefficient; Combating losses The following are methods to optimize the discriminator's ability to distinguish between true and false data: ; in, The set of all real samples; To generate the number of samples, ; The output of the discriminator for the real sample x represents the probability that the discriminator considers x to be a real sample; The output of the discriminator to the generated sample represents the probability that the discriminator considers the sample to be real; Semi-supervised classification loss The following are examples of methods used to optimize the discriminator's category feature extraction capabilities using labeled samples: ; in, For labeled sample sets; For labeled samples Category tags; For the discriminator to sample Belongs to the Probability estimation of the class; Distribution matching penalty term This is used to guide the distribution of generated samples to converge towards the low-density regions of the real samples, as shown below: ; in, Let KL divergence be a metric. The probability distribution for generating samples; The distribution of low-density regions in the real sample is obtained through kernel density estimation.

[0013] Preferably, in step S3, the generator loss function is designed. It includes adversarial loss, spectral continuity loss, and class consistency loss, as shown below: ; in, To combat loss in generators; This results in a loss of spectral continuity. For category consistency loss; , This is the penalty coefficient; Generators against loss The following are methods to optimize the generator's ability to produce realistic samples: ; Spectral continuity loss To ensure the continuity of the spectral bands in the generated spectral samples and avoid spectral distortion, as shown below: ; in, To generate sample number Values ​​for each band; To generate sample number Values ​​for each band; Category consistency loss To ensure consistency between the generated samples and the category conditions, the following is used: ; in, Category condition vector The One component; For the analyzer to determine if the generated sample belongs to the first... Probability estimation of the class.

[0014] Preferably, in step S3, the analyzer loss function is designed. It includes supervised loss and generated sample auxiliary loss, as shown below: ; in, To monitor losses; To generate sample auxiliary loss; As an auxiliary coefficient; Monitoring losses To optimize the analyzer's accuracy using labeled samples, the classification task employs cross-entropy loss. ;in, Let $\mathbf{k}$ be the probability that the analyzer classifies a labeled sample as belonging to the $k$ class. The quantitative analysis task uses mean squared error loss. ;in, To label the true values ​​of the samples; The predicted value of the analyzer; Generate sample auxiliary loss To further optimize the generalization ability of the analyzer using generated samples, the formula for the classification task is: The formula for quantitative analysis is: ;in, To generate the true quantitative values ​​corresponding to the samples (obtained by category condition mapping); This represents the analyzer's predicted value for the generated sample.

[0015] Preferably, in step S3, the SSC-GAN network training process is as follows: Initialize network parameters: The parameters of the generator, discriminator, and analyzer are all initialized using a He normal distribution, and the initial learning rate is set to... It uses the Adam optimizer; The first stage of training is adversarial training between the discriminator and the generator: with the analyzer parameters fixed, the discriminator and the generator are trained alternately. For each round of training, the discriminator is trained, and the generator is trained for one round. A total of 100 rounds of training are conducted to optimize the authenticity and spectral continuity of the generated samples. (1) Training the discriminator: Input the real samples in the training set and the virtual samples generated by the generator into the discriminator, and calculate the discriminator loss. The discriminator parameters are updated through backpropagation; (2) Training the generator: The random noise vector and category condition vector The generator takes input samples to produce virtual samples, which are then input into the discriminator and analyzer to calculate the generator loss. The generator parameters are updated through backpropagation; The second phase of training involves simultaneous optimization of the three components: the fixed parameters of the analyzer are removed, and the generator, discriminator, and analyzer are trained simultaneously for a total of 100 rounds to optimize the analysis accuracy and generalization ability of the analyzer. (1) Simultaneously input real samples and generated samples, and calculate the discriminator loss respectively. Generator loss and analyzer loss ; (2) The parameters of the three modules are updated by backpropagation, and the learning rate is decayed every 50 rounds with a decay coefficient of 0.5 to avoid overfitting. (3) During the training process, the spectral continuity of the generated samples and the accuracy of the analyzer on the validation set are monitored in real time. If the accuracy does not improve for 10 consecutive rounds, the training is stopped and the optimal network parameters are saved.

[0016] Preferably, in step S4, the trained SSC-GAN network is used to perform intelligent data analysis on the preprocessed hyperspectral test samples. The specific process is as follows: Step S41: Input the test sample into the discriminator and extract deep spectral features. ; Step S42: Input the extracted features into the analyzer, fuse them with the category features through the Gaussian cross-attention fusion layer, and output the analysis results; Step S43: Post-process the analysis results: For the classification task, the argmax function is used to select the category with the highest probability as the final classification result; for the quantitative analysis task, the moving average filter is used to eliminate prediction fluctuations and obtain the final quantitative analysis result. Step S44: Calculate and analyze accuracy: For classification tasks, evaluate accuracy using overall accuracy, average accuracy, and Kappa coefficient; for quantitative analysis tasks, evaluate accuracy using mean absolute error and root mean square error. When the analysis accuracy does not meet the preset requirements, adjust the network parameters, retrain the network and re-analyze the data until the preset accuracy requirements are met; at the same time, add the newly acquired labeled samples to the training set and iteratively optimize the model.

[0017] Therefore, the present invention employs the above-mentioned intelligent data analysis method for hyperspectral small samples based on SSC-GAN, and the beneficial effects are as follows: (1) SSC-GAN was applied to the analysis of small sample hyperspectral data. A single-stage controllable generation structure was designed. By combining the style jump connection mechanism and spectral continuity loss, the problems of spectral distortion and mode collapse of traditional GAN ​​generated samples were solved. The generated virtual samples were highly consistent with the spectral distribution and band correlation of real hyperspectral samples, effectively filling the gap of small samples. (2) The semi-supervised training mode is adopted, which makes full use of labeled and unlabeled samples, without relying on a large amount of labeled data, thus reducing the cost of hyperspectral data labeling. At the same time, through the synchronous optimization of generator, discriminator and analyzer, the integration of "sample generation-feature extraction-data analysis" is realized, which improves the analysis accuracy and generalization ability in small sample scenarios. (3) A dedicated loss function was designed for the characteristics of hyperspectral data. A distribution matching penalty factor and a Gaussian cross-attention fusion mechanism were introduced. This not only ensured the authenticity and continuity of the generated samples, but also achieved the accurate fusion of local spectral features and global category features, thus solving the problem that traditional methods are difficult to mine deep nonlinear features of hyperspectral data. (4) This invention is highly versatile and can be adapted to various hyperspectral data analysis tasks such as classification and quantitative analysis. It is applicable to multiple fields such as agricultural product quality testing, Chinese medicinal material analysis, and land cover classification. Moreover, the implementation process is simple, the calculation efficiency is high, and it is easy to implement in engineering.

[0018] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0019] Figure 1 This is a flowchart of a hyperspectral small-sample intelligent data analysis method based on SSC-GAN. Detailed Implementation

[0020] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0021] like Figure 1 As shown, this invention constructs a semi-supervised single-stage controllable generative adversarial network (SSC-GAN), which includes three main modules: generator, discriminator, and analyzer. It adopts a semi-supervised training mode, designs a dedicated loss function based on the spectral continuity characteristics of hyperspectral data, and achieves accurate generation of virtual hyperspectral samples through a single-stage controllable generation mechanism. At the same time, the generator and analyzer are optimized synchronously. The analyzer is trained by using the generated samples and real small samples, realizing feature extraction, classification, or quantitative analysis of hyperspectral small sample data.

[0022] Step S1: Preprocessing of hyperspectral small sample data.

[0023] Collect small sample hyperspectral data, including labeled and unlabeled samples, preprocess the raw data to remove noise and redundant information, and obtain a standardized hyperspectral sample dataset.

[0024] Step S11, Data Acquisition: Acquire hyperspectral data of the target scene using a hyperspectral imaging device to obtain the original spectral matrix. As shown below: ; in, The total number of samples, labeled with the sample number. The number of samples was not labeled. , ; This represents the number of hyperspectral bands.

[0025] Step S12, Noise Removal: A wavelet thresholding denoising algorithm is used to eliminate spectral noise. The wavelet basis is db4, the decomposition level is 3, and the threshold... The calculation method is as follows: ; in, The noise standard deviation is estimated from the high-frequency components of the original spectral data, as shown below: ; in, These are the high-frequency wavelet coefficients of the original spectral data.

[0026] Step S13, Spectral Normalization: The min-max normalization method is used to map the preprocessed spectral data to the [0,1] interval. The normalization formula is: ; in, For the first The first sample Normalized values ​​for each band; This is the denoised spectral matrix; This represents the minimum value of all samples in the b-th band. This represents the maximum value of all samples in the b-th band.

[0027] Step S14: Dataset partitioning: The normalized spectral data is divided into a training set (80%) and a test set (20%). The training set contains all labeled samples and some unlabeled samples, while the test set contains only labeled samples, which is used to verify the accuracy of data analysis.

[0028] Step S2: Construct the SSC-GAN network structure.

[0029] The SSC-GAN network consists of three main modules: generator (G), discriminator (D), and analyzer (A), with each module structure designed specifically for the characteristics of hyperspectral data.

[0030] Step S21, Generator (G): It adopts a structure combining single-stage fully connected and convolution to receive random noise vectors and category condition information, and generate virtual spectral samples that are consistent with the distribution of real hyperspectral samples.

[0031] (1) Input layer: receives a random noise vector and a class condition vector; where the random noise vector is represented as It follows a normal distribution. The category condition vector is represented as , The number of categories is represented using one-hot encoding; the two are concatenated to obtain the input vector. As shown below: ; (2) Hidden layers: consisting of 3 fully connected layers and 2 1D convolutional layers: The first fully connected layer has an input dimension of 100+K, an output dimension of 256, an activation function of LeakyReLU, and a slope of 0.2. Second fully connected layer: input dimension is 256, output dimension is 512, activation function is LeakyReLU, slope is 0.2; Third fully connected layer: Input dimension is 512, output dimension is... , The number of hyperspectral bands is given, the activation function is LeakyReLU, and the slope is 0.2. The first 1D convolutional layer: kernel size 3, stride 1, padding type same, input dimension [missing information]. The output dimension is The activation function is LeakyReLU with a slope of 0.2; The second 1D convolutional layer has a kernel size of 3, a stride of 1, and the same padding pattern. The input dimension is... The output dimension is The activation function is tanh, which maps the output to the [0,1] interval to obtain the generated spectral sample. .

[0032] (3) Introduce the Style Skip Connection mechanism to convert the input category condition vector By injecting skip connection paths between each hidden layer and the output layer, and adjusting the style features of each layer through a residual learning mapping function, the semantic accuracy of the generated samples is ensured, while preserving spectral continuity and avoiding spectral distortion.

[0033] Step S22, Discriminator (D): A semi-supervised structure is used to distinguish whether the input sample is a real sample (labeled / unlabeled) or a generated sample, and at the same time extract the deep spectral features of the sample to provide feature support for the analyzer.

[0034] (1) Input layer: receives real spectral samples (Labeled / Unlabeled) or generate spectral samples The input dimension is ; (2) Hidden layers: consisting of two 1D convolutional layers and two fully connected layers: The first 1D convolutional layer: kernel size 5, stride 2, padding type same, input dimension... The output dimension is The activation function is LeakyReLU with a slope of 0.2; The second 1D convolutional layer has a kernel size of 5, a stride of 2, and the same padding pattern. The input dimension is... The output dimension is The activation function is LeakyReLU with a slope of 0.2; First fully connected layer: Input dimension is The output dimension is 256, the activation function is LeakyReLU, and the slope is 0.2; Second fully connected layer: input dimension is 256, output dimension is 128, activation function is LeakyReLU, slope is 0.2; (3) Output layer: It is divided into two branches, which respectively implement true / false discrimination and feature output: True / False Detection Branch: Output dimension is 1, activation function is sigmoid, output value is or This is used to determine whether a sample is real or fake (the closer the value is to 1, the more real the sample is; the closer it is to 0, the more generated the sample is). Feature output branch: The output dimension is 64, and it serves as the input feature of the analyzer, denoted as... or .

[0035] (4) Incorporate category semantic regularization into the feature space of the discriminator to maximize the mutual information between the category condition vector and the generated sample features, guide the discriminator to better capture category-related features, and add a sample distribution matching penalty factor to guide the probability distribution of generated samples to actively move towards the low-density area of ​​real samples, thus alleviating the pattern collapse problem.

[0036] Step S23, Analyzer (A): Used to realize feature fusion and accurate analysis (classification or quantitative analysis) of hyperspectral data. The input is the deep features output by the discriminator.

[0037] (1) Input layer: receives features output by the discriminator or The input dimension is 64; (2) Hidden layer: contains one fully connected layer and one Gaussian cross-attention fusion layer: Fully connected layer: input dimension 64, output dimension 32, activation function is ReLU; Gaussian cross-attention fusion layer: Combines the features output by the fully connected layer with the class condition vector of the generator. To achieve fusion, the fusion weights are parameterized using a Gaussian function, dynamically balancing the contributions of local spectral features and global class features. The fusion formula is as follows: ; in, Features after fusion; Output features for fully connected layers; To fuse the weights, a Gaussian function is used. Calculations show that The standard deviation of the Gaussian function is initially set to 0.5, and adaptive optimization is performed during training.

[0038] (3) Output layer: Designed according to the type of analysis task. If it is a classification task, the output dimension is... (Number of categories), with softmax as the activation function, outputs the probability distribution of each category; for quantitative analysis tasks (such as component content detection), the output dimension is 1, the activation function is linear, and the output is the quantitative analysis result.

[0039] Step S3: Training the SSC-GAN network.

[0040] A semi-supervised training mode is adopted, in which the generator, discriminator and analyzer are trained in stages, and the synchronous optimization of the three is achieved through a multi-objective loss function.

[0041] Step S31, Loss Function Design: Design loss functions to optimize the generator, discriminator, and analyzer, respectively, to ensure stable network training and accurate generated samples and analysis results.

[0042] (1) Discriminator loss function It includes true / false discrimination loss, semi-supervised classification loss, and distribution matching penalty term, as shown below: ; in, To combat the losses; This is the semi-supervised classification loss; For distribution matching penalty terms; , These are penalty coefficients, with values ​​of 0.5 and 0.3 respectively, used to balance the weights of each loss term.

[0043] Combating losses The following are methods to optimize the discriminator's ability to distinguish between true and false data: ; in, The set of all real samples; To generate the number of samples, ; The output of the discriminator for the real sample x represents the probability that the discriminator considers x to be a real sample; The output of the discriminator to the generated sample represents the probability that the discriminator considers the sample to be real.

[0044] Semi-supervised classification loss The following are examples of methods used to optimize the discriminator's category feature extraction capabilities using labeled samples: ; in, For labeled sample sets; For labeled samples Category labels (one-hot encoding); For the discriminator to sample Belongs to the Probability estimation of the class.

[0045] Distribution matching penalty term This is used to guide the distribution of generated samples to converge towards the low-density regions of the real samples, as shown below: ; in, Let KL divergence be a metric. The probability distribution for generating samples; The distribution of low-density regions in the real sample is obtained through kernel density estimation.

[0046] (2) Generator loss function It includes adversarial loss, spectral continuity loss, and class consistency loss, as shown below: ; in, To combat loss in generators; This results in a loss of spectral continuity. For category consistency loss; , The penalty coefficients are set to 1.0 and 0.8 respectively, prioritizing the preservation of spectral continuity.

[0047] Generators against loss The following are methods to optimize the generator's ability to produce realistic samples: ; Spectral continuity loss To ensure the continuity of the spectral bands in the generated spectral samples and avoid spectral distortion, as shown below: ; in, To generate sample number Values ​​for each band; To generate sample number Values ​​for each band.

[0048] Category consistency loss To ensure consistency between the generated samples and the category conditions, the following is used: ; in, Category condition vector The One component; For the analyzer to determine if the generated sample belongs to the first... Probability estimation of the class.

[0049] (3) Analyzer loss function It includes supervised loss and generated sample auxiliary loss, as shown below: ; in, To monitor losses; To generate sample auxiliary loss; This is an auxiliary coefficient, with a value of 0.6, used to balance the training weights of labeled samples and generated samples.

[0050] Monitoring losses To optimize the analyzer's accuracy using labeled samples, the classification task employs cross-entropy loss. ;in, Let $\mathbf{k}$ be the probability that the analyzer classifies a labeled sample as belonging to the $k$ class. The quantitative analysis task uses mean squared error loss. ;in, To label the true values ​​of the samples; This is the analyzer's predicted value.

[0051] Generate sample auxiliary loss To further optimize the generalization ability of the analyzer using generated samples, the formula for the classification task is: The formula for quantitative analysis is: ;in, To generate the true quantitative values ​​corresponding to the samples (obtained by category condition mapping); This represents the analyzer's predicted value for the generated sample.

[0052] Step S32, Training Process.

[0053] Initialize network parameters: The parameters of the generator, discriminator, and analyzer are all initialized using a He normal distribution, and the initial learning rate is set to... Using the Adam optimizer ( , The batch size is set to 32, and the total number of training epochs is set to 200. Phase 1 training (discriminator vs. generator adversarial training): With the analyzer parameters fixed, the discriminator and generator are trained alternately. For each round of discriminator training, the generator is trained for one round, for a total of 100 rounds. The focus is on optimizing the realism and spectral continuity of the generated samples. (1) Training the discriminator: Input the real samples (labeled + unlabeled) and the virtual samples generated by the generator from the training set into the discriminator, and calculate the discriminator loss. The discriminator parameters are updated through backpropagation; (2) Training the generator: The random noise vector and category condition vector The generator takes input samples to produce virtual samples, which are then input into the discriminator and analyzer to calculate the generator loss. The generator parameters are updated through backpropagation.

[0054] The second phase of training (simultaneous optimization of the three): the fixed parameters of the analyzer are removed, and the generator, discriminator and analyzer are trained at the same time for a total of 100 rounds, with a focus on optimizing the analysis accuracy and generalization ability of the analyzer. (1) Simultaneously input real samples (labeled + unlabeled) and generated samples, and calculate the discriminator loss respectively. Generator loss and analyzer loss ; (2) The parameters of the three modules are updated by backpropagation, and the learning rate is decayed every 50 rounds with a decay coefficient of 0.5 to avoid overfitting. (3) During the training process, the spectral continuity of the generated samples and the accuracy of the analyzer on the validation set are monitored in real time. If the accuracy does not improve for 10 consecutive rounds, the training is stopped and the optimal network parameters are saved.

[0055] Step S4: Intelligent data analysis of small hyperspectral samples.

[0056] The trained SSC-GAN network is used to perform intelligent data analysis on the preprocessed hyperspectral test samples.

[0057] Step S41: Input the test sample into the discriminator and extract deep spectral features. ; Step S42: Input the extracted features into the analyzer, fuse them with the category features through the Gaussian cross-attention fusion layer, and output the analysis results (classification probability or quantitative value). Step S43: Post-process the analysis results: For the classification task, the argmax function is used to select the category with the highest probability as the final classification result; for the quantitative analysis task, a moving average filter (window size of 5) is used to eliminate prediction fluctuations and obtain the final quantitative analysis results. Step S44: Calculate and analyze accuracy: For classification tasks, use overall accuracy (OA), average accuracy (AA), and Kappa coefficient for evaluation; for quantitative analysis tasks, use mean absolute error (MAE) and root mean square error (RMSE) for evaluation.

[0058] Overall accuracy (OA): ;in, For the first The number of true positives in a class; The number of false positives; These are false negatives; Average accuracy (AA): ; Kappa coefficient: ; Mean Absolute Error (MAE): ; Root Mean Square Error (RMSE): ;in, This represents the number of test samples; The true value of the test sample; These are predicted values.

[0059] Step S5: Model optimization and iteration.

[0060] If the analysis accuracy does not meet the preset requirements (OA≥95% for classification tasks, MAE≤0.5 for quantitative analysis tasks), adjust the network parameters (learning rate, penalty coefficient, convolution kernel size), and retrain the network and perform data analysis until the preset accuracy requirements are met. At the same time, newly acquired labeled samples can be added to the training set to iteratively optimize the model and further improve the analysis performance.

[0061] Example 1 This embodiment uses the quantitative analysis of the effective components (ginsenosides) in traditional Chinese medicinal materials (such as ginseng) as an example to illustrate the specific implementation process of the present invention, as follows: Step S1: Preprocessing of hyperspectral small sample data.

[0062] Data Acquisition: Hyperspectral data of ginseng samples were acquired using a hyperspectral imager, with a spectral range of 400-1000 nm and [number of bands missing]. A total of 100 samples were collected (30 labeled samples and 70 unlabeled samples), and the original spectral matrix was obtained. The labeled samples contain the actual content of ginsenosides (range 0.5%-2.0%). Noise removal: A db4 wavelet basis was used, with a decomposition level of 3, and the noise standard deviation was calculated. To obtain the threshold Wavelet thresholding is used to denoise the original spectrum to eliminate instrument noise and environmental noise; Spectral normalization: The min-max normalization method is used to map the denoised spectral data to the [0,1] interval to obtain the normalized spectral matrix. ; Dataset split: The training set contains 30 labeled samples and 56 unlabeled samples (86 in total), and the test set contains 14 labeled samples, which are used to verify the accuracy of quantitative analysis.

[0063] Step S2: Construct the SSC-GAN network structure.

[0064] Generator (G): Input is a random noise vector and category condition vector (Based on ginsenoside content, divided into 5 levels, uniquely thermally encoded), the hidden layer includes 3 fully connected layers (105→256→512→1024) and 2 1D convolutional layers (3×3 kernels, stride 1), and the output layer outputs... The generated spectral samples introduce a style jump connection mechanism and inject category condition information; Discriminator (D): The input is the real spectrum or the generated spectrum. The hidden layer includes two 1D convolutional layers (convolutional kernel 5×5, stride 2) and two fully connected layers (64→256→128). The output layer is divided into a true / false discrimination branch (output 1D) and a feature output branch (output 64D). A distribution matching penalty factor is added. Analyzer (A): The input is the 64-dimensional features output by the discriminator. The hidden layer includes one fully connected layer (64→32) and one Gaussian cross-attention fusion layer. The output layer is 1-dimensional, the activation function is linear, and the output is the predicted value of ginsenoside content.

[0065] Step S3: Training the SSC-GAN network.

[0066] Initialization parameters: learning rate Adam optimizer ( , (batch size=32, total epochs=200, penalty coefficient) , , , , ; Phase 1 training (100 rounds): With the analyzer parameters fixed, the discriminator and generator are trained alternately. After each round of training, the spectral continuity error of the generated samples is calculated to ensure that the error is ≤0.02. The second phase of training (100 rounds): The three modules are trained simultaneously, with the learning rate decreasing by 0.5 every 50 rounds. The MAE of the test set is monitored in real time. When the MAE is ≤0.5 for 10 consecutive rounds, training is stopped and the optimal parameters are saved.

[0067] Step S4: Quantitative analysis of effective components in traditional Chinese medicinal materials using hyperspectral imaging.

[0068] Fourteen test samples were input into the discriminator to extract 64-dimensional deep features. The features were then input into the analyzer, and after Gaussian cross-attention fusion, the predicted ginsenoside content was output. The prediction results were then processed by a moving average filter with a window size of 5.

[0069] The accuracy of the calculation analysis is: MAE=0.32, RMSE=0.41, which meets the preset accuracy requirements (MAE≤0.5). Compared with the traditional GAN ​​method, MAE is reduced by 18.4% and RMSE is reduced by 16.7%.

[0070] Example 2 This embodiment uses hyperspectral land cover classification (Indian Pines dataset) as an example to verify the effectiveness of the present invention, as detailed below: Data preprocessing: 100 land cover samples from 5 categories in the Indian Pines dataset were selected (20 labeled samples and 80 unlabeled samples). The number of spectral bands was... After denoising and normalization, the dataset is divided into a training set (80 samples) and a test set (20 samples). Network Construction: Generator Class Condition Vector The analyzer output layer is 5-dimensional, the activation function is softmax, and the rest of the structure is the same as in Example 1; Network training: The training parameters are the same as in Example 1. The second stage of training focuses on monitoring the OA of the test set. Training is stopped when OA ≥ 95%. Classification results: Test set OA=96.5%, AA=95.8%, Kappa coefficient=0.952. Compared with existing GAN-based classification methods, OA is improved by 7.3% and Kappa coefficient is improved by 6.8%, effectively solving the overfitting problem of small sample land cover classification.

[0071] Therefore, this invention adopts the above-mentioned SSC-GAN-based hyperspectral small sample intelligent data analysis method. By designing a semi-supervised single-stage controllable generative adversarial network structure (SSC-GAN) and optimizing the network training strategy in combination with the characteristics of hyperspectral data, it achieves accurate generation of virtual samples and efficient analysis of hyperspectral data, thereby improving the accuracy, robustness and generalization ability of data analysis in small sample scenarios.

[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. A hyperspectral small-sample intelligent data analysis method based on SSC-GAN, characterized in that, Includes the following steps: Step S1: Hyperspectral small sample data preprocessing: Collect hyperspectral small sample data, including labeled and unlabeled samples, preprocess the raw data to eliminate noise and redundant information, and obtain a standardized hyperspectral sample dataset. Step S2: Construct the SSC-GAN network structure: The SSC-GAN network consists of three main modules: generator G, discriminator D, and analyzer A; Step S3, SSC-GAN network training: A semi-supervised training mode is adopted, and the generator, discriminator and analyzer are trained in stages. The synchronous optimization of the three is achieved through a multi-objective loss function. Step S4: Intelligent data analysis of small hyperspectral samples: Using the trained SSC-GAN network, intelligent data analysis is performed on the preprocessed hyperspectral test samples.

2. The hyperspectral small-sample intelligent data analysis method based on SSC-GAN according to claim 1, characterized in that, In step S1, the hyperspectral small sample data preprocessing is performed, and the specific process is as follows: Step S11, Data Acquisition: Acquire hyperspectral data of the target scene using a hyperspectral imaging device to obtain the original spectral matrix. As shown below: ; in, The total number of samples, labeled with the sample number. The number of samples was not labeled. , ; This represents the number of hyperspectral bands. Step S12, Noise Removal: A wavelet thresholding denoising algorithm is used to eliminate spectral noise. The wavelet basis is db4, the decomposition level is 3, and the threshold... The calculation method is as follows: ; in, The standard deviation of noise; Step S13, Spectral Normalization: The min-max normalization method is used to map the preprocessed spectral data to the [0,1] interval. The normalization formula is: ; in, For the first The first sample Normalized values ​​for each band; This is the denoised spectral matrix; This represents the minimum value of all samples in the b-th band. This represents the maximum value of all samples in the b-th band. Step S14: Dataset partitioning: The normalized spectral data is divided into a training set and a test set in a 4:1d ratio. The training set contains all labeled samples and some unlabeled samples, while the test set contains only labeled samples. This is used to verify the accuracy of the data analysis.

3. The hyperspectral small-sample intelligent data analysis method based on SSC-GAN according to claim 1, characterized in that, In step S2, the generator G adopts a structure combining single-stage fully connected and convolutional methods to receive random noise vectors and category conditional information, and generates virtual spectral samples that are consistent with the distribution of real hyperspectral samples. The structure is as follows: (1) Input layer: Receives a random noise vector and a class condition vector; where the random noise vector is represented as... It follows a normal distribution. The category condition vector is represented as , The number of categories is represented using one-hot encoding; the two are concatenated to obtain the input vector. As shown below: ; (2) Hidden layers: consisting of 3 fully connected layers and 2 1D convolutional layers: The first fully connected layer has an input dimension of 100+K, an output dimension of 256, an activation function of LeakyReLU, and a slope of 0.

2. Second fully connected layer: input dimension is 256, output dimension is 512, activation function is LeakyReLU, slope is 0.2; Third fully connected layer: Input dimension is 512, output dimension is... , The number of hyperspectral bands is given, the activation function is LeakyReLU, and the slope is 0.

2. The first 1D convolutional layer: kernel size 3, stride 1, padding type same, input dimension [missing information]. The output dimension is The activation function is LeakyReLU with a slope of 0.2; The second 1D convolutional layer has a kernel size of 3, a stride of 1, and the same padding pattern. The input dimension is... The output dimension is The activation function is tanh, which maps the output to the [0,1] interval to obtain the generated spectral sample. ; (3) The generator introduces a style jump connection mechanism to convert the input category condition vector By injecting skip connection paths between each hidden layer and the output layer, and adjusting the style features of each layer through a residual learning mapping function, the semantic accuracy of the generated samples is ensured while preserving spectral continuity.

4. The intelligent data analysis method for hyperspectral small samples based on SSC-GAN according to claim 1, characterized in that, In step S2, the discriminator D adopts a semi-supervised structure to distinguish whether the input sample is a real sample or a generated sample, and at the same time extracts the deep spectral features of the sample to provide feature support for the analyzer. The structure is as follows: (1) Input layer: receives real spectral samples Or generate spectral samples The input dimension is ; (2) Hidden layers: consisting of two 1D convolutional layers and two fully connected layers: The first 1D convolutional layer: kernel size 5, stride 2, padding type same, input dimension... The output dimension is The activation function is LeakyReLU with a slope of 0.2; The second 1D convolutional layer has a kernel size of 5, a stride of 2, and the same padding pattern. The input dimension is... The output dimension is The activation function is LeakyReLU with a slope of 0.2; First fully connected layer: Input dimension is The output dimension is 256, the activation function is LeakyReLU, and the slope is 0.2; Second fully connected layer: input dimension is 256, output dimension is 128, activation function is LeakyReLU, slope is 0.2; (3) Output layer: It is divided into two branches, which respectively implement true / false discrimination and feature output: True / False Detection Branch: Output dimension is 1, activation function is sigmoid, output value is or This is used to determine whether a sample is genuine or fake. Feature output branch: The output dimension is 64, and it serves as the input feature of the analyzer, denoted as... or ; Category semantic regularization is incorporated into the feature space of the discriminator to maximize the mutual information between the category condition vector and the generated sample features, guiding the discriminator to better capture category-related features. At the same time, a sample distribution matching penalty factor is added to guide the probability distribution of generated samples to actively move towards the low-density region of real samples.

5. The hyperspectral small-sample intelligent data analysis method based on SSC-GAN according to claim 1, characterized in that, In step S2, analyzer A is used to perform feature fusion and analysis of hyperspectral data. Its input is the deep features output by the discriminator, and its structure is as follows: (1) Input layer: receives features output by the discriminator or The input dimension is 64; (2) Hidden layer: contains one fully connected layer and one Gaussian cross-attention fusion layer: Fully connected layer: input dimension is 64, output dimension is 32, activation function is ReLU; Gaussian cross-attention fusion layer: Combines the features output by the fully connected layer with the class condition vector of the generator. To achieve fusion, the fusion weights are parameterized using a Gaussian function, dynamically balancing the contributions of local spectral features and global class features. The fusion formula is as follows: ; in, Features after fusion; Output features for fully connected layers; For fusion weights; (3) Output layer: Designed according to the type of analysis task. If it is a classification task, the output dimension is... The activation function is softmax, and the output is the probability distribution of each category; if it is a quantitative analysis task, the output dimension is 1, the activation function is linear, and the output is the quantitative analysis result.

6. The intelligent data analysis method for small samples based on SSC-GAN according to claim 1, characterized in that, In step S3, the discriminator loss function is designed. It includes a true / false discrimination loss, a semi-supervised classification loss, and a distribution matching penalty term, as shown below: ; in, To combat the losses; This is the semi-supervised classification loss; For distribution matching penalty terms; , This is the penalty coefficient; Combat losses The following are methods to optimize the discriminator's ability to distinguish between true and false data: ; in, The set of all real samples; To generate the number of samples, ; The output of the discriminator for the real sample x represents the probability that the discriminator considers x to be a real sample; The output of the discriminator to the generated sample represents the probability that the discriminator considers the sample to be real; Semi-supervised classification loss The following are examples of methods used to optimize the discriminator's category feature extraction capabilities using labeled samples: ; in, For labeled sample sets; For labeled samples Category tags; For the discriminator to sample Belongs to the Probability estimation of the class; Distribution matching penalty term This is used to guide the distribution of generated samples to converge towards the low-density regions of the real samples, as shown below: ; in, Let KL divergence be a metric. The probability distribution for generating samples; The distribution of low-density regions in the real sample is obtained through kernel density estimation.

7. The intelligent data analysis method for hyperspectral small samples based on SSC-GAN according to claim 1, characterized in that, In step S3, the generator loss function is designed. It includes adversarial loss, spectral continuity loss, and class consistency loss, as shown below: ; in, To combat loss in generators; This results in a loss of spectral continuity. This is the loss for class consistency. , This is the penalty coefficient; Generators against loss The following are methods to optimize the generator's ability to produce realistic samples: ; Spectral continuity loss To ensure the continuity of the spectral bands in the generated spectral samples and avoid spectral distortion, as shown below: ; in, To generate sample number Values ​​for each band; To generate sample number Values ​​for each band; Category consistency loss To ensure consistency between the generated samples and the category conditions, the following is used: ; in, Category condition vector The One component; For the analyzer to determine if the generated sample belongs to the first... Probability estimation of the class.

8. The intelligent data analysis method for hyperspectral small samples based on SSC-GAN according to claim 1, characterized in that, In step S3, the analyzer loss function is designed. It includes supervised loss and generated sample auxiliary loss, as shown below: ; in, To monitor losses; To generate sample auxiliary loss; This is an auxiliary coefficient; Monitoring losses To optimize the analyzer's accuracy using labeled samples, the classification task employs cross-entropy loss. ;in, Let $\mathbf{k}$ be the probability that the analyzer classifies a labeled sample as belonging to the $k$ class. The quantitative analysis task uses mean squared error loss. ;in, To label the true values ​​of the samples; The predicted value of the analyzer; Generate sample auxiliary loss To further optimize the generalization ability of the analyzer using generated samples, the formula for the classification task is: The formula for quantitative analysis is: ;in, To generate the true quantitative values ​​corresponding to the samples (obtained by category condition mapping); This represents the analyzer's predicted value for the generated sample.

9. The intelligent data analysis method for hyperspectral small samples based on SSC-GAN according to claim 1, characterized in that, In step S3, the SSC-GAN network training process is as follows: Initialize network parameters: The parameters of the generator, discriminator, and analyzer are all initialized using a He normal distribution, and the initial learning rate is set to... It uses the Adam optimizer; The first stage of training is adversarial training between the discriminator and the generator: with the analyzer parameters fixed, the discriminator and the generator are trained alternately. For each round of training, the discriminator is trained, and the generator is trained for one round. A total of 100 rounds of training are conducted to optimize the authenticity and spectral continuity of the generated samples. (1) Training the discriminator: Input the real samples in the training set and the virtual samples generated by the generator into the discriminator, and calculate the discriminator loss. The discriminator parameters are updated through backpropagation; (2) Training the generator: The random noise vector and category condition vector The generator takes input samples to produce virtual samples, which are then input into the discriminator and analyzer to calculate the generator loss. The generator parameters are updated through backpropagation; The second phase of training involves simultaneous optimization of the three components: the fixed parameters of the analyzer are removed, and the generator, discriminator, and analyzer are trained simultaneously for a total of 100 rounds to optimize the analysis accuracy and generalization ability of the analyzer. (1) Simultaneously input real samples and generated samples, and calculate the discriminator loss respectively. Generator loss and analyzer loss ; (2) The parameters of the three modules are updated by backpropagation, and the learning rate is decayed every 50 rounds with a decay coefficient of 0.5 to avoid overfitting. (3) During the training process, the spectral continuity of the generated samples and the accuracy of the analyzer on the validation set are monitored in real time. If the accuracy does not improve for 10 consecutive rounds, the training is stopped and the optimal network parameters are saved.

10. The hyperspectral small-sample intelligent data analysis method based on SSC-GAN according to claim 1, characterized in that, In step S4, the trained SSC-GAN network is used to perform intelligent data analysis on the preprocessed hyperspectral test samples. The specific process is as follows: Step S41: Input the test sample into the discriminator and extract deep spectral features. ; Step S42: Input the extracted features into the analyzer, fuse them with the category features through the Gaussian cross-attention fusion layer, and output the analysis results; Step S43: Post-process the analysis results: The classification task uses the argmax function to select the category with the highest probability as the final classification result; The quantitative analysis task uses a moving average filter to eliminate prediction fluctuations and obtain the final quantitative analysis results; Step S44: Calculate and analyze accuracy: For classification tasks, evaluate accuracy using overall accuracy, average accuracy, and Kappa coefficient; For quantitative analysis tasks, mean absolute error and root mean square error are used for evaluation. When the analysis accuracy does not meet the preset requirements, adjust the network parameters, retrain the network and re-analyze the data until the preset accuracy requirements are met; at the same time, add the newly acquired labeled samples to the training set and iteratively optimize the model.