Cotton fiber quality multi-parameter hyperspectral inversion method based on improved one-dimensional convolutional neural network
An improved one-dimensional convolutional neural network, employing an adaptive calibration operator, multi-scale dilated convolution, and a spatial-spectral dual attention mechanism, solves the problems of adaptability and feature capture in cotton fiber quality detection, achieving high-precision, logically consistent multi-parameter inversion.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-27
- Publication Date
- 2026-04-03
AI Technical Summary
In existing technologies, the independent spectral preprocessing and inversion model result in poor adaptability, insufficient long-distance feature capture capability, and lack of physical correlation between multiple indicators, which limits the accuracy of cotton fiber quality detection.
An adaptive calibration operator is constructed for dynamic baseline compensation. An improved one-dimensional convolutional neural network is combined with multi-scale dilated convolutional units and spatial-spectral dual attention mechanism. A physical constraint interaction matrix and a task consistency composite loss function are introduced to achieve end-to-end collaborative optimization of the signal calibration and inversion model.
It achieves high-precision and high-consistency non-destructive testing of cotton fiber quality, overcomes interference from ambient light fluctuations and equipment noise, enhances the robustness of the model in complex backgrounds, and ensures logically consistent prediction results among multiple indicators.
Smart Images

Figure CN121786338A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spectral detection technology, and in particular to a hyperspectral inversion method for multi-parameter cotton fiber quality based on an improved one-dimensional convolutional neural network. Background Technology
[0002] The main quality indicators of cotton fibers include micronaire value, specific strength, and elongation. These indicators are the core basis for evaluating cotton grade and textile value. Currently, the industry commonly uses large-capacity fiber testers for physical testing. Although this method has high accuracy, it has limitations such as expensive equipment, long testing time, and some destructiveness to samples. With the development of hyperspectral imaging technology, using near-infrared spectroscopy combined with chemometrics for quality prediction has become a research hotspot.
[0003] In recent years, deep learning techniques, especially convolutional neural networks, have begun to be applied in the field of spectral analysis. The technological trend is shifting from single-scale feature extraction to multi-scale fusion, and gradually evolving from single-task prediction to simultaneous multi-parameter inversion. By introducing an attention mechanism into the network, the model can better identify specific bands related to the vibration of functional groups inside cotton. However, in practical applications, complex hyperspectral data places higher demands on the feature extraction depth and robustness of the model.
[0004] While existing technologies have made progress in improving detection speed, they still have many shortcomings. First, the spectral preprocessing and inversion model are independent of each other, making it impossible for the preprocessing process to adaptively adjust to fluctuations in the dataset. Second, the one-dimensional convolutional model has limited ability to capture long-range spectral features and is unable to cope with small distortions in spectral curves under complex environments. Finally, existing methods ignore the inherent logical relationships between various physical indicators of cotton, which may lead to logical conflicts in the prediction biases of different indicators when multiple parameters are predicted in parallel. Summary of the Invention
[0005] To overcome the shortcomings of existing technologies, the purpose of this invention is to provide a multi-parameter hyperspectral inversion method for cotton fiber quality based on an improved one-dimensional convolutional neural network. This invention solves the problems of poor adaptability of spectral preprocessing, insufficient long-distance feature capture capability, and limited inversion accuracy caused by the lack of physical correlation between multiple indicators in existing technologies.
[0006] To achieve the above objectives, the present invention provides the following solution: A multi-parameter hyperspectral inversion method for cotton fiber quality based on an improved one-dimensional convolutional neural network includes: The raw full-band hyperspectral data of the cotton fiber sample to be tested is collected based on a preset standard light source environment, and the physicochemical true value of each cotton fiber sample to be tested is obtained simultaneously. The raw full-band hyperspectral data is associated with the corresponding physicochemical true value to construct a multi-parameter standard sample library. The physicochemical true value includes: micronaire value, specific strength and elongation. An adaptive calibration operator is constructed based on the multi-parameter standard sample library, and the learnable gain weight and offset weight in the adaptive calibration operator are used to perform dynamic baseline compensation on the original full-band hyperspectral data to generate calibrated characteristic spectral data. The characteristic spectral data are subjected to smoothing filtering to obtain a preprocessed feature vector; An improved one-dimensional convolutional neural network is constructed, which sequentially includes: a multi-scale dilated convolutional unit, a spatial-spectral dual attention unit, and a multi-task decoupling output layer; The preprocessed feature vector is input into the improved one-dimensional convolutional neural network to obtain the predicted values of micronaire value, specific strength, and elongation. A composite loss function is calculated based on the predicted micronaire value, the predicted specific strength, and the predicted elongation, along with the corresponding physicochemical true values. The improved one-dimensional convolutional neural network is backpropagated and trained and its parameters are optimized according to the composite loss function to obtain the trained inversion model. The measured spectral data of the sample to be tested are collected and input into the trained inversion model to obtain the detection results of the micronaire value, specific strength and elongation of the sample to be tested.
[0007] The present invention discloses the following technical effects: This invention provides a multi-parameter hyperspectral inversion method for cotton fiber quality based on an improved one-dimensional convolutional neural network. Firstly, by constructing an adaptive calibration operator, the traditional static preprocessing is transformed into a learnable dynamic baseline compensation process, achieving end-to-end collaborative optimization of signal calibration and the inversion model, effectively overcoming interference from ambient light fluctuations and equipment noise. Secondly, addressing the insufficient ability of one-dimensional convolution to capture long-distance features, this invention utilizes multi-scale dilated convolutional units combined with a spatial-spectral dual attention mechanism to extract local fine textures and global contour features across the entire spectrum in parallel, adaptively focusing on key bands related to the vibration of hydrogen-containing groups in cellulose, significantly enhancing the model's robustness to minor spectral distortions in complex backgrounds. Finally, addressing the problem of inversion logic conflicts caused by the lack of physical correlation between multiple indicators, this invention forces the model to learn the inherent physical coupling law between micronaire value, specific strength, and elongation through a physical constraint interaction matrix and a task consistency composite loss function. The correlation between tasks is used to collaboratively correct the prediction results, thereby achieving high-precision, high-consistency, and logically self-consistent online non-destructive testing of cotton fiber quality. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0009] Figure 1 This invention provides a method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network. Detailed Implementation
[0010] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0012] like Figure 1 As shown, this invention provides a multi-parameter hyperspectral inversion method for cotton fiber quality based on an improved one-dimensional convolutional neural network, comprising: Step 100: Collect raw full-band hyperspectral data of the cotton fiber sample to be tested based on a preset standard light source environment, and simultaneously obtain the physicochemical true value of each cotton fiber sample to be tested. Associate the raw full-band hyperspectral data with the corresponding physicochemical true value to construct a multi-parameter standard sample library. The physicochemical true value includes: micronaire value, specific strength and elongation. Step 200: Construct an adaptive calibration operator based on the multi-parameter standard sample library, and use the learnable gain weight and offset weight in the adaptive calibration operator to perform dynamic baseline compensation on the original full-band hyperspectral data to generate calibrated characteristic spectral data; Step 300: Perform smoothing filtering on the feature spectral data to obtain a preprocessed feature vector; Step 400: Construct an improved one-dimensional convolutional neural network, which sequentially includes: a multi-scale dilated convolutional unit, a spatial-spectral dual attention unit, and a multi-task decoupling output layer; Step 500: Input the preprocessed feature vector into the improved one-dimensional convolutional neural network to obtain the predicted values of micronaire value, specific strength, and elongation. Step 600: Calculate the composite loss function based on the predicted micronaire value, the predicted specific strength, the predicted elongation, and the corresponding physicochemical true values; Step 700: Perform backpropagation training and parameter optimization on the improved one-dimensional convolutional neural network according to the composite loss function to obtain the trained inversion model; Step 800: Collect the measured spectral data of the sample to be tested and input it into the trained inversion model to obtain the detection results of the micronaire value, specific strength and elongation of the sample to be tested.
[0013] Furthermore, the specific implementation process of step 100 is as follows: This embodiment first constructs a high-standard spectral acquisition environment to ensure the physical consistency of the data. A full-band halogen lamp (50W) is selected as a stable light source, and it is preheated for a certain period of time before acquisition to eliminate the thermal drift effect of the light source and ensure continuous steady-state illumination. Before data acquisition, this embodiment strictly implements the black and white board calibration process (performed every 10 minutes), acquiring the spectral radiance of a PTFE standard white board with a reflectivity close to 100%, as well as the dark current noise data after the lens cap is closed. Using this white board data and dark current data, the raw light intensity signal acquired later is converted into dimensionless spectral reflectance data, thereby eliminating the influence of sensor sensitivity differences and dark current noise on spectral characteristics. In the sample preparation stage, this embodiment evenly lays the cotton fiber sample to be tested on the stage, controlling the layer thickness to avoid spectral leakage from the background board, and uses the push-broom scanning mode of the hyperspectral imager to acquire a three-dimensional data cube containing spatial and spectral dimensions. Then, the central region of the sample is selected as the region of interest, and the average spectrum is calculated as the raw full-band hyperspectral data of the sample.
[0014] In this embodiment, after completing non-destructive spectral acquisition, the physical and chemical properties of the same batch of cotton fiber samples are immediately measured to ensure a one-to-one correspondence between the spectral data and the true physicochemical values. This embodiment utilizes a high-capacity fiber tester to perform destructive testing on the spectrally scanned cotton samples, acquiring micronaire value data, breaking strength data, and breaking elongation data. To construct a high-quality dataset for deep learning, this embodiment establishes a data indexing mechanism, associating the original full-band hyperspectral data of each sample with the corresponding true values of the three physicochemical properties, forming original sample pairs. During this process, this embodiment pays special attention to maintaining the uniqueness and traceability of sample numbers to prevent labeling errors due to sample confusion, ensuring the physical authenticity of the input features and output labels in subsequent supervised learning tasks.
[0015] This embodiment further introduces statistical methods to clean the original sample library, removing outlier data caused by operational errors or sample contamination. This embodiment uses the Mahalanobis distance algorithm to assess the outlier nature of the spectral data. This algorithm fully considers the covariance relationship between hyperspectral bands and can identify outliers in multidimensional space more accurately than Euclidean distance. Specifically, this embodiment calculates the mean vector and the inverse of the covariance matrix of all sample spectral data, and then solves for the Mahalanobis distance value from each sample to the center of the dataset. This embodiment sets a distance threshold based on the chi-square distribution criterion, and judges samples with Mahalanobis distance values exceeding this threshold as outlier spectral samples, completely removing them and their corresponding physicochemical ground truth values from the dataset. Finally, this embodiment combines the remaining cleaned normal spectral data with the corresponding physicochemical ground truth values to form the final multi-parameter standard sample library, providing a high signal-to-noise ratio and uniformly distributed data foundation for subsequent model training.
[0016] Furthermore, the specific implementation process of step 200 is as follows: This embodiment abandons the fixed-parameter preprocessing method in traditional chemometrics. Instead, it constructs an adaptive calibration operator that can be embedded in the front end of a deep neural network based on the band characteristics of the original full-band hyperspectral data. This embodiment first identifies the total number of band dimensions in the input spectral data and initializes two independent learnable parameter vectors within the operator accordingly: a gain parameter vector and an offset parameter vector. This embodiment strictly controls the dimensions of these two parameter vectors to be completely consistent with the band dimensions of the original spectrum, ensuring that each spectral channel has one and only one set of corresponding gain and offset coefficients for dedicated adjustment, thus laying the structural foundation for achieving refined spectral feature alignment.
[0017] In the data processing flow, this embodiment inputs the acquired raw full-band hyperspectral data into the adaptive calibration operator and performs a channel-dimensional linear transformation operation. First, this embodiment performs a multiplication correction step, performing an element-wise dot product (Hadamard product) operation on the raw spectral data and the gain parameter vector. This scales the spectral response intensity of different bands using the gain coefficient, generating a gain correction intermediate vector to eliminate multiplicative scattering intensity fluctuations caused by differences in sample surface smoothness. Subsequently, this embodiment performs an additive compensation step, adding the gain correction intermediate vector element-wise to the offset parameter vector, shifting and correcting the spectral baseline to generate a linearly compensated spectral vector.
[0018] In this embodiment, the aforementioned linear compensation spectral vector is directly output as the calibrated feature spectral data to subsequent network layers, and the adaptive calibration operator participates in the end-to-end training of the entire model. During backpropagation, this embodiment utilizes the gradient information generated by the composite loss function and dynamically updates the specific values of the gain parameter vector and offset parameter vector using the gradient descent algorithm. Through this mechanism, this embodiment enables the calibration parameters to continuously approach the optimal solution during training, automatically learning the best baseline compensation strategy and scattering correction strategy for the current detection environment and cotton fiber characteristics, thereby achieving intelligent suppression of hyperspectral data noise without manual intervention.
[0019] Furthermore, the specific implementation process of step 300 is as follows: This embodiment employs the Savitzky-Golay convolutional smoothing algorithm to perform secondary denoising on the adaptively calibrated spectral data. Its core objective is to filter out high-frequency random noise while preserving, to the greatest extent possible, the morphological features of the cotton fiber spectral curve, such as peaks, troughs, and widths. This embodiment first scientifically sets two key hyperparameters of the filter based on the signal-to-noise ratio distribution characteristics of the characteristic spectral data: the filter window width parameter and the polynomial fitting order parameter. This embodiment typically sets the filter window width parameter to an odd number to ensure that the sliding window has a unique center band point. The polynomial fitting order is flexibly adjusted according to the spectral resolution to prevent signal detail loss due to an excessively low order or Runge phenomenon introduced by an excessively high order, thereby seeking the optimal balance between smoothing effect and signal fidelity.
[0020] In the specific filtering operation, this embodiment constructs a fixed-size sliding sampling window on the spectral dimension of the feature spectral data based on a set filtering window width parameter. The sliding sampling window is then controlled to move point-by-point from the starting band to the ending band of the spectrum with a single-band step size. In each movement step, this embodiment extracts the spectral response values within the window's coverage area, generating a series of continuous local band data subsets. For each extracted local band data subset, this embodiment constructs a local fitting polynomial using the least squares method. By minimizing the mean square error between all data points within the window and the polynomial surface, the coefficients of the polynomial are solved, and the determined polynomial is used to accurately calculate the smoothed fitting value corresponding to the current center position of the sliding sampling window.
[0021] This embodiment utilizes the smoothed fitting values calculated above to sequentially replace the original noisy values at the corresponding center positions of the feature spectral data, completing the point-by-point reconstruction of the entire band data. For the spectral edge bands involved in the sliding process, this embodiment employs mirror filling or nearest neighbor filling strategies for boundary processing to maintain the computability of the data dimensions. Finally, this embodiment arranges all replaced band values strictly according to the physical order of wavelength from shortest to longest, generating a preprocessed feature vector with uniform dimensions and a significantly improved signal-to-noise ratio. This vector is fed as a high-purity input feature into the subsequent one-dimensional convolutional neural network, effectively reducing the interference of noise on the model's feature extraction.
[0022] Furthermore, the specific implementation process of steps 400-500 is as follows: The improved one-dimensional convolutional neural network constructed in this embodiment adopts a three-segment deep architecture with sequential connections. First, a multi-scale dilated convolutional unit is deployed at the network front end. This unit contains multiple sets of one-dimensional convolutional kernels with different dilation rates arranged in parallel. This embodiment utilizes convolutional branches with small dilation rates to capture subtle local features at high frequencies in the spectral curve, such as minute absorption peak shifts; simultaneously, it utilizes convolutional branches with large dilation rates to cover a wider spectral range and extract low-frequency global contour features. Subsequently, this embodiment performs deep fusion of the feature maps at different scales through channel concatenation, generating a multi-scale feature map containing rich frequency domain information, thereby significantly expanding the effective receptive field of the model without increasing the network depth.
[0023] This embodiment embeds a spatial-spectral dual attention unit after the feature fusion layer to simulate the focusing mechanism of human vision, further enhancing the discriminative power of features. This unit includes parallel channel attention modules and spatial attention modules. In the channel dimension, this embodiment automatically learns the importance weights of each spectral channel through global average pooling and a multilayer perceptron, assigning high weights to feature channels highly correlated with the vibrations of hydrogen-containing groups in cellulose, while suppressing irrelevant background noise channels. In the spatial dimension, this embodiment scans the spectral axes of the feature map through one-dimensional convolution to generate a spatial attention map to locate key spectral morphological regions. This embodiment performs element-wise multiplication of the calculated channel weights and spatial weights with the input multi-scale feature map, adaptively recalibrating the feature signal to generate a highly saliency-enhanced feature map, ensuring that the network concentrates computational resources on the most informative spectral regions.
[0024] This embodiment incorporates a multi-task decoupled output layer at the network's end to achieve collaborative inversion of three quality indicators for cotton fibers. First, the enhanced feature map is input into a physical constraint interaction matrix, a learnable linear transformation layer whose parameters are constrained by physical consistency during training. This matrix forces the feature space to learn the intrinsic coupling relationship between micronaire value, specific strength, and elongation, generating a constraint feature vector that implicitly contains prior correlations between the indicators. Subsequently, this constraint feature vector is branched into three parallel, independent fully connected branches. Each branch consists of several fully connected layers and nonlinear activation functions, each focusing on mapping high-dimensional features to scalar values of specific physical indicators. Finally, these three branches output predicted micronaire value, specific strength, and elongation in parallel, achieving multi-objective decoupled prediction within a unified feature space.
[0025] Specifically, to further clarify the role of the task consistency constraint in verifying biological rationality in actual testing, this embodiment provides a detailed explanation in conjunction with the physiological characteristics of cotton fibers. In the biological statistical laws of cotton fibers, the various quality indicators do not exist independently but are limited by the developmental degree of the fiber cell walls. For example, the micronaire value comprehensively reflects the maturity and fineness of cotton. Generally, an excessively high micronaire value often indicates excessively coarse fibers, which to some extent limits the cohesion of the fiber bundle, resulting in a statistically negative correlation between the breaking strength and the fiber's breaking strength. If the inversion model only pursues numerical regression accuracy while ignoring this physical law, it is highly likely to output abnormal prediction results of "high micronaire value and extremely high breaking strength" on certain extreme samples. Such results are not biologically valid. This embodiment introduces a constraint mechanism based on the true correlation matrix, solidifying the above negative correlation logic into the loss function. When the model attempts to generate prediction values that violate the above negative correlation law during training, i.e., the distance between the predicted correlation matrix and the true correlation matrix increases, the task consistency constraint will immediately generate a high gradient penalty value. This penalty value forces a backpropagation adjustment of the network weights, compelling the model to pull the prediction results back to a reasonable range that conforms to the physiological characteristics of cotton. This effectively avoids logical errors that violate biological common sense and ensures the physical interpretability of the final detection results.
[0026] Furthermore, the specific implementation process of step 600 is as follows: This embodiment first calculates the regression prediction error for each of the three independent quality indicators of cotton fiber to quantify the model's fitting accuracy on a single task. This embodiment compares the predicted micronaire value, specific strength, and elongation of all samples in the current training batch with their corresponding true physicochemical values one by one. This embodiment uses a mean squared error algorithm to calculate the first mean squared error for the micronaire value branch, the second mean squared error for the specific strength branch, and the third mean squared error for the elongation branch. This calculation process not only measures the Euclidean distance between the predicted and true values but also amplifies the penalty for large error samples through squaring, prompting the model to prioritize those difficult-to-predict sample points.
[0027] This embodiment further constructs a task consistency constraint term, aiming to force the model to learn the inherent statistical correlations between various physical indicators and prevent logical conflicts caused by task competition during multi-task learning. This embodiment utilizes the Pearson correlation coefficient algorithm to calculate the predicted correlation matrix between the micronaire value, specific strength, and elongation based on the predicted data of the current batch, and simultaneously calculates the corresponding true correlation matrix based on the true data of the current batch. Subsequently, this embodiment calculates the matrix norm distance between these two matrices and determines this distance as the constraint value of the task consistency constraint term. Through this mechanism, this embodiment ensures that the model not only numerically approximates the true values but also maintains consistency with objective physical laws in the interrelationships between multiple indicators.
[0028] This embodiment finally utilizes a weighted fusion strategy to integrate the aforementioned error components into a unified scalar index, namely the composite loss function, to guide subsequent gradient calculations. Based on preset task importance, this embodiment obtains corresponding task balancing weight coefficients and performs a weighted summation of the aforementioned first, second, and third mean squared error values to obtain the total regression loss. Simultaneously, this embodiment introduces constraint penalty coefficients to weight the constraint values of the task consistency constraint term and adds them to the total regression loss. By dynamically adjusting these weight coefficients, this embodiment can balance the relationship between regression accuracy and physical consistency at different stages of model training, ensuring that the model converges to the global optimum.
[0029] Specifically, the calculation expression for the composite loss function is as follows: ; in, The composite loss function; The number of samples in a single training batch of the multi-parameter standard sample library; For the index identifier of the detection task, where, Represents the Macron value. Indicates specific strength. Indicates elongation; This refers to the task balance weight coefficient corresponding to the k-th detection task; The physicochemical truth value of the i-th sample on the k-th detection task; The predicted value for the i-th sample on the k-th detection task; The constraint penalty coefficient; The prediction correlation matrix is calculated based on the prediction values of the current batch; The true correlation matrix is calculated based on the physicochemical truth values of the current batch. This refers to the Frobenius norm operation of a matrix.
[0030] Specifically, this embodiment employs a physical constraint-driven composite error calculation mechanism to quantify the model's predictive performance. This mechanism first calculates the basic regression error components, aiming to measure the model's fit to specific numerical values of cotton fiber quality. Specifically, for each batch of samples input in a single training iteration, this embodiment calculates the difference between the predicted results of three independent tasks—micronaire value, specific strength, and elongation—and their corresponding physicochemical true values, and squares this difference to obtain the single-sample error. Subsequently, this embodiment accumulates the single-sample errors of all samples within the batch and calculates the average to obtain the mean squared error for each task. To eliminate the numerical magnitude differences caused by different units of measurement for different physical indicators, this embodiment introduces a task balancing weight coefficient to weight the mean squared errors of the three tasks, ensuring that the contribution of each task to the total loss is of the same order of magnitude, preventing the model from being overly biased towards fitting indicators with larger numerical values.
[0031] Building upon the regression error, this embodiment further introduces a task consistency constraint to penalize prediction behaviors that violate physical laws. Based on the prediction data of all samples within the current batch, this embodiment calculates a prediction correlation matrix reflecting the interdependence among the three indicators, and simultaneously calculates the true correlation matrix based on the corresponding ground truth data. Subsequently, this embodiment uses matrix norm operations, specifically the Frobenius norm, to quantify the Euclidean distance between these two matrices. This distance represents the degree of deviation of the model from the inherent physical logic of cotton quality. This embodiment introduces a constraint penalty coefficient to weight this distance value, thereby adjusting the importance of the physical consistency constraint in the overall optimization objective. Finally, this embodiment sums the weighted regression error component with the weighted physical constraint component to obtain the composite loss function used to guide backpropagation.
[0032] The number of samples in a single training batch refers to the data scale processed by the model in one forward propagation, usually set to 32, 64, or 128 depending on the memory size. A larger batch size helps to calculate a more stable correlation matrix. The index identifier of the detection task is used to distinguish which quality indicator is being calculated. The task balancing weight coefficient is a pre-set hyperparameter, usually set to 1 or dynamically adjusted according to the inverse variance of each indicator. Its function is to balance the gradient flow of multi-task learning. The constraint penalty coefficient is a regularization parameter used to control the strength of physical constraints. Its value is usually between 0.01 and 0.5. Too large a value may lead to underfitting of the model, while too small a value will not be able to effectively utilize physical priors. The predicted correlation matrix and the true correlation matrix are 3-order square matrices calculated by the Pearson correlation coefficient formula. Their diagonal elements are 1, and the off-diagonal elements represent the degree of linear correlation between different quality indicators.
[0033] Furthermore, the specific implementation process of step 700 is as follows: In this embodiment, after completing forward propagation and calculating the composite loss function, the backpropagation procedure is immediately initiated to calculate the adjustment direction of the network parameters. This embodiment utilizes the chain rule of differentiation, backtracking layer by layer from the output layer to the input layer to accurately calculate the partial derivative of the composite loss function with respect to each weight and bias parameter within the improved one-dimensional convolutional neural network. This embodiment treats these partial derivative values as the rate of change of the loss function in the parameter space and arranges and concatenates them according to the index order of the network parameters to construct a high-dimensional gradient descent vector. This vector indicates the direction in which the loss function decreases most rapidly under the current parameter state, providing precise mathematical guidance for subsequent parameter updates.
[0034] This embodiment employs an adaptive moment estimation optimizer to process the aforementioned gradient descent vector, overcoming the limitations of traditional stochastic gradient descent algorithms when handling sparse gradients or non-stationary objective functions. The gradient descent vector is input into the optimizer, which first calculates the first and second moment estimates of the gradient based on an exponentially weighted moving average algorithm of historical gradients. This dynamically evaluates the update momentum and adaptive learning rate for each parameter. Subsequently, this embodiment combines these two moment estimates with a preset learning rate parameter, generating a parameter update step size for each specific parameter through bias correction and division operations. This mechanism automatically reduces the step size for frequently updated parameters and increases the step size for sparsely updated parameters, thereby accelerating the model's convergence process.
[0035] This embodiment utilizes the calculated parameter update step size to perform a subtraction iterative update operation on the current weight and bias parameters in the network, that is, subtracting the corresponding update step size from the current parameter value, thereby completing a single backpropagation training. After each parameter update, this embodiment monitors the current composite loss function in real time and compares it with a preset convergence threshold. If the result is negative, meaning the loss value has not yet decreased to the ideal range, this embodiment will retrieve the next batch of data from the multi-parameter standard sample library and continue the cyclic training process of forward and backpropagation; if the result is positive, meaning the model has reached the expected accuracy requirements, this embodiment will immediately stop training, freeze all currently updated weight and bias parameters, solidify and encapsulate them, and finally generate the trained inversion model for online detection.
[0036] Specifically, this embodiment first initiates the initialization phase of the error backpropagation procedure. Based on the composite loss function calculated through forward propagation, it accurately calculates the output error sensitivity term at the end of the multi-task decoupling output layer. This embodiment utilizes the principle of differentiation to solve for the partial derivatives of the composite loss function with respect to the final output value of the network for the three output nodes: Macron value, specific strength, and elongation. This output error sensitivity term not only includes the regression residual information between the predicted and true values but also incorporates the correction gradient of the task consistency constraint term on the physical correlation of the prediction results, thereby ensuring that the subsequently propagated error signal can simultaneously guide the model to optimize both numerical accuracy and physical logic.
[0037] During the error propagation phase, this embodiment strictly follows the reverse path of signal flow, sequentially propagating the aforementioned output error-sensitive terms back through each core component of the network. First, this embodiment converges the gradient flows from three parallel, independent fully connected branches and reverses them through the physical constraint interaction matrix. The transpose of this matrix is used to decouple the error signal and map it back to the high-dimensional feature space. Subsequently, this embodiment feeds the error signal into the spatial-spectral dual attention unit, weighting and modulating the gradient based on the channel weight map and spatial weight map generated during forward propagation. This enables the model to identify the feature regions that contribute the most to the error. Finally, this embodiment reverse-maps the modulated error signal to the multi-scale dilated convolutional unit, using deconvolution logic to distribute it to convolutional kernel branches with different dilation rates, thereby generating the layer-level error terms corresponding to each layer of the network.
[0038] In the parameter gradient calculation and vectorization stage, this embodiment uses the chain rule to accurately calculate the gradient of all trainable parameters within each calculated layer error term. Based on the output error sensitive term, this embodiment uses the backpropagation algorithm to calculate the gradient information of the parameters of each layer of the network, updates the model weights, and solves for the weight partial derivatives of the weight parameters and the bias partial derivatives of the bias parameters. To adapt to the subsequent global optimization algorithm, this embodiment does not retain the original tensor structure of the gradient. Instead, it flattens and vectorizes all calculated weight partial derivatives and bias partial derivatives according to the preset index order of the weight parameters and bias parameters in the improved one-dimensional convolutional neural network. This process ultimately generates a high-dimensional gradient descent vector, which completely encapsulates the update direction information of the entire network parameter space, providing standardized input data for the adaptive moment estimation optimizer.
[0039] Specifically, the expression for the output error sensitivity term is: ; in, This refers to the output error sensitive term; This is a weight vector matrix composed of the task balancing weight coefficients; This is the Hadamard product operator; This is a matrix of predicted values for all the samples to be tested in the current batch; This is the physicochemical truth matrix of all the samples to be tested in the current batch; This is the gradient contribution of the task consistency constraint term with respect to the prediction matrix.
[0040] More specifically, in this embodiment, when calculating the initial gradient signal used for backpropagation, i.e., the output error sensitive term, it is decomposed into two parts: the regression error gradient component and the physical constraint gradient component, which are then superimposed for calculation. First, the regression error gradient component is calculated. This process, based on the derivative rule, calculates the difference matrix between the predicted value matrix and the physicochemical truth matrix of all samples in the current batch. This difference matrix is then multiplied by the pre-constructed weight vector matrix using a Hadamard product (elemental multiplication). The result is then multiplied by 2 and divided by the number of samples in the current batch to obtain the gradient direction reflecting the numerical fitting deviation. Simultaneously, the physical constraint gradient component is calculated. This process uses the chain rule to solve for the partial derivative of the task consistency constraint term with respect to the predicted value matrix, obtaining the gradient contribution term. This gradient contribution term is then multiplied by twice the constraint penalty coefficient. Finally, the regression error gradient component and the physical constraint gradient component are added element-wise to generate the final output error sensitive term.
[0041] The output error sensitivity term is a gradient matrix with the same dimension as the predicted value matrix, used to initiate the backpropagation process. The weight vector matrix is an extension of the aforementioned task balancing weight coefficients, with the same dimension as the predicted value matrix. For example, when the batch size is 32 and the number of tasks is 3, this matrix is 32 rows and 3 columns, with each column filled with the corresponding task weight coefficient (e.g., the Macron value weight is set to 1.0), used to balance the learning rate of different tasks at the gradient level. The Hadamard product operator refers to the mathematical operation of multiplying corresponding elements between matrices. The predicted value matrix and the physicochemical truth matrix of all samples to be tested in the current batch are both N rows and 3 columns of real number matrices, storing the model output value and the laboratory test truth value, respectively. The physical meaning of the gradient contribution term is "the mathematical direction in which the predicted value should be adjusted in order to make the correlation matrix between the predicted values approximate the correlation matrix of the truth values," and its value is obtained by differentiating the Frobenius norm through the automatic differentiation engine. The constraint penalty coefficient is consistent with the aforementioned definition, for example, taking a value of 0.1, used to control the correction magnitude of the physical constraints on the total gradient. All numerical calculations use floating-point precision, and the batch sample size is typically 32, 64, or 128.
[0042] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0043] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A hyperspectral inversion method for multiple parameters of cotton fiber quality based on an improved one-dimensional convolutional neural network, characterized in that, include: The raw full-band hyperspectral data of the cotton fiber sample to be tested is collected based on a preset standard light source environment, and the physicochemical true value of each cotton fiber sample to be tested is obtained simultaneously. The raw full-band hyperspectral data is associated with the corresponding physicochemical true value to construct a multi-parameter standard sample library. The physicochemical true value includes: micronaire value, specific strength and elongation. An adaptive calibration operator is constructed based on the multi-parameter standard sample library, and the learnable gain weight and offset weight in the adaptive calibration operator are used to perform dynamic baseline compensation on the original full-band hyperspectral data to generate calibrated characteristic spectral data. The characteristic spectral data are subjected to smoothing filtering to obtain a preprocessed feature vector; An improved one-dimensional convolutional neural network is constructed, which sequentially includes: a multi-scale dilated convolutional unit, a spatial-spectral dual attention unit, and a multi-task decoupling output layer; The preprocessed feature vector is input into the improved one-dimensional convolutional neural network to obtain the predicted values of micronaire value, specific strength, and elongation. Calculate the composite loss function that includes regression error and physical constraint consistency error, and based on the composite loss function, perform reverse update on the network parameters of the improved one-dimensional convolutional neural network to obtain the trained inversion model; The measured spectral data of the sample to be tested are collected and input into the trained inversion model to obtain the detection results of the micronaire value, specific strength and elongation of the sample to be tested.
2. The method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network according to claim 1, characterized in that, The method involves acquiring raw full-band hyperspectral data of the cotton fiber samples under test based on a preset standard light source environment, and simultaneously obtaining the physicochemical true values of each cotton fiber sample. The raw full-band hyperspectral data is then correlated with the corresponding physicochemical true values to construct a multi-parameter standard sample library, including: Start the preset standard light source box and hyperspectral imager, use the full-band halogen lamp in the standard light source box to provide steady-state illumination inside the standard light source box, and perform black and white card calibration on the hyperspectral imager to obtain the calibrated imaging state; The cotton fiber sample to be tested is laid flat on the stage inside the standard light source box, and the hyperspectral imager in the calibrated imaging state performs a push-broom scan on the cotton fiber sample to obtain the original full-band hyperspectral data. The cotton fiber sample to be tested was subjected to destructive physical testing using a large-capacity fiber tester. The micronaire value, breaking strength, and breaking elongation were measured respectively, and the micronaire value, breaking strength, and breaking elongation were combined to form the physicochemical true value. The abnormal spectral samples in the original full-band hyperspectral data are calculated using the Mahalanobis distance algorithm. The abnormal spectral samples and their corresponding physicochemical true values are removed. The remaining original full-band hyperspectral data are then mapped and bound one-to-one with the corresponding physicochemical true values to generate the multi-parameter standard sample library.
3. The method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network according to claim 1, characterized in that, The step of constructing an adaptive calibration operator based on the multi-parameter standard sample library, and using the learnable gain weight and offset weight in the adaptive calibration operator to perform dynamic baseline compensation on the original full-band hyperspectral data to generate calibrated characteristic spectral data includes: The adaptive calibration operator is constructed based on the band dimensions of the original full-band hyperspectral data, and the gain parameter vector and offset parameter vector are initialized inside the adaptive calibration operator, wherein the dimensions of the gain parameter vector and the offset parameter vector are consistent with the band dimensions. The original full-band hyperspectral data is input into the adaptive calibration operator, and the element-wise multiplication operation between the original full-band hyperspectral data and the gain parameter vector is performed to obtain the gain correction intermediate vector. The gain correction intermediate vector and the offset parameter vector are added element by element to obtain the linear compensation spectral vector, and the linear compensation spectral vector is used as the calibrated characteristic spectral data.
4. The method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network according to claim 1, characterized in that, The step of smoothing and filtering the characteristic spectral data to obtain a preprocessed feature vector includes: The filter window width and polynomial fitting order parameters are set based on the signal-to-noise ratio characteristics of the characteristic spectral data. Based on the filter window width parameter, a sliding sampling window is constructed on the spectral dimension of the feature spectral data, and the sliding sampling window is used to traverse and truncate the feature spectral data with a single band step size to generate multiple continuous local band data subsets. For each subset of local band data, a local fitting polynomial corresponding to the order parameter of the polynomial fitting is constructed using the least squares method, and the smoothed fitting value of the local fitting polynomial at the center position of the sliding sampling window is calculated. The original values of the characteristic spectral data at the corresponding center positions are replaced sequentially using the smoothed fitting values, and all the replaced band values are arranged in wavelength order to generate the preprocessed feature vector.
5. The method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network according to claim 1, characterized in that, The multi-task decoupling output layer includes: The physical constraint interaction matrix and three parallel, independent fully connected branches.
6. The method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network according to claim 5, characterized in that, The preprocessed feature vector is input into the improved one-dimensional convolutional neural network to obtain the predicted values of micronaire value, specific strength, and elongation, including: The multi-scale dilated convolutional unit extracts local subtle features and global contour features from the preprocessed feature vector, and then fuses the local subtle features and global contour features to generate a multi-scale feature map. The channel weights and spatial weights of the multi-scale feature map are calculated using the spatial-spectral dual attention unit, and the multi-scale feature map is weighted and enhanced based on the channel weights and spatial weights to generate an enhanced feature map. The enhanced feature map is input into the multi-task decoupling output layer, and the physical constraint interaction matrix is used to correct the correlation of the enhanced feature map to obtain the constraint feature vector. The constraint feature vector is mapped by the three parallel independent fully connected branches to obtain the predicted values of micronaire value, specific strength, and elongation, respectively.
7. The method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network according to claim 1, characterized in that, The calculation expression for the composite loss function is as follows: ; in, The value of the composite loss function; The number of samples in a single training batch of the multi-parameter standard sample library; For the index identifier of the detection task, where, Represents the Macron value. Indicates specific strength. Indicates elongation; This refers to the task balance weight coefficient corresponding to the k-th detection task; The physicochemical truth value of the i-th sample on the k-th detection task; The predicted value for the i-th sample on the k-th detection task; The constraint penalty coefficient; The prediction correlation matrix is calculated based on the prediction values of the current batch; The true correlation matrix is calculated based on the physicochemical truth values of the current batch. This refers to the Frobenius norm operation of a matrix.
8. The method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network according to claim 1, characterized in that, Based on the composite loss function, the network parameters of the improved one-dimensional convolutional neural network are updated in reverse to obtain the trained inversion model, including: The partial derivatives of the composite loss function with respect to the weight parameters and bias parameters inside the improved one-dimensional convolutional neural network are calculated using the chain rule, and a gradient descent vector is constructed based on the partial derivative values. The gradient descent vector is input into a preset adaptive moment estimator, and the first-order moment estimate and second-order moment estimate of the gradient descent vector are calculated by the adaptive moment estimator, and the parameter update step size is generated by combining the preset learning rate parameter. The weight parameters and the bias parameters are iteratively updated by subtraction using the parameter update step size to complete a single backpropagation training; Determine whether the composite loss function is lower than a preset convergence threshold. If the determination result is no, retrieve the next batch of multi-parameter standard sample library data and continue the training process. If the determination result is yes, freeze the updated weight parameters and bias parameters, and generate the trained inversion model.
9. The method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network according to claim 8, characterized in that, The step of calculating the partial derivatives of the composite loss function with respect to the weight and bias parameters within the improved one-dimensional convolutional neural network using the chain rule, and constructing a gradient descent vector based on the partial derivatives, includes: Calculate the output error sensitivity term at the end of the multi-task decoupling output layer based on the composite loss function; The output error sensitive terms are sequentially passed in reverse through the three parallel independent fully connected branches, the physical constraint interaction matrix, the spatial spectrum dual attention unit, and the multi-scale dilated convolution unit to generate hierarchical error terms for each level. For each of the aforementioned hierarchical error terms, the weighted partial derivatives of the weight parameters and the biased partial derivatives of the bias parameters within the corresponding hierarchical level are calculated using the chain rule. According to the preset index order of the weight parameters and the bias parameters in the improved one-dimensional convolutional neural network, all the partial derivatives of the weights and all the partial derivatives of the biases are vectorized and concatenated to generate the gradient descent vector.
10. The method for multi-parameter hyperspectral inversion of cotton fiber quality based on an improved one-dimensional convolutional neural network according to claim 9, characterized in that, The expression for the output error sensitivity term is: ; in, This refers to the output error sensitive term; This is a weight vector matrix composed of the task balancing weight coefficients; This is the Hadamard product operator; This is a matrix of predicted values for all the samples to be tested in the current batch; This is the physicochemical truth matrix of all the samples to be tested in the current batch; This is the gradient contribution of the task consistency constraint term with respect to the prediction matrix.
Citation Information
Cited By
A method and system for predicting and controlling the quality of cheese dyeing
CN122243305A
Method, device and equipment for detecting physico-chemical parameters of oil
CN122282667A