A small sample spectral regression prediction method based on generative self-training and density weighted sampling

By employing a small-sample spectral regression prediction method based on generative self-training and density-weighted sampling, the problem of inaccurate mapping between spectra and physicochemical components under small sample conditions is solved, generating realistic spectral data, improving the model's prediction accuracy and generalization ability, and reducing detection costs.

CN122436059APending Publication Date: 2026-07-21FUJIAN JIANGXIA UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610575743.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-28
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Under small sample conditions, existing conditional generative adversarial networks struggle to accurately capture the nonlinear mapping between spectra and physicochemical components, leading to problems such as misalignment of generated data values, uneven data distribution, and spectral distortion.

Method used

We employ a generative self-training and density-weighted sampling method to learn the nonlinear mapping between spectral features and physicochemical components through a teacher model, generating unlabeled simulated spectra. We also utilize pseudo-labels to construct a consistency mapping and combine a trend-detail bi-branch generator and a density-weighted sampling strategy to generate realistic spectral data.

Benefits of technology

It effectively avoids misalignment between spectral features and labels, balances data distribution, improves the model's prediction accuracy and generalization ability, reduces the need for a large number of labeled samples, and reduces the time and cost of physicochemical testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122436059A_ABST
    Figure CN122436059A_ABST
Patent Text Reader

Abstract

The application provides a small sample spectrum regression prediction method based on generative self-training and density weighted sampling, comprising the following steps: constructing an original training set; constructing a deep learning regression network as a teacher model, performing supervised training on the teacher model by using the original training set, and establishing a nonlinear mapping relationship between spectrum features and true values of physicochemical components; constructing an unconditional generative adversarial network, and training a generator of the unconditional generative adversarial network only by using spectrum data in the original training set; generating batches of unlabeled simulated spectrum by using the trained generator, inputting the simulated spectrum into the trained teacher model for prediction, and taking the prediction output as pseudo-labels of the simulated spectrum; performing numerical distribution statistics on the obtained pseudo-labels to construct sampling weights negatively correlated with local sample density, and screening key samples located in a sparse interval from the simulated spectrum according to the sampling weights; and constructing a mixed training set, training a student model by using the mixed training set, and obtaining a final spectrum regression prediction model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the interdisciplinary field of spectral analysis, chemometrics and artificial intelligence, and specifically relates to a small-sample spectral regression prediction method based on generative self-training and density-weighted sampling. Background Technology

[0002] Near-infrared spectroscopy (NIRS) analysis is widely used in quantitative analysis due to its speed and non-destructive nature. However, building high-precision quantitative calibration models typically relies on a large number of samples with physicochemical labels. In practice, although acquiring spectral data is relatively easy, determining the corresponding physicochemical indicators using standard chemical laboratory methods is often time-consuming, labor-intensive, and costly, resulting in a limited number of labeled samples for modeling. Compared to the high-dimensional characteristics of spectral data and the large number of parameters in deep neural networks, this type of data represents a typical small-sample regression problem. To address the resulting model overfitting and insufficient generalization ability, data augmentation techniques are widely used. However, applying generative adversarial networks (GANs) to spectral quantitative regression prediction faces the following technical challenges:

[0003] 1. Feature-Label Misalignment: Existing Conditional Generative Adversarial Networks (cGANs) attempt to directly generate spectra with specified physicochemical values ​​(labels). However, due to the extremely complex nonlinear mapping between spectra and physicochemical components, cGAN generators often struggle to accurately capture this mapping relationship under small-sample training. This results in generated simulated spectra that, while waveform-realistic, do not contain spectral features that match the input conditional labels. Using this misaligned data as augmentation samples is equivalent to introducing label noise, which misleads the training of regression models and disrupts their decision boundaries.

[0004] 2. Non-uniform data distribution: The distribution of physicochemical values ​​in real samples is usually non-uniform, meaning that most samples are concentrated around the mean, while very few samples are in sparse regions (such as extreme values ​​of high or low content). Blindly using GANs to augment large amounts of data often exacerbates the trend of data concentration towards the mean, causing the model to overfit the features of samples in high-density regions while ignoring the feature responses in sparse regions, thus producing significant prediction bias in extreme value regions.

[0005] 3. Spectral morphology distortion: Traditional generators usually use transposed convolution for upsampling. Due to uneven overlap of convolution kernels, non-physical high-frequency oscillation noise is easily introduced into one-dimensional spectral data, which manifests as sawtooth jitter in the spectral waveform.

[0006] In summary, generating high-quality spectral data with physical authenticity and the ability to effectively correct for data distribution biases under small sample conditions is a technical challenge that needs to be addressed. Summary of the Invention

[0007] To address the problems in existing technologies for small-sample spectral regression prediction, such as the difficulty of conditional generative adversarial networks in accurately capturing the complex nonlinear mapping between spectra and physicochemical components, leading to misalignment of generated data shape and value; the problem of blindly expanding data and exacerbating the concentration of sample distribution in dense intervals while ignoring sparse intervals; and the problem of traditional transposed convolution upsampling introducing jagged jitter in spectrum generation, this invention provides a small-sample spectral regression prediction method based on generative self-training and density-weighted sampling.

[0008] This invention first trains a deep learning regression network as a teacher model using a limited original training set, enabling it to grasp the nonlinear mapping relationship between spectral features and physicochemical component values. Then, a generative model is constructed, trained only on the spectral data from the original training set, allowing it to learn the waveform distribution characteristics of real spectra without learning the mapping relationship with physicochemical component values. The trained generative model generates simulated spectra without physicochemical component values, which are then input into the teacher model for prediction. The prediction output of the teacher model serves as a pseudo-label for the simulated spectrum, thus establishing a consistent mapping relationship between the simulated spectral waveform and physicochemical component values, avoiding the misalignment between spectral morphology and label values ​​in existing conditional generation methods. Furthermore, this invention performs numerical distribution statistics on the pseudo-labels, constructing sampling weights negatively correlated with local sample density. Based on these sampling weights, key samples located in sparse label value intervals are selected from the simulated spectra. These key samples are mixed with the original training set to construct a balanced mixed training set. This mixed training set is then used to train the student model, obtaining the final spectral regression prediction model. This effectively corrects the distribution bias of the training set through a micro-sample injection, avoiding the accumulation of redundant and invalid data.

[0009] In terms of the generative model structure, this invention adopts a trend-detail dual-branch parallel topology. The global trend branch fits the baseline drift of the spectrum, and the local detail branch generates the local absorption peak features of the spectrum. The outputs of the two branches are superimposed element by element to obtain the simulated spectrum. The local detail branch adopts a structure of linear upsampling, reflection filling and one-dimensional convolution in sequence. Linear interpolation replaces the traditional transposed convolution operation, and mirror reflection filling is performed on the edge of the feature map to maintain the numerical continuity of the spectral endpoint data, effectively eliminating the jagged jitter in the generated spectrum.

[0010] In terms of sampling strategy, this invention divides the value range of pseudo-labels into multiple statistical intervals, counts the number of samples in each interval, makes the sampling weight inversely proportional to the number of samples in the interval, and performs random sampling without replacement accordingly, so that the simulated spectrum in the sparse interval with a small number of samples has a higher probability of being selected.

[0011] The specific technical solution adopted by this invention to solve its technical problem is as follows:

[0012] A small-sample spectral regression prediction method based on generative self-training and density-weighted sampling includes the following steps:

[0013] Obtain the original spectral data and corresponding true values ​​of physicochemical components of the sample to be tested, and construct the original training set;

[0014] A deep learning regression network is constructed as a teacher model. The teacher model is trained under supervision using the original training set to establish a nonlinear mapping relationship between spectral features and the true values ​​of physicochemical components.

[0015] An unconditional generative adversarial network is constructed, and its generator is trained using only the spectral data in the original training set, so that the generator learns the waveform features of the spectral data.

[0016] The trained generator is used to generate a batch of unlabeled simulated spectra. The simulated spectra are then input into the trained teacher model for prediction, and the prediction output is used as a pseudo-label for the simulated spectra.

[0017] Numerical distribution statistics are performed on the obtained pseudo-labels to identify sparse intervals in the sample distribution. Sampling weights that are negatively correlated with local sample density are constructed. Key samples located in the sparse intervals are screened from the simulated spectrum based on the sampling weights.

[0018] The original training set is mixed with the selected key samples to construct a hybrid training set. The student model is then trained using the hybrid training set to obtain the final spectral regression prediction model.

[0019] Furthermore, the generator adopts a trend-detail dual-branch parallel topology, which includes a global trend branch, a local detail branch, and an output fusion module. The global trend branch uses a linear fully connected layer to map the input noise vector into a trend vector with the same spectral dimension as the target. The local detail branch uses a structure of cascaded linear upsampling layer, reflection filling layer, and one-dimensional convolutional layer to map the input noise vector into a detail vector containing local absorption peak features. The output fusion module is used to superimpose the trend vector and the detail vector element-wise and output the final simulated spectrum through an activation function.

[0020] Furthermore, the process of constructing the sampling weights includes: dividing the value range of the pseudo-labels into K statistical intervals, where K is a positive integer; and counting the number N samples falling into the i-th statistical interval. i According to the formula Determine the sampling weight W of the samples within the i-th statistical interval. i , where ε is the smoothing coefficient.

[0021] Furthermore, the number of key samples selected is 5% to 15% of the original training set sample size.

[0022] Furthermore, the student model and the teacher model are isomorphic deep learning regression networks, and both the teacher model and the student model adopt a one-dimensional convolutional neural network.

[0023] Furthermore, it also includes data preprocessing and numerical adaptation steps: Z-Score standardization is performed on the true values ​​of physicochemical components so that the standardized true values ​​of physicochemical components follow a standard normal distribution with a mean of 0 and a variance of 1; before training the unconditional generative adversarial network, the spectral data used for training is mapped to the [-1,1] interval; after generating the simulated spectrum, the simulated spectrum is inversely mapped back to the original numerical domain and then input into the teacher model for pseudo-label prediction.

[0024] Furthermore, when training the unconditional generative adversarial network, the Kolmogorov-Smirnov statistic is used as the selection criterion for the generator. Every preset iteration, the distribution difference between the generated spectrum and the real spectrum is calculated, and the generator weight with the smallest distribution difference is saved.

[0025] Furthermore, the simulated spectrum is randomly sampled without replacement based on the sampling weights.

[0026] Furthermore, the original spectral data is near-infrared spectral data.

[0027] Furthermore, a small-sample spectral regression prediction device includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the small-sample spectral regression prediction method based on generative self-training and density-weighted sampling as described above.

[0028] Compared to existing technologies, this invention and its preferred solution fundamentally avoid the pain point of misalignment between spectral features and physicochemical labels. It abandons the existing approach of conditional generative networks requiring simultaneous learning of the mapping relationship between spectral waveforms and labels. Through a generative self-training mechanism that decouples label-free spectrum generation from pseudo-label assignment, it avoids the interference of label noise on regression model training in small-sample scenarios, ensuring the logical reliability of the augmented data. Simultaneously, it effectively solves the problem of uneven sample distribution in small-sample spectral regression modeling. By employing a sampling strategy negatively correlated with local label density, it specifically fills sample gaps in sparse label distribution regions, optimizing the data distribution structure of the training set without introducing a large amount of redundant augmented data, thus avoiding model bias in high-density regions. Overfitting of samples improves the predictive stability of the model across the entire value range. Furthermore, this invention significantly enhances the physical realism of the generated spectra through optimized technical solutions. Utilizing a trend-detail dual-branch decoupled generation structure, coupled with linear upsampling and reflection filling feature extraction design, it effectively suppresses waveform distortion and non-physical high-frequency noise that are prone to occur in traditional generation methods. The generated simulated spectra more closely resemble the morphological characteristics and distribution patterns of real spectra. Overall, this invention significantly reduces the number of labeled samples required for high-precision spectral regression models, greatly reducing the time and cost of physicochemical testing. It effectively improves the model's prediction accuracy and generalization ability even with small sample conditions, making it suitable for various practical applications of quantitative spectral analysis. Attached Figure Description

[0029] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:

[0030] Figure 1 This is an overall flowchart of the method according to an embodiment of the present invention.

[0031] Figure 2 This is a schematic diagram of the network structure shared by the teacher model and the student model in an embodiment of the present invention.

[0032] Figure 3 This is a schematic diagram of the network structure of the dual-branch generator in an embodiment of the present invention.

[0033] Figure 4 This is a comparison chart of the PCA principal component analysis distribution of the generated spectrum and the real spectrum in an embodiment of the present invention.

[0034] Figure 5 This is a waveform comparison diagram of the real soil spectrum and the generated simulated spectrum in an embodiment of the present invention.

[0035] Figure 6 This is a comparison chart of data distribution before and after density-weighted sampling in an embodiment of the present invention. Detailed Implementation

[0036] To make the features and advantages of the present invention more apparent and understandable, specific embodiments are described below in detail:

[0037] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0038] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0039] The purpose of this invention is to provide a small-sample spectral regression prediction method based on generative self-training and density-weighted sampling. A dual-branch GAN ensures realistic spectral morphology, a self-training mechanism guarantees the logical correspondence between spectral features and physicochemical labels, and density-weighted sampling achieves accurate filling of sparse regions.

[0040] To address the challenges of limited data volume, uneven label distribution, and misalignment between spectral features and labels in small-sample spectral regression modeling, conventional augmentation methods often result in this issue. This invention first trains a teacher model using limited real data. Second, it constructs a trend-detail dual-branch unconditional generative adversarial network to learn spectral waveform morphology and generate unlabeled simulated spectra. Next, it implements generative self-training, using the teacher model to construct pseudo-labels for the simulated spectra, establishing a consistent mapping between waveforms and labels. Finally, it constructs a density-weighted sampling strategy to select key samples located in sparse regions and inject them into the training set for self-training of the student model. This invention effectively improves the data distribution structure of the training set by specifically filling in samples in low-density regions of the spectral feature space, significantly enhancing the overall prediction accuracy and generalization ability of the model.

[0041] Specifically, the implementation process of the present invention refers to the following steps:

[0042] Step S1: Data Preparation. Obtain the original spectral data and corresponding true values ​​of physicochemical components of the sample to be tested, and construct the original training set;

[0043] Step S2: Teacher Model Pre-training. A deep learning regression network is constructed as the teacher model, and supervised training is performed on it using the original training set to establish a nonlinear mapping relationship between spectral features and physicochemical components; enabling it to master the basic spectral-physicochemical value mapping logic.

[0044] Step S3: Construct an unconditional generative adversarial network and train the generator using only the spectral data from the original training set to learn the waveform features of the spectral curves. The generator adopts a two-branch decoupled architecture: the curve branch is used to fit the global baseline trend of the spectrum, and the detail branch is used to generate local details.

[0045] Step S4: Construction of Physically Consistent Pseudo-Labels. A batch of unlabeled simulated spectra are generated using a generator and input into the teacher model trained in Step S2 for re-prediction. The prediction output of the teacher model is used as pseudo-labels for the simulated spectra to establish a consistent mapping relationship between simulated spectral features and physicochemical labels.

[0046] Step S5: Density-weighted precise sampling. Perform numerical distribution statistics on the pseudo-labels obtained in Step S4 to identify sparse regions in the sample distribution. Construct sampling probability weights that are inversely proportional to the local sample density, and select only a small number of key samples located in the sparse regions from the batch simulated spectra.

[0047] Step S6: Student Model Self-Training. The original training set is mixed with the key samples selected in Step S5 to construct a balanced mixed dataset. The student model, which is isomorphic to the teacher model, is then self-trained to obtain the final prediction model.

[0048] Preferably, the generator for step S3 adopts a trend-detail dual-branch parallel topology, specifically including:

[0049] (1) Global trend branch: A linear fully connected layer is used to directly map the input noise vector into a trend vector with the same dimension as the target spectrum, which is used to fit the global baseline drift of the spectrum;

[0050] (2) Local detail branch: A multi-layer neural network module is used to map the input noise vector into a detail vector containing local absorption peak features;

[0051] (3) Output fusion: The trend vector and detail vector are superimposed element by element, and the final simulated spectrum is output through the activation function.

[0052] The feature extraction module in the local detail branch employs a cascaded structure of linear upsampling, reflection padding, and one-dimensional convolution.

[0053] (1) Linear upsampling layer: The linear interpolation algorithm is used to expand the length dimension of the feature map, replacing the traditional transposed convolution operation, so as to eliminate the jagged jitter of the generated spectral curve caused by the mismatch between the transposed convolution stride and the kernel size;

[0054] (2) Reflection filling layer: The feature map edges are mirrored and filled with reflection. The filling length is adapted to the convolution kernel size to maintain the numerical continuity of the spectral endpoint data.

[0055] (3) One-dimensional convolutional layer: extracts features from the filled feature map.

[0056] The density-weighted precise sampling strategy in step S5 is as follows:

[0057] (1) Divide the pseudo-label value range of the simulated spectrum into K statistical intervals;

[0058] (2) Count the number of samples N that fall within the i-th interval. i ;

[0059] (3) Define the sampling weight Wi of the samples in the i-th interval, which satisfies the following relation. , where ε is the smoothing coefficient;

[0060] (4) Random sampling without replacement is performed on the simulated samples according to the weight Wi, so that the samples located in the sparse interval have a higher probability of being selected.

[0061] The number of key samples selected in step S5 is set to 5% to 15% of the original training set sample size.

[0062] The data preprocessing and numerical adaptation strategies include: Z-score standardization of the true values ​​of physicochemical components to make them follow a standard normal distribution with a mean of 0 and a variance of 1; when constructing and training the unconditional generative adversarial network, a numerical mapping operation is performed to map the spectral data used for training to the [-1, 1] interval to adapt to the output layer characteristics of the generator; and after generating the simulated spectrum, it is inversely mapped back to the original numerical domain for the teacher model to predict.

[0063] Compared with existing technologies, the advantages of this invention are as follows:

[0064] First, this invention abandons the traditional mode of directly generating labeled spectral data. Instead, it adopts a generative self-training mechanism in which an unconditional generative adversarial network learns only spectral waveform features and combines them with a pre-trained teacher model to assign pseudo-labels to simulated spectra. By using the teacher model as a physical consistency filter, it avoids the problem of misalignment between spectral features and label values ​​that is prone to occur in conventional conditional generative adversarial networks in small sample scenarios. It also avoids the interference of label noise on the training of regression models and ensures the logical reliability of the augmented data.

[0065] Second, this invention innovatively proposes a density-weighted sampling strategy for sparse label distribution intervals, constructs sampling weights that are negatively correlated with local sample density, and selects only a small number of key samples in sparse intervals to supplement the training set, avoiding redundant accumulation of invalid data, while effectively balancing the label distribution of the training set, and significantly improving the model's ability to predict extreme intervals of physicochemical values.

[0066] Third, the present invention adopts a generator structure with trend-detail dual-branch decoupling, which decouples the global baseline trend of the spectrum from the local absorption peak features. At the same time, the local detail branch adopts a cascaded structure of linear upsampling + reflection filling + one-dimensional convolution, which effectively eliminates the waveform jagged jitter that is easy to occur when generating spectra by traditional transposed convolution. The generated simulated spectrum is closer to the physical morphology and distribution law of the real spectrum.

[0067] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0068] This embodiment is implemented using Python 3.8 and the PyTorch deep learning framework. The hardware environment is an NVIDIA GeForce RTX 3090 GPU. To ensure the reproducibility of the experiment, the seed point was set to 42. The experimental data used was a soil near-infrared spectrum dataset containing 190 samples, with wavelengths covering the spectral range of 901.139–1700.55 nm, and each spectrum containing 228 spectra. The target for detection was soil organic matter (SOM) content.

[0069] Please refer to Figure 1 The implementation process of this embodiment includes the following steps:

[0070] Step S1: First, the dataset is randomly divided into an original training set containing 133 samples and a test set containing 57 samples. During data preprocessing, considering the different requirements of the teacher / student model and the generative model (GAN) for the numerical range of the input data, this embodiment performs the following processing:

[0071] Spectral data (X): The absorbance values ​​of the raw spectral data are naturally distributed within the range [0, 1]. For both the teacher and student models, this raw data within the range [0, 1] is directly used as input without any additional mathematical transformations to preserve the original spectral features. For GAN networks, since the output layer of its generator uses the Tanh activation function (the output value is fixed between -1 and 1), to ensure that the range of the training data is consistent with that of the generated data, the absorbance values ​​are adjusted using the formula before training the GAN. The spectral data is mapped to the [-1, 1] interval. Accordingly, the simulated spectrum output by the generator undergoes an inverse transformation operation (i.e., ...) before being input into the teacher model for pseudo-label prediction. ), and restore its numerical range to [0, 1] to ensure consistency with the input domain of the teacher model.

[0072] Label data (Y): The true values ​​of soil organic matter (SOM) are Z-score standardized to make them follow a standard normal distribution with a mean of 0 and a variance of 1.

[0073] Step S2: Please refer toFigure 2 A one-dimensional convolutional neural network (1D-CNN) is constructed as the teacher model. It should be noted that, to verify the effectiveness of the data augmentation strategy, the student model in subsequent steps will directly use the network structure of this teacher model (i.e., the two structures are completely identical). Figure 2 As shown, the feature extraction and dimensionality transformation process of the network on the input spectral data is as follows:

[0074] 1) Input layer: The input is raw spectral data of 1×228 dimensions (single channel, length 228).

[0075] 2) Feature extraction module:

[0076] First stage: After convolution with 64 kernels (size 9) and max pooling, the feature map dimension becomes 64×1×114, realizing the expansion of the number of channels and the reduction of the feature length.

[0077] Second stage: After convolution with 128 kernels (size 7) and max pooling, the feature map dimension is further changed to 128×1×57;

[0078] The third stage: After convolution operation with 256 kernels (size 5) (without pooling), the feature map dimension becomes 256×1×57, which is mainly used to extract high-dimensional deep semantic features.

[0079] Fourth stage: After convolution with 128 kernels (size 3) and max pooling, the final feature map is output with dimensions of 128×1×28.

[0080] 3) Regression prediction module: The above 128×1×28 multidimensional feature map is flattened and input into a fully connected layer containing 256 neurons. Then, it is fused through a fully connected layer containing 64 neurons. Finally, the predicted soil organic matter (SOM) content value is output through the output layer (1×1).

[0081] The teacher model was benchmarked using 133 original training samples. Specific hyperparameter configurations were as follows: 400 iterations, batch size of 8; learning rate initialized to 0.0001, adjusted using a warm-up and cosine annealing strategy, with the learning rate linearly increasing from 0 to the initial value in the first 20 training rounds, then gradually decreasing using a cosine function; mean squared error was used as the loss function; and the Adam optimizer was used for model optimization. After training, the model weights were saved. Testing showed that the teacher model achieved a certain coefficient of determination (R²) on the independent test set (57 samples). 2 The mean square error (RMSE) is 0.8490, and the root mean square error (RMSE) is 0.5898. This result indicates that the model has good baseline predictive ability.

[0082] Step S3: Construction of the bi-branch unconditional generator and learning of its spectral morphology. Please refer to... Figure 3 To address the jagged waveform jitter that often occurs when generating spectra using traditional GANs, and to generate simulated spectral curves that more closely resemble reality, this embodiment constructs an improved dual-branch unconditional generator, the specific structure of which is as follows:

[0083] 1) Input layer: Receives a random noise vector z with a dimension of 64 as the initial input for generating the simulated spectrum.

[0084] 2) The trend fitting branch uses a single-layer linear fully connected network to directly map the 64-dimensional noise vector to a 228-dimensional vector. The function of this branch is to fit the global background baseline of the spectral data, such as the overall tilt of the spectrum or the baseline offset.

[0085] 3) The detail generation branch employs a multi-level cascaded structure to generate local peak and trough features in the spectrum. To suppress high-frequency oscillation noise that may be introduced by traditional transposed convolution, this branch uses a composite structure combining linear upsampling, reflection padding, and one-dimensional convolution. Linear upsampling is used to smoothly improve the feature map resolution; reflection padding ensures numerical continuity at both ends of the spectrum by mirroring the edge data of the feature map; and the one-dimensional convolutional layer is used to extract specific absorption peak morphology features.

[0086] As a further preferred implementation, the multi-level cascaded structure of the detail generation branch is composed of three identical basic convolutional units G1 cascaded in sequence. Each G1 unit consists of a linear upsampling layer, a reflection filling layer, a one-dimensional convolutional layer, a batch normalization layer, and a ReLU activation function cascaded in sequence. Through the cascading of the three G1 units, the feature length of the input noise vector is gradually upsampled and expanded, and then further mapped to a length that matches the target spectral dimension through a linear interpolation operation.

[0087] As a further preferred embodiment, in each G1 unit, the upsampling factor of the linear upsampling layer is 2, the kernel size of the one-dimensional convolutional layer is 7, the number of output channels is 64, 32, and 16 respectively, and the fill length of the reflection fill layer is adapted to the kernel size, with a fill length of 3.

[0088] 4) Output fusion: The baseline vector generated by the trend fitting branch and the feature vector generated by the detail generation branch are added element by element. The result is processed by the Tanh activation function to output a simulated spectrum with values ​​in the range of [-1, 1].

[0089] In order to enable the generator to learn the waveform patterns of the real spectrum, this embodiment further constructs a discriminator and performs adversarial training.

[0090] 1) Discriminator Construction: A one-dimensional convolutional discriminator is constructed to determine whether the input spectrum is real or generated. This discriminator consists of four downsampled convolutional layers (with a stride of 2), each layer is equipped with the LeakyReLU activation function and batch normalization, and finally outputs a probability value between 0 and 1.

[0091] 2) Adversarial training configuration: Training is performed using only the spectral data from the original training set (labels ignored). The Adam optimizer is used (learning rate 1×10⁻⁶). -4 (Beta1=0.5), using binary cross-entropy as the loss function. The total number of iterations is set to 2000, and the batch size is 32.

[0092] 3) Optimal Model Selection Based on Statistical Indicators: To ensure that the generated simulated spectrum is statistically closest to the real soil spectrum, the KS statistic (Kolmogorov-Smirnov Statistic) is introduced as a monitoring indicator during training. Every 20 training rounds, the cumulative distribution difference (KS distance) between the generated spectrum and the real spectrum at each wavelength point is calculated, and the generator parameters of the round with the smallest KS mean (i.e., the most similar distribution) are automatically saved as the final model.

[0093] Step S4: Construction and Validation of Physically Consistent Pseudo-Labels. Generate 300 unlabeled simulated spectra (range [-1, 1]) using the trained generator. Perform inverse transform. The simulated spectrum is then restored to the [0, 1] interval. Subsequently, the restored simulated spectrum is input into the teacher model trained in step S2 to obtain the predicted value 𝑌 as a pseudo-label, thereby establishing a logical correspondence between the simulated spectral waveform and the physicochemical values.

[0094] To verify the quality of the generated data, this embodiment tested the scheme, such as... Figure 4 As shown, it can be observed that the generated spectrum (yellow dots) and the real spectrum (blue dots) highly overlap in the distribution of the PCA principal component space, and the generated data effectively fills the sparse gaps between the real samples, proving that the generator has successfully learned the characteristic distribution law of the spectrum; as Figure 5 As shown, the simulated spectrum not only accurately reproduces the absorption peak characteristics and global baseline trend of the real data in a specific band (such as around 1400nm), but also the curve is smooth and continuous, which fully verifies the effectiveness of the dual-branch structure and reflection filling mechanism proposed in this invention.

[0095] Step S5: Density-weighted precise sampling. To address the uneven data distribution in small-sample regression, a density-weighted sampling strategy is implemented. The 300 pseudo-label value ranges are divided into 30 statistical intervals, and the number of samples N in each interval is counted. i Calculate the sampling weight for each sample. That is, the lower the density of a sample within a given interval, the higher its probability of being sampled. Based on weights Wi, random sampling without replacement was performed to select 11 key samples (approximately 8% of the original training set). For example... Figure 6 As shown, the data distribution before and after sampling was compared: the original training set (blue histogram) exhibited typical imbalance characteristics, with samples highly concentrated in the mean region. However, the key samples after screening (red dashed line) successfully avoided the peak region of dense samples and fell into the low content end (<1.5%), the high content long tail end (>5.0%), and the intermediate gap region (3.0%~5.0%) where the mean transitions to the long tail. Through this targeted supplementation, the data distribution structure of the training set was effectively balanced.

[0096] Step S6: Merge the 11 key samples selected in Step S5 with the 133 original samples to construct a mixed training set. Initialize a student model isomorphic to the teacher model (see structure). Figure 2 The method was self-trained on a mixed set. To verify the effectiveness of the micro-key sample injection strategy of this invention, comparative experiments with different injection amounts were set up, and the results are shown in Table 1.

[0097] Table 1. Comparison of model prediction performance under different numbers of simulated sample injections

[0098]

[0099] As shown in Table 1, the model performance initially increases and then decreases with the number of samples injected. When the number of samples injected is 11, the test set R... 2 The peak value reached 0.8775, and the RMSE dropped to its lowest point, proving that the small amount of samples effectively filled the distribution gaps in the sparse region. However, as the injection volume increased, the performance began to decline; when injecting 60 and all 300 simulated samples, the performance was even worse than the unenhanced baseline group due to the introduction of a large number of redundant samples and potential label noise. The experiment confirms that using a density-weighted strategy to select key samples of approximately 5% to 15% of the original sample size for small-scale filling is the best solution to balance data quality and quantity and improve model accuracy.

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

[0101] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

[0102] This invention is not limited to the preferred embodiment described above. Anyone inspired by this invention can derive other forms of small-sample spectral regression prediction methods based on generative self-training and density-weighted sampling. All equivalent changes and modifications made within the scope of the claims of this invention shall fall within the scope of this invention.

Claims

1. A small-sample spectral regression prediction method based on generative self-training and density-weighted sampling, characterized in that, Includes the following steps: Obtain the original spectral data and corresponding true values ​​of physicochemical components of the sample to be tested, and construct the original training set; A deep learning regression network is constructed as a teacher model. The teacher model is trained under supervision using the original training set to establish a nonlinear mapping relationship between spectral features and the true values ​​of physicochemical components. An unconditional generative adversarial network is constructed, and its generator is trained using only the spectral data in the original training set, so that the generator learns the waveform features of the spectral data. The trained generator is used to generate a batch of unlabeled simulated spectra. The simulated spectra are then input into the trained teacher model for prediction, and the prediction output is used as a pseudo-label for the simulated spectra. Numerical distribution statistics are performed on the obtained pseudo-labels to identify sparse intervals in the sample distribution. Sampling weights that are negatively correlated with local sample density are constructed. Key samples located in the sparse intervals are screened from the simulated spectrum based on the sampling weights. The original training set is mixed with the selected key samples to construct a hybrid training set. The student model is then trained using the hybrid training set to obtain the final spectral regression prediction model.

2. The small-sample spectral regression prediction method based on generative self-training and density-weighted sampling according to claim 1, characterized in that: The generator adopts a trend-detail dual-branch parallel topology, which includes a global trend branch, a local detail branch, and an output fusion module. The global trend branch employs a linear fully connected layer to map the input noise vector into a trend vector with the same spectral dimension as the target. The local detail branch employs a structure of cascaded linear upsampling layer, reflection filling layer, and one-dimensional convolutional layer to map the input noise vector into a detail vector containing local absorption peak features. The output fusion module is used to superimpose the trend vector and the detail vector element by element and output the final simulated spectrum through an activation function.

3. The small-sample spectral regression prediction method based on generative self-training and density-weighted sampling according to claim 1, characterized in that: The process of constructing the sampling weights includes: dividing the value range of the pseudo-labels into K statistical intervals, where K is a positive integer; and counting the number N samples falling into the i-th statistical interval. i According to the formula Determine the sampling weight W of the samples within the i-th statistical interval. i , where ε is the smoothing coefficient.

4. The small-sample spectral regression prediction method based on generative self-training and density-weighted sampling according to claim 1, characterized in that: The number of key samples selected is 5% to 15% of the original training set sample size.

5. The small-sample spectral regression prediction method based on generative self-training and density-weighted sampling according to claim 1, characterized in that: The student model and the teacher model are isomorphic deep learning regression networks, and both the teacher model and the student model use one-dimensional convolutional neural networks.

6. The small-sample spectral regression prediction method based on generative self-training and density-weighted sampling according to claim 1, characterized in that: It also includes data preprocessing and numerical adaptation steps: Z-Score standardization is performed on the true values ​​of physicochemical components so that the standardized true values ​​of physicochemical components follow a standard normal distribution with a mean of 0 and a variance of 1; before training the unconditional generative adversarial network, the spectral data used for training is mapped to the [-1,1] interval; after generating the simulated spectrum, the simulated spectrum is inversely mapped back to the original numerical domain and then input into the teacher model for pseudo-label prediction.

7. The small-sample spectral regression prediction method based on generative self-training and density-weighted sampling according to claim 1, characterized in that: When training the unconditional generative adversarial network, the Kolmogorov-Smirnov statistic is used as the selection index for the generator. Every preset iteration, the distribution difference between the generated spectrum and the real spectrum is calculated, and the generator weight with the smallest distribution difference is saved.

8. The small-sample spectral regression prediction method based on generative self-training and density-weighted sampling according to claim 1, characterized in that: The simulated spectrum is randomly sampled without replacement based on the sampling weights.

9. The small-sample spectral regression prediction method based on generative self-training and density-weighted sampling according to claim 1, characterized in that: The original spectral data is near-infrared spectral data.

10. A small-sample spectral regression prediction device, characterized in that, The method includes a processor and a memory, the memory storing a computer program, and when the processor executes the computer program, it implements the small-sample spectral regression prediction method based on generative self-training and density-weighted sampling as described in any one of claims 1 to 9.