Fast Detection Method and System Based on NIR and Multi-Distance Domain Generalization

By constructing a quality parameter detection model for domain invariant feature extraction and multi-scale spatial feature extraction prediction processing, the near-infrared spectral detection accuracy problem caused by instability in sampling distance is solved, and rapid and efficient detection of different acquisition distances is achieved.

CN119985392BActive Publication Date: 2025-06-20CHINA UNIV OF MINING & TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510476882.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-06-20
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

The existing near-infrared spectral detection technology changes in signal intensity and noise levels due to unstable sampling distance in mineral product detection, reducing the stability and accuracy of the detection results.

Method used

Using a fast detection method based on NIR and multi-distance domain generalization, a quality parameter detection model is constructed, domain-invariant feature extraction and multi-scale spatial feature extraction prediction processing are carried out, and the quality parameters of the substance to be inspected are generated, which improves the generalization ability of spectral data detection at different acquisition distances.

Benefits of technology

It realizes rapid detection of near-infrared spectral data to be inspected at different acquisition distances, improves the detection efficiency and accuracy, and enhances the stability and accuracy of the quality parameters of the substance to be inspected.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119985392B_ABST
    Figure CN119985392B_ABST
Patent Text Reader

Abstract

The present invention relates to a fast detection method and system based on NIR and multi-distance domain generalization. It includes: providing the near-infrared spectral data to be detected of a substance to be detected, and loading the near-infrared spectral data to be detected into a constructed quality parameter detection model to perform quality detection processing on the near-infrared spectral data to be detected by using the quality parameter detection model. Among them, the quality parameter detection model first extracts domain-invariant features from the near-infrared spectral data to be detected to obtain the domain-invariant features to be detected of the near-infrared spectral data to be detected. Thereafter, the quality parameter detection model performs multi-scale spatial feature extraction and prediction processing on the domain-invariant features to be detected, so as to generate the quality parameters of the substance to be detected after the multi-scale spatial feature extraction and prediction processing. The present invention can meet the fast detection requirements of near-infrared spectral data at different acquisition distances, and improve the efficiency and accuracy of detecting the quality parameters of the substance to be detected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a detection method and system, in particular to a fast detection method and system based on NIR and multi-distance domain generalization. Background Art

[0002] Near-infrared spectroscopy technology has been widely used in many fields such as mineral products, material detection, and environmental monitoring due to its advantages of fast speed, non-destructive nature, and the need for no complex sample pretreatment. This technology irradiates a sample with a spectrum in the range of 13000 cm⁻¹ to 4000 cm⁻¹, thereby obtaining the chemical composition and structural information of the sample, providing strong support for rapid qualitative and quantitative analysis.

[0003] In actual industrial applications, due to the common problems of roughness and irregularity on the surface of mineral products, it is difficult to keep the distance between the sensor of the spectral instrument and the mineral sample stable during sampling. Specifically: on the one hand, during the operation of hand-held or automatic sampling equipment, it is inevitable to be affected by factors such as sampling pressure, position, and angle, resulting in changes in the sampling distance; on the other hand, this inconsistency in distance will directly affect the signal intensity and noise level of the spectral data, thereby reducing the stability and accuracy of the detection results, severely restricting the application effect of traditional near-infrared detection technology in actual production. How to improve the reliability and accuracy of near-infrared detection is a technical problem that urgently needs to be solved at present. Summary of the Invention

[0004] The object of the present invention is to overcome the deficiencies existing in the prior art and provide a fast detection method and system based on NIR and multi-distance domain generalization, which can effectively achieve fast detection of the to-be-detected near-infrared spectral data at different acquisition distances, improve the generalization ability of fast detection of near-infrared spectral data, and improve the efficiency and accuracy of detecting the quality parameters of the to-be-detected substance.

[0005] According to the technical solution provided by the present invention, a fast detection method based on NIR and multi-distance domain generalization, the fast detection method includes:

[0006] Providing the to-be-detected near-infrared spectral data of the to-be-detected substance, and loading the to-be-detected near-infrared spectral data into the constructed quality parameter detection model to perform quality detection processing on the to-be-detected near-infrared spectral data by using the quality parameter detection model, and generating the quality parameters of the to-be-detected substance after the quality detection processing, wherein,

[0007] When providing the to-be-detected near-infrared spectral data, it at least includes performing near-infrared spectral acquisition on the to-be-detected substance, wherein when performing near-infrared spectral acquisition on the to-be-detected substance, the acquisition distance is within the acquisition threshold of the multi-distance domain;

[0008] During quality inspection processing, at least domain-invariant feature extraction processing and multi-scale spatial feature extraction prediction processing are performed. Among them,

[0009] The quality parameter detection model first performs domain-invariant feature extraction on the to-be-inspected near-infrared spectral data to obtain the to-be-inspected domain-invariant features of the to-be-inspected near-infrared spectral data. Thereafter, multi-scale spatial feature extraction prediction processing is performed on the to-be-inspected domain-invariant features to generate the quality parameters of the to-be-inspected substance.

[0010] The quality parameter detection model includes a detection linear layer, a domain-invariant feature extraction unit, a regression prediction unit, and a prediction output unit. Among them,

[0011] The detection linear layer is connected to the domain-invariant feature extraction unit, and the domain-invariant feature extraction unit is adaptively connected to the regression prediction unit;

[0012] During quality inspection processing, the detection linear layer is used to perform linear transformation processing on the to-be-inspected near-infrared spectral data, and the to-be-inspected near-infrared spectral transformation data obtained by the linear transformation processing is loaded into the domain-invariant feature extraction unit;

[0013] The domain-invariant feature extraction unit is used to perform domain-invariant feature extraction on the to-be-inspected near-infrared spectral transformation data, and the to-be-inspected domain-invariant features obtained by the domain-invariant feature extraction are loaded into the regression prediction unit;

[0014] The regression prediction unit is used to perform multi-scale spatial feature extraction prediction processing on the to-be-inspected domain-invariant features, and the to-be-inspected multi-scale spatial features obtained are loaded into the prediction output unit;

[0015] Based on the received to-be-inspected multi-scale spatial features, the prediction output unit outputs the quality parameters of the to-be-inspected substance.

[0016] The domain-invariant feature extraction unit includes a number of serially connected domain-invariant feature extraction modules. Among them, the domain-invariant feature extraction module at the head of the serial connection is connected to the detection linear layer;

[0017] The regression prediction unit includes a number of serially connected regression prediction heads. Among them, the number of regression prediction heads in the regression prediction unit is the same as the number of domain-invariant feature extraction modules in the domain-invariant feature extraction unit. Among them, the regression prediction head at the end of the serial connection is adaptively connected to the prediction output unit;

[0018] In the quality parameter detection model, each domain-invariant feature extraction module is skip-connected to the corresponding regression prediction head.

[0019] The domain-invariant feature extraction module includes a serially connected domain-invariant convolution module, a domain-invariant downsampling module, and a spatial channel attention module. Among them,

[0020] For any two concatenated domain-invariant feature extraction modules, along the concatenation direction, the output end of the spatial channel attention module in the previous domain-invariant feature extraction module is connected to the domain-invariant convolution module in the next domain-invariant feature extraction module;

[0021] For any domain-invariant feature extraction module, the output end of the spatial channel attention module in the domain-invariant feature extraction module is connected to the corresponding regression prediction head through a skip connection;

[0022] When performing domain-invariant feature extraction, for any domain-invariant feature extraction module, use the domain-invariant convolution module to perform convolution processing on the domain-invariant feature sequence to be extracted loaded into the current domain-invariant feature extraction module, so as to extract the local features of the domain-invariant feature sequence to be extracted and generate a domain-invariant convolution feature sequence;

[0023] Use the domain-invariant downsampling module to downsample the domain-invariant convolution feature sequence to generate a domain-invariant downsampled feature sequence, where the feature dimension of the domain-invariant downsampled feature sequence is lower than that of the domain-invariant convolution feature sequence;

[0024] Use the spatial channel attention module to perform attention mechanism processing on the domain-invariant downsampled feature sequence to generate a domain-invariant attention mechanism feature sequence after the attention mechanism processing.

[0025] The domain-invariant convolution module includes at least two sequentially concatenated domain-invariant convolution sub-modules, where,

[0026] For any domain-invariant convolution sub-module, the domain-invariant convolution sub-module includes a domain-invariant sub-block convolution layer, a domain-invariant batch normalization layer, and a domain-invariant sub-block Mish activation function;

[0027] When any two domain-invariant convolution sub-modules are concatenated, along the concatenation direction, the domain-invariant sub-block Mish activation function of the previous domain-invariant convolution sub-module is connected to the domain-invariant sub-block convolution layer in the next domain-invariant convolution sub-module;

[0028] In the domain-invariant feature extraction module, the domain-invariant convolution sub-module at the end of the concatenation is connected to the domain-invariant downsampling module through the corresponding domain-invariant sub-block Mish activation function.

[0029] The spatial channel attention module includes a spatial attention mechanism module using residual connection and a channel attention mechanism module using residual connection, where,

[0030] Use the spatial attention mechanism module to perform spatial attention mechanism processing on the domain-invariant downsampled feature sequence to generate a domain-invariant spatial attention processed feature sequence after the spatial attention mechanism processing;

[0031] The channel attention mechanism module is used to perform channel attention mechanism processing on the feature sequence after domain-invariant downsampling, so as to generate a feature sequence after domain-invariant channel attention mechanism processing after the channel attention mechanism processing;

[0032] The feature sequence after domain-invariant spatial attention processing and the feature sequence after domain-invariant downsampling are subjected to matrix multiplication operation, so as to generate a feature sequence after domain-invariant spatial multiplication after the matrix multiplication operation;

[0033] The feature sequence after domain-invariant channel attention processing and the feature sequence after domain-invariant downsampling are subjected to matrix multiplication operation, so as to generate a feature sequence after domain-invariant channel multiplication after the matrix multiplication operation;

[0034] The feature sequence after domain-invariant spatial multiplication and the feature sequence after domain-invariant channel multiplication are subjected to matrix addition operation, so as to generate a feature sequence after domain-invariant attention mechanism after the matrix addition operation.

[0035] The regression prediction head includes a regression prediction splicer, a regression prediction convolution module, and a regression prediction transposed convolution module connected in sequence, where

[0036] For any two concatenated regression prediction heads, along the concatenated direction, the regression prediction transposed convolution module of the previous regression prediction head is connected to the regression prediction splicer of the next regression prediction head;

[0037] For any regression prediction head, during skip connection, it is connected to the output end of the domain-invariant feature extraction module corresponding to the skip connection through the regression prediction splicer.

[0038] When constructing the quality parameter detection model, the construction method includes:

[0039] Construct a quality parameter detection basic model, and make a basic model training data set for training the quality parameter detection basic model, where

[0040] The quality parameter detection basic model further includes a reconstruction decoding unit and a discriminator, where the reconstruction decoding unit and the discriminator are both adaptively connected to the domain-invariant feature extraction unit;

[0041] The basic model training data set includes a number of model data samples. When making the basic model training data set, the training substance is subjected to near-infrared spectrum collection at different training acquisition distances, so as to form a model data sample based on the collected training near-infrared spectrum data and the quality label of the training substance,

[0042] The training substance and the substance to be detected belong to the same category of substances, and the training acquisition distance is also within the acquisition threshold of the multi-distance domain;

[0043] The basic model training dataset is at least divided into a training sample set and a validation sample set, so as to use the training sample set to train the basic model for multi-distance domain quality parameter detection, and use the validation sample set to verify the basic model for multi-distance domain quality parameter detection. Among them,

[0044] When using the training sample set to train the basic model for multi-distance domain quality parameter detection, during each batch training process, first train the detection linear layer, domain-invariant feature extraction unit, prediction output unit, reconstruction decoding unit, and regression prediction unit in the basic model for quality parameter detection, and then train the discriminator;

[0045] After the model training of the basic model for multi-distance domain quality parameter detection reaches the target state and the model verification of the basic model for multi-distance domain quality parameter detection using the validation sample set passes, a quality parameter detection model is formed based on the basic model for multi-distance domain quality parameter detection that reaches the target state of model training.

[0046] The reconstruction decoding unit includes a number of sequentially connected reconstruction decoding modules. Among them,

[0047] The number of reconstruction decoding modules in the reconstruction decoding unit is the same as the number of domain-invariant feature extraction modules in the domain-invariant feature extraction unit;

[0048] For any one reconstruction decoding module, the reconstruction decoding module includes a sequentially connected reconstruction decoding splicer, a reconstruction decoding convolutional module, and a reconstruction decoding transposed convolutional module. Among them,

[0049] For any two sequentially connected reconstruction decoding modules, in the direction of sequential connection, the reconstruction decoding transposed convolutional module of the previous reconstruction decoding module is connected to the reconstruction decoding splicer in the next reconstruction decoding module;

[0050] When constructing the basic model for quality parameter detection, the domain-invariant feature extraction module is skip-connected to the corresponding reconstruction decoding module, and when skip-connecting, it is connected to the output end of the domain-invariant feature extraction module corresponding to the skip connection through the reconstruction decoding splicer.

[0051] A fast detection system based on NIR and multi-distance domain generalization includes a fast detection processing device. Among them, a quality parameter detection model is deployed inside the fast detection processing device;

[0052] For the to-be-detected near-infrared spectral data of the to-be-tested substance, the fast detection processing device uses the above-mentioned fast detection method to perform quality detection processing, so as to output the quality parameters of the to-be-tested substance after quality detection processing.

[0053] Advantages of the present invention: A quality parameter detection model is constructed, and the constructed quality parameter detection model can be used to quickly perform quality detection processing on the to-be-detected near-infrared spectral data under the acquisition thresholds of multiple distance domains. The quality parameter detection model first extracts domain-invariant features from the to-be-detected near-infrared spectral data to obtain the to-be-detected domain-invariant features of the to-be-detected near-infrared spectral data. Thereafter, the quality parameter detection model performs multi-scale spatial feature extraction and prediction processing on the to-be-detected domain-invariant features to generate the quality parameters of the to-be-detected substance after the multi-scale spatial feature extraction and prediction processing; for the to-be-detected near-infrared spectral data at different acquisition distances, rapid detection can be effectively achieved, the generalization ability of rapid detection of near-infrared spectral data is improved, and the efficiency and accuracy of quality parameter detection of the to-be-detected substance are improved. Description of the Drawings

[0054] Figure 1 It is a flowchart of an embodiment of the rapid detection method of the present invention.

[0055] Figure 2 It is a structural block diagram of an embodiment of the quality parameter detection basic model of the present invention.

[0056] Figure 3 It is a structural block diagram of an embodiment of the domain-invariant convolution module of the present invention.

[0057] Figure 4 It is a schematic diagram of an embodiment of the convolution processing of the domain-invariant sub-block convolution layer of the present invention.

[0058] Figure 5 It is a schematic diagram of an embodiment of the spatial channel attention module of the present invention.

[0059] Figure 6 It is a schematic diagram of an embodiment of multiple near-infrared spectra of bauxite of the present invention. Detailed Embodiments

[0060] The present invention will be further described below in conjunction with specific drawings and embodiments.

[0061] In order to effectively achieve rapid detection of the to-be-detected near-infrared spectral data at different acquisition distances, improve the generalization ability of rapid detection of near-infrared spectral data, and improve the efficiency and accuracy of quality parameter detection of the to-be-detected substance, the present invention provides a rapid detection method based on NIR and multi-distance domain generalization. Specifically, the rapid detection method includes:

[0062] Providing the to-be-detected near-infrared spectral data of the to-be-detected substance and loading the to-be-detected near-infrared spectral data into the constructed quality parameter detection model, so as to use the quality parameter detection model to perform quality detection processing on the to-be-detected near-infrared spectral data and generate the quality parameters of the to-be-detected substance after the quality detection processing, wherein,

[0063] When providing the near-infrared spectral data to be detected, it at least includes performing near-infrared spectral acquisition on the substance to be detected. Among them, when performing near-infrared spectral acquisition on the substance to be detected, the acquisition distance is within the acquisition threshold of the multi-distance domain;

[0064] When performing quality inspection and processing, the quality parameter detection model at least performs domain-invariant feature extraction processing and multi-scale spatial feature extraction and prediction processing. Among them,

[0065] The quality parameter detection model first performs domain-invariant feature extraction on the near-infrared spectral data to be detected to extract the domain-invariant features to be detected of the near-infrared spectral data to be detected. After that, the quality parameter detection model performs multi-scale spatial feature extraction and prediction processing on the domain-invariant features to be detected to generate the quality parameters of the substance to be detected after the multi-scale spatial feature extraction and prediction processing.

[0066] Figure 1 FIG. shows a flowchart of an embodiment of the rapid detection method of the present invention. It can be seen from the figure that when performing rapid detection, the near-infrared spectral data (NIR) to be detected of the substance to be detected should be provided. Therefore, the substance to be detected should be of a type suitable for near-infrared spectral detection. For example, the substance to be detected can be bauxite or other substance types. When performing rapid detection on the substance to be detected, specifically, it means detecting and determining the quality parameters of the substance to be detected according to the provided near-infrared spectral data to be detected. For example, when the substance to be detected is bauxite, the quality parameter of the substance to be detected can be the content of Al2O3 in the substance to be detected. When the substance to be detected is of other types, the corresponding quality parameter situation corresponds to the type of the substance to be detected. The corresponding quality parameter situation can refer to the description here and will not be elaborated here.

[0067] It should be understood that when providing the near-infrared spectral data to be detected, at least near-infrared spectral acquisition should be performed on the substance to be detected so that the corresponding near-infrared spectral data to be detected can be obtained after the near-infrared spectral acquisition, Figure 6 FIG. shows an embodiment of the near-infrared spectral data of different samples based on bauxite. The near-infrared spectral data to be detected of the present invention is the spectral data obtained by performing near-infrared spectral acquisition on the substance to be detected once by a near-infrared spectral acquisition instrument. Therefore, the near-infrared spectral data to be detected is the data obtained by one near-infrared spectral acquisition. The near-infrared spectral acquisition instrument can use existing common equipment, such as the MicroNIR Pro handheld near-infrared spectrometer of VIAVI Corporation.

[0068] As can be seen from the above description, when collecting near-infrared spectra using a near-infrared spectrum collection instrument, there is a collection distance between the substance to be detected and the near-infrared spectrum collection instrument, and the collection distance will fluctuate. In an embodiment of the present invention, the collection distance should be within the collection threshold of the multi-distance domain. Therefore, the multi-distance domain specifically refers to that when constructing a quality parameter detection model, samples collected at multiple collection distances are used for training. Thereafter, when the collection distance corresponding to any near-infrared spectrum data to be detected is within the collection threshold of the multi-distance domain, the quality parameter detection model can be used for quality detection processing, and the quality parameters of the substance to be detected obtained through the quality detection processing have high accuracy. That is to say, the accuracy of the quality parameters obtained through rapid detection is less affected by the collection distance. In other words, the quality parameter detection model of the present invention can adapt to the near-infrared spectrum data to be detected at different collection distances and can effectively achieve rapid detection, improving the generalization ability of quality detection processing for near-infrared spectrum data.

[0069] In an embodiment of the present invention, the collection threshold of the multi-distance domain can be 30 mm. That is to say, when collecting near-infrared spectra of the substance to be detected, it is necessary to ensure that when using the near-infrared spectrum collection instrument to collect near-infrared spectra of the substance to be detected, the collection distance should be between 0 and 30 mm. After collecting the near-infrared spectra of the substance to be detected, the near-infrared spectrum source data to be detected can be generated. In order to improve the detection accuracy, the standard normal variate (SNV) transform can be used to process the near-infrared spectrum source data to be detected to eliminate environmental noise and obtain the near-infrared spectrum data to be detected after processing. At this time, when providing the near-infrared spectrum data to be detected, it at least includes near-infrared spectrum collection and standard normal transform processing. Specifically, the method and process of using the standard normal transform to process the near-infrared spectrum source data to be detected can be consistent with the prior art and will not be elaborated here.

[0070] It can be understood that after obtaining the near-infrared spectrum data to be detected, the near-infrared spectrum data to be detected should be loaded into the constructed quality parameter detection model to use the quality parameter detection model for quality detection processing. Among them, the quality detection processing performed by the quality parameter detection model at least includes domain-invariant feature extraction processing and multi-scale spatial feature extraction and prediction processing. Specifically in implementation, the domain-invariant feature extraction processing should be performed first, and then the multi-scale spatial feature extraction and prediction processing should be performed to generate the quality parameters of the substance to be detected after the multi-scale spatial feature extraction and prediction processing.

[0071] In an embodiment of the present invention, the quality parameter detection model includes a detection linear layer, a domain-invariant feature extraction unit, a regression prediction unit, and a prediction output unit, where

[0072] The detection linear layer is connected to the domain-invariant feature extraction unit, and the domain-invariant feature extraction unit is adaptively connected to the regression prediction unit;

[0073] When performing quality detection processing on the to-be-detected near-infrared spectral data, the detection linear layer is used to perform linear transformation processing on the to-be-detected near-infrared spectral data, so as to obtain the to-be-detected near-infrared spectral transformation data after the linear transformation processing, and load the to-be-detected near-infrared spectral transformation data into the domain-invariant feature extraction unit;

[0074] The domain-invariant feature extraction unit is used to extract domain-invariant features from the to-be-detected near-infrared spectral transformation data, so as to generate the to-be-detected domain-invariant features after the domain-invariant feature extraction, and load the to-be-detected domain-invariant features into the regression prediction unit;

[0075] The regression prediction unit is used to perform multi-scale spatial feature extraction and prediction processing on the to-be-detected domain-invariant features, so as to generate the to-be-detected multi-scale spatial features after the multi-scale spatial feature extraction and prediction processing, and load the to-be-detected multi-scale spatial features into the prediction output unit;

[0076] Based on the received to-be-detected multi-scale spatial features, the prediction output unit outputs the quality parameters of the to-be-detected substance.

[0077] From Figure 6 and the common general knowledge in the technical field, it can be known that the to-be-detected near-infrared spectral data is one-dimensional data, and the to-be-detected near-infrared spectral data can be expressed in the form of a sequence of L×1, where L is the number of sampling points of the to-be-detected near-infrared spectral data. Figure 4 An embodiment of the to-be-detected near-infrared spectral data is shown in Figure 4 where …, are L feature points of the to-be-detected near-infrared spectral data.

[0078] In order to meet the quality detection processing, the detection linear layer should be used to perform linear transformation processing on the to-be-detected near-infrared spectral data first. After the linear transformation processing, the to-be-detected near-infrared spectral transformation data can be obtained. Specifically, the detection linear layer is used to extract the information of the near-infrared spectral data from the to-be-detected near-infrared spectral data and capture the important features in the to-be-detected near-infrared spectral data. In addition, after the linear transformation processing, the feature dimension of the to-be-detected near-infrared spectral transformation data can be L×C, where C is the channel dimension of the to-be-detected near-infrared spectral transformation data. Therefore, during the linear transformation, the feature dimension of the to-be-detected near-infrared spectral data is also transformed.

[0079] During specific implementation, the linear transformation process should be executed within the quality parameter detection model. When the linear transformation process is executed within the quality parameter detection model, a detection linear layer should be set within the quality parameter detection model. Therefore, the quality detection process should also include the linear transformation process. In order to meet the quality detection process, the quality parameter detection model should include a detection linear layer, a domain-invariant feature extraction unit, a regression prediction unit, and a prediction output unit. Figure 2 Among them, XN1 is the detection linear layer, and the detection linear layer can adopt the commonly used existing form, specifically to meet the above-mentioned linear transformation process for the near-infrared spectrum data to be detected.

[0080] During specific implementation, the above-mentioned domain-invariant feature extraction process is executed by using the domain-invariant feature extraction unit, and the above-mentioned multi-scale spatial feature extraction and prediction process is executed by using the regression prediction unit. Specifically, the detection linear layer should be connected to the domain-invariant feature extraction unit, and the near-infrared spectrum transformation data to be detected can be loaded into the domain-invariant feature extraction unit to use the domain-invariant feature extraction unit to execute the domain-invariant feature extraction process on the near-infrared spectrum transformation data to be detected and generate the domain-invariant feature to be detected. It should be noted that the domain-invariant feature process specifically refers to extracting the features in the near-infrared spectrum transformation data to be detected that are independent of the acquisition distance, that is, the domain-invariant feature to be detected is independent of the acquisition distance when generating the near-infrared spectrum source data to be detected, so as to effectively reduce the influence of the acquisition distance on the predicted quality parameters.

[0081] The domain-invariant feature to be detected generated by the domain-invariant feature extraction process should be loaded into the regression prediction unit to use the regression prediction unit to perform multi-scale spatial feature extraction and prediction processing on the domain-invariant feature to be detected and generate the multi-scale spatial feature to be detected. In order to output the quality parameters of the substance to be detected, the present invention maps and outputs the multi-scale spatial feature to be detected through the prediction output unit, and the quality parameters of the substance to be detected can be generated after the mapping output. Among them, the prediction output unit can adopt the commonly used fully connected layer, and the form adopted by the prediction output unit specifically depends on meeting the mapping output of the quality parameters of the substance to be detected.

[0082] In an embodiment of the present invention, the domain-invariant feature extraction unit includes a number of sequentially connected domain-invariant feature extraction modules, where the domain-invariant feature extraction module located at the head of the connection is connected to the detection linear layer;

[0083] The regression prediction unit includes a number of sequentially connected regression prediction heads, where the number of regression prediction heads in the regression prediction unit is the same as the number of domain-invariant feature extraction modules in the domain-invariant feature extraction unit. Among them, the regression prediction head at the end of the connection is adaptively connected to the prediction output unit;

[0084] Within the quality parameter detection model, each domain-invariant feature extraction module is skip-connected to the corresponding regression prediction head.

[0085] In specific implementation, the domain-invariant feature extraction unit may include several serially connected domain-invariant feature extraction modules. The number of domain-invariant feature extraction modules in the domain-invariant feature extraction unit can be selected according to needs. Generally, there are at least two domain-invariant feature extraction modules in the domain-invariant feature extraction unit. The number of domain-invariant feature extraction modules is subject to meeting the actual application requirements. Figure 2 An embodiment in which the domain-invariant feature extraction unit includes four serially connected domain-invariant feature extraction modules is shown in. Among them, the domain-invariant feature extraction modules should preferably adopt the same structural form. When multiple domain-invariant feature extraction modules are serially connected, the domain-invariant feature module at the head of the serial connection is connected to the detection linear layer so as to receive the near-infrared spectral transformation data to be detected generated by the detection linear layer. It should be noted that when multiple domain-invariant feature extraction modules are serially connected to form a domain-invariant feature extraction unit, the shallow domain-invariant feature extraction modules are used to capture local spectral details, and the deep domain-invariant feature extraction modules are used to integrate global context relationships, avoiding the insufficient long-range dependence modeling and loss of detail information caused by limited receptive fields in a single-layer structure, thereby enhancing the representation ability for feature extraction of complex near-infrared spectral data to be detected.

[0086] Specifically, the regression prediction unit can be formed by serially connecting multiple regression prediction heads. Among them, the number of regression prediction heads in the regression prediction unit should be consistent with the number of domain-invariant feature extraction modules in the domain-invariant feature extraction unit. At this time, there is a one-to-one correspondence between the regression prediction heads and the domain-invariant feature extraction modules. Figure 2 An embodiment in which the regression prediction unit is formed by serially connecting four regression prediction heads is shown in. When the four regression prediction heads are serially connected to form a regression prediction unit, the regression prediction head at the end of the serial connection is connected to the prediction output unit. In specific implementation, the function of serially connecting multiple regression prediction heads to form a regression prediction unit can refer to the corresponding description of serially connecting multiple domain-invariant feature extraction modules to form a domain-invariant feature extraction unit above.

[0087] In specific implementation, in the quality parameter detection model, each domain-invariant feature extraction module is skip-connected to the corresponding regression prediction head. For example, when the domain-invariant feature extraction unit is formed by serially connecting four domain-invariant feature extraction modules, the input end of the first domain-invariant feature extraction module is connected to the detection linear layer and is skip-connected to the fourth regression prediction head. The input end of the second domain-invariant feature extraction module is connected to the output end of the first domain-invariant feature extraction module and is connected to the input end of the third domain-invariant feature extraction module, and is skip-connected to the third regression prediction head; the output end of the third domain-invariant feature extraction module is connected to the input end of the fourth domain-invariant feature extraction module and is skip-connected to the second regression prediction head.

[0088] It should be noted that the output end of the fourth domain-invariant feature extraction module is connected to the input end of the first regression prediction head, but skip connections are not used. Among them, the regression prediction head connected to the prediction output unit is the fourth regression prediction head in the regression prediction unit. Along the direction from the first regression prediction head to the fourth regression prediction head, the corresponding regression prediction heads are the second regression prediction head and the third regression prediction head respectively. For the cascading situation between regression prediction heads, reference can be made to the description here, and no further examples will be given here. Figure 2 In the domain-invariant feature extraction unit shown, the domain-invariant feature extraction module located on the outermost side and connected to the detection linear layer is the first domain-invariant feature extraction module. For other situations, the corresponding order can be determined with reference to the above description, which will not be elaborated here.

[0089] It should be understood that when skip connections are adopted between the domain-invariant feature extraction unit and the regression prediction unit, multi-scale feature fusion can be achieved, combining the shallow detail information in the domain-invariant feature extraction module with the deep semantic features of the corresponding regression prediction head. That is, it retains the local details such as the absorption peak position and intensity in the near-infrared spectral data to be detected, and makes up for the loss of spatial information caused by downsampling, integrating details and global context relationships, and improving the prediction accuracy of the quality parameter detection model for quality parameters.

[0090] In an embodiment of the present invention, the domain-invariant feature extraction module includes a domain-invariant convolution module, a domain-invariant downsampling module, and a spatial channel attention module connected in sequence, where

[0091] For any two cascaded domain-invariant feature extraction modules, along the cascading direction, the output end of the spatial channel attention module in the previous domain-invariant feature extraction module is connected to the domain-invariant convolution module in the next domain-invariant feature extraction module;

[0092] For any domain-invariant feature extraction module, the output end of the spatial channel attention module in the domain-invariant feature extraction module is connected to the corresponding regression prediction head of the skip connection;

[0093] When performing domain-invariant feature extraction, for any domain-invariant feature extraction module, use the domain-invariant convolution module to perform convolution processing on the domain-invariant feature sequence to be extracted loaded into the current domain-invariant feature extraction module to extract the local features of the domain-invariant feature sequence to be extracted and generate a domain-invariant convolution posterior feature sequence;

[0094] Use the domain-invariant downsampling module to perform downsampling on the domain-invariant convolution posterior feature sequence to generate a domain-invariant downsampling posterior feature sequence, where the feature dimension of the domain-invariant downsampling posterior feature sequence is lower than that of the domain-invariant convolution posterior feature sequence;

[0095] The spatial channel attention module is used to perform attention mechanism processing on the feature sequence after domain-invariant downsampling, so as to generate the feature sequence after the domain-invariant attention mechanism after the attention mechanism processing.

[0096] Figure 2 An embodiment of the domain-invariant feature extraction module is shown. It can be seen from the figure that each domain-invariant feature extraction module may include a domain-invariant convolution module, a domain-invariant downsampling module, and a spatial channel attention module. Figure 2 In [the figure], the domain-invariant downsampling module is not shown. When the domain-invariant downsampling module of the present invention performs downsampling, it can adopt the average pooling method, that is Figure 2 the average pooling in [the figure] is the downsampling operation performed by the domain-invariant downsampling module of the present invention. Specifically, the domain-invariant downsampling module is composed of an average pooling layer. Figure 2 The scSE (Concurrent Spatial and Channel Squeeze&Excitation) in [the figure] is the spatial channel attention module.

[0097] In an embodiment of the present invention, the domain-invariant convolution module serves as the input layer of the domain-invariant feature extraction module where it is located, and the spatial channel attention module serves as the output layer of the domain-invariant feature extraction module where it is located. Therefore, when any two domain-invariant feature extraction modules are connected in series, the output end of the spatial channel attention module in the previous domain-invariant feature extraction module is connected to the domain-invariant convolution module in the next domain-invariant feature extraction module. It can be understood that for the domain-invariant feature extraction module at the head of the series connection, the domain-invariant feature extraction module is connected to the detection linear layer through the domain-invariant convolution module to receive the near-infrared spectral transformation data to be detected loaded by the detection linear layer. During skip connection, the output end of the spatial channel attention module in each domain-invariant feature extraction module is connected to the regression prediction head corresponding to the skip connection, that is, it is adaptively connected to the corresponding regression prediction head through the spatial channel attention module.

[0098] During specific implementation, for any domain-invariant feature extraction module, the domain-invariant convolution module is used to perform convolution processing on the domain-invariant feature sequence to be extracted loaded into the current domain-invariant feature extraction module, so as to extract the local features of the domain-invariant feature sequence to be extracted and generate the domain-invariant convolution posterior feature sequence. It can be understood that the situation of the domain-invariant feature sequence to be extracted is related to the domain-invariant feature extraction module loaded. For example, when the current domain-invariant feature extraction module is at the head of the series connection, as described above, the domain-invariant feature sequence to be extracted should be the near-infrared spectral transformation data to be detected. For other domain-invariant feature extraction modules, the corresponding domain-invariant feature sequence to be extracted should be the feature sequence after the domain-invariant attention mechanism generated by the previous domain-invariant feature extraction module.

[0099] As can be seen from the above description, after the execution domain invariant feature extraction process, the domain invariant features to be detected should be loaded into the regression prediction unit. When the domain invariant feature extraction unit adopts the above form, the domain invariant features to be detected should include the feature sequences after the domain invariant attention mechanism generated by all domain invariant feature extraction modules. Therefore, from the above description, the specific situation of loading the domain invariant features to be detected into the regression prediction unit can be obtained, and the above description can be specifically referred to.

[0100] In an embodiment of the present invention, the domain invariant convolution module includes at least two serially connected domain invariant convolution sub-modules, where

[0101] For any domain invariant convolution sub-module, the domain invariant convolution sub-module includes a domain invariant sub-block convolution layer, a domain invariant batch normalization layer, and a domain invariant sub-block Mish activation function;

[0102] When any two domain invariant convolution sub-modules are serially connected, in the direction of the serial connection, the domain invariant sub-block Mish activation function of the previous domain invariant convolution sub-module is connected to the domain invariant sub-block convolution layer in the subsequent domain invariant convolution sub-module;

[0103] Within the domain invariant feature extraction module, the domain invariant convolution sub-module at the end of the serial connection is connected to the domain invariant downsampling module through the corresponding domain invariant sub-block Mish activation function.

[0104] In order to implement the above-mentioned convolution process on the domain invariant feature sequence to be extracted, the domain invariant convolution module may include at least two serially connected domain invariant convolution sub-modules, and the number of domain invariant convolution sub-modules in the domain invariant convolution module can be selected according to needs. Figure 3 An embodiment in which the domain invariant convolution module includes two serially connected domain invariant convolution sub-modules is shown. It can be seen from the figure that the domain invariant convolution sub-modules can adopt the same structural form. For example, each domain invariant convolution sub-module should at least include a serially connected domain invariant sub-block convolution layer, a domain invariant batch normalization layer, and a domain invariant sub-block Mish activation function. Figure 3 When the two domain invariant convolution sub-modules shown are serially connected, JG1 is the domain invariant sub-block convolution layer in the first domain invariant convolution sub-module, BN2 is the domain invariant batch normalization layer in the first domain invariant convolution sub-module, and M2 is the domain invariant sub-block Mish activation function in the first domain invariant convolution sub-module; similarly, it can be obtained that: JG2 is the domain invariant sub-block convolution layer in the second domain invariant convolution sub-module, BN3 is the domain invariant batch normalization layer in the second domain invariant convolution sub-module, and M3 is the domain invariant sub-block Mish activation function in the second domain invariant convolution sub-module.

[0105] In specific implementation, the domain invariant sub-block convolution layer can adopt the existing common form. Figure 4An embodiment of the domain-invariant sub-block convolution layer during convolution processing is shown. As can be seen from the figure, the convolution kernel size adopted by the domain-invariant sub-block convolution layer can be 3, and the padding size can be 1. Of course, the domain-invariant sub-block convolution layer can also adopt other convolution parameters, which can be specifically selected according to needs and will not be exemplified here.

[0106] When the domain-invariant convolution module adopts the above structure and is connected to the domain-invariant downsampling module in the domain-invariant feature extraction module, the domain-invariant convolution sub-module at the end of the concatenation is connected to the domain-invariant downsampling module through the corresponding domain-invariant sub-block Mish activation function. For example, when the domain-invariant convolution module is formed by concatenating two domain-invariant convolution sub-modules, it is connected to the corresponding domain-invariant downsampling module through the domain-invariant sub-block Mish activation function M3, that is, the domain-invariant convolution post-feature sequence can be output through the domain-invariant sub-block Mish activation function M3. Other situations can refer to the description here.

[0107] It should be noted that when performing convolution processing on the domain-invariant feature sequence to be extracted, local features within the domain-invariant feature sequence to be extracted can be extracted through the domain-invariant sub-block convolution layer; by setting at least two domain-invariant sub-block convolution layers in the domain-invariant convolution module, feature extraction with more abstract semantic representations can be achieved; the domain-invariant batch normalization layer can be used to standardize the output sequence of the domain-invariant sub-block convolution layer, making the input distribution more stable and reducing internal covariate shift; the domain-invariant sub-block Mish activation function can improve the non-linear representation ability, and at the same time, it has a smooth curve in the negative value region, which helps to retain the feature information in the near-infrared spectrum data to be detected.

[0108] The domain-invariant downsampling module downsamples the domain-invariant convolution post-feature sequence. Through downsampling, the dimension of the features can be gradually reduced, and more abstract and high-level features can be extracted, helping the quality parameter detection model to better understand and generalize the data. Therefore, when the domain-invariant downsampled feature sequence is generated by the domain-invariant downsampling module, the feature dimension of the domain-invariant downsampled feature sequence is lower than that of the domain-invariant convolution post-feature sequence.

[0109] In an embodiment of the present invention, the spatial channel attention module includes a spatial attention mechanism module using residual connection and a channel attention mechanism module using residual connection, where

[0110] The spatial attention mechanism module is used to perform spatial attention mechanism processing on the domain-invariant downsampled feature sequence to generate a domain-invariant spatially attention-processed feature sequence after the spatial attention mechanism processing;

[0111] The channel attention mechanism module is used to perform channel attention mechanism processing on the domain-invariant downsampled feature sequence to generate a domain-invariant channel attention-processed feature sequence after the channel attention mechanism processing;

[0112] Perform a matrix multiplication operation on the feature sequence after domain-invariant spatial attention processing and the feature sequence after domain-invariant downsampling to generate a feature sequence after domain-invariant spatial multiplication after the matrix multiplication operation;

[0113] Perform a matrix multiplication operation on the feature sequence after domain-invariant channel attention processing and the feature sequence after domain-invariant downsampling to generate a feature sequence after domain-invariant channel multiplication after the matrix multiplication operation;

[0114] Perform a matrix addition operation on the feature sequence after domain-invariant spatial multiplication and the feature sequence after domain-invariant channel multiplication to generate a feature sequence after the domain-invariant attention mechanism after the matrix addition operation.

[0115] Specifically, the spatial-channel attention module can simultaneously include a spatial attention mechanism module (Channel Squeeze and Spatial Excitation, sSE) and a channel attention mechanism module (Spatial Squeeze and Channel Excitation, cSE). Among them, both the spatial attention mechanism module and the channel attention mechanism module adopt residual connections, and the spatial attention mechanism module and the channel attention mechanism module are in a parallel distribution state. As Figure 5 shown, at this time, the feature sequence after domain-invariant downsampling can be loaded into both the spatial attention mechanism module and the channel attention mechanism module simultaneously. After that, use the spatial attention mechanism module to perform spatial attention mechanism processing on the feature sequence after domain-invariant downsampling to generate a feature sequence after domain-invariant spatial attention processing; at the same time, use the channel attention mechanism module to perform channel attention mechanism processing on the feature sequence after domain-invariant downsampling to generate a feature sequence after domain-invariant channel attention processing.

[0116] For the spatial attention mechanism module with residual connections, after obtaining the feature sequence after domain-invariant spatial attention processing, a matrix multiplication operation should also be performed on the feature sequence after domain-invariant spatial attention processing and the feature sequence after domain-invariant downsampling to generate a feature sequence after domain-invariant spatial multiplication after the matrix multiplication operation. Similarly, for the channel attention module with residual connections, after obtaining the feature sequence after domain-invariant channel attention processing, a matrix multiplication operation should also be performed on the feature sequence after domain-invariant spatial attention processing and the feature sequence after domain-invariant downsampling to generate a feature sequence after domain-invariant spatial multiplication after the matrix multiplication operation.

[0117] Figure 5 also shows a schematic diagram of an embodiment of the spatial-channel attention module, Figure 5Among them, DE0 is the feature sequence after domain-invariant downsampling. As can be seen from the figure, the spatial attention mechanism module may include a spatial attention convolution block and a spatial attention Sigmoid function. Figure 5 Among them, KJG1 is the spatial attention convolution block, and S3 is the spatial attention Sigmoid function. When performing spatial attention mechanism processing, the feature sequence after domain-invariant downsampling can be subjected to spatial attention convolution through the spatial attention convolution block to generate a feature sequence after domain-invariant spatial attention convolution after spatial attention convolution. Thereafter, the feature sequence after domain-invariant spatial attention convolution is subjected to spatial attention mapping using the spatial attention Sigmoid function to generate a feature sequence after domain-invariant spatial attention mapping after spatial attention mapping. Figure 3 Among them, D0 is the feature sequence after domain-invariant spatial attention convolution, and D1 is the feature sequence after domain-invariant spatial attention mapping.

[0118] During specific implementation, the feature dimension of the feature sequence after domain-invariant downsampling is L×C, and the size of the convolution kernel adopted by the spatial attention convolution block can be 1. In addition, the feature dimension of the feature sequence after domain-invariant spatial attention convolution and the corresponding feature dimension of the feature sequence after domain-invariant spatial attention mapping are both L×1. Figure 5 Among them, the output end of the spatial attention Sigmoid function is also connected to the input end of the spatial attention multiplier. Figure 5 Among them, CF2 is the spatial attention multiplier. When using residual connection, the feature sequence after domain-invariant downsampling should be loaded into the spatial attention multiplier, and the spatial attention multiplier is used to perform matrix multiplication operation on the feature sequence after domain-invariant downsampling and the feature sequence after domain-invariant spatial attention mapping, and generate a feature sequence after domain-invariant spatial multiplication. Figure 5 Among them, D2 is the feature sequence after domain-invariant spatial multiplication, and the feature dimension of the feature sequence after domain-invariant spatial multiplication is L×C.

[0119] Figure 5 An embodiment of the channel attention mechanism module is also shown in the figure. As can be seen from the figure, the channel attention mechanism module includes a channel attention pooling layer, a channel attention first convolution layer, a channel attention second convolution layer, and a channel attention Sigmoid function. In the figure, Ch is the channel attention pooling layer, and the channel attention pooling layer can perform pooling operation using average pooling. TJG1 is the channel attention first convolution layer, TJG2 is the channel attention second convolution layer, and S2 is the channel attention Sigmoid function. The size of the convolution kernel adopted by the channel attention first convolution layer and the channel attention second convolution layer can both be 1.

[0120] When performing channel attention mechanism processing, average pooling operation is carried out on the domain-invariant downsampled feature sequence through the channel attention pooling layer, and the domain-invariant channel attention pooled feature sequence is obtained. Figure 5 In Figure 5 , E0 is the domain-invariant channel attention pooled feature sequence, and the feature dimension of the domain-invariant channel attention pooled feature sequence is 1×C. Convolution processing is carried out on the domain-invariant channel attention pooled feature sequence through the first channel attention convolutional layer to obtain the domain-invariant channel attention first convolutional feature sequence after convolution processing. Figure 5 In Figure 5 , E1 is the domain-invariant channel attention first convolutional feature sequence, and the feature dimension of the domain-invariant channel attention first convolutional feature sequence is 1×(C / 2). Convolution processing is carried out on the domain-invariant channel attention first convolutional feature sequence through the second channel attention convolutional layer to generate the domain-invariant channel attention second convolutional feature sequence after convolution processing. Figure 5 In Figure 5 , E2 is the domain-invariant channel attention second convolutional feature sequence, and the feature dimension of the domain-invariant channel attention second convolutional feature sequence is 1×C. Channel attention mapping is carried out on the domain-invariant channel attention second convolutional feature sequence through the channel attention Sigmoid function to generate the domain-invariant channel attention mapped feature sequence after channel attention mapping. Figure 5 In Figure 5 , E3 is the domain-invariant channel attention mapped feature sequence, and the feature dimension of the domain-invariant channel attention mapped feature sequence is 1×C.

[0121] When the channel attention mechanism module adopts residual connection, the channel attention Sigmoid function should also be connected to the channel attention multiplier. Figure 5 In Figure 5 , CF1 is the channel attention multiplier, and from Figure 5 it can be known that the domain-invariant downsampled feature sequence should be loaded into the channel attention multiplier. After that, the channel attention multiplier is used to perform matrix multiplication operation on the domain-invariant downsampled feature sequence and the domain-invariant channel attention mapped feature sequence, and the domain-invariant channel multiplied feature sequence is generated. Figure 5 In Figure 5 , E4 is the domain-invariant channel multiplied feature sequence, and the feature dimension of the domain-invariant channel multiplied feature sequence is L×C.

[0122] In order to obtain the domain-invariant attention mechanism feature sequence, the domain-invariant channel multiplied feature sequence and the domain-invariant spatial multiplied feature sequence should both be loaded into the matrix adder. Figure 5 In Figure 5 , Ad1 is the matrix adder. Through the matrix adder, the corresponding elements of the domain-invariant channel multiplied feature sequence and the domain-invariant spatial multiplied feature sequence can be added, and the domain-invariant attention mechanism feature sequence can be generated after the corresponding elements are added. Figure 5Among them, DE1 is the feature sequence after the domain-invariant attention mechanism. The channel dimension of the feature sequence after the domain-invariant attention mechanism is C, and the sequence dimension is L.

[0123] In an embodiment of the present invention, the regression prediction head includes a regression prediction splicer, a regression prediction convolution module, and a regression prediction transposed convolution module connected in sequence, where

[0124] For any two concatenated regression prediction heads, along the concatenation direction, the regression prediction transposed convolution module of the previous regression prediction head is connected to the regression prediction splicer of the next regression prediction head;

[0125] For any regression prediction head, during skip connection, it is connected to the output end of the domain-invariant feature extraction module corresponding to the skip connection through the regression prediction splicer.

[0126] Figure 2 An embodiment of the regression prediction head is shown in. It can be seen from the figure that the regression prediction head may include a regression prediction splicer, a regression prediction convolution module, and a regression prediction transposed convolution module. At this time, when two regression prediction heads are concatenated, the regression prediction transposed convolution module of the previous regression prediction head is connected to the regression prediction splicer of the next regression prediction head, and during skip connection, it is connected to the output end of the domain-invariant feature extraction module corresponding to the skip connection through the regression prediction splicer. Figure 2 Among them, HConv is the regression prediction convolution module, and HIConv is the regression prediction transposed convolution module, that is Figure 2 The regression prediction splicer is not shown in. During specific implementation, the regression prediction transposed convolution module can perform transposed convolution operations.

[0127] During specific implementation, the regression prediction splicer can be used to splice the feature sequences in the channel dimension. For example, if the feature dimensions of two feature sequences are L×C, then after splicing in the channel dimension, the feature dimension of the formed feature sequence is L×2C. The regression prediction convolution module can adopt the same structural form as the above-mentioned domain-invariant convolution module, and specific reference can be made to the above description.

[0128] It should be noted that within the regression prediction unit, the regression prediction head at the head of the concatenation is the above-mentioned one regression prediction head. The connection between the regression prediction head and the domain-invariant feature extraction module at the tail of the concatenation does not use skip connection. At this time, the feature sequence after the domain-invariant attention mechanism output by the domain-invariant feature extraction module at the tail of the concatenation should be directly loaded into the regression prediction convolution module of the regression prediction head at the head of the concatenation. Therefore, for the regression prediction head at the head of the concatenation, the regression prediction splicer can be omitted within the regression prediction head. Of course, the regression prediction splicer can also be retained, but the feature sequence after the domain-invariant attention mechanism should be directly loaded into the regression prediction convolution module of the regression prediction head at the head of the concatenation.

[0129] It should be understood that for other regression prediction heads, the regression prediction splicer will receive the feature sequence after the domain-invariant attention mechanism through skip connections, and will also receive the output of the concatenated regression prediction heads at the same time.

[0130] In specific implementation, when the regression prediction head adopts the above structural form, through the regression prediction convolutional module and the regression prediction transposed convolutional module for depth convolution operations, the non-linear relationship of the quality parameters in the to-be-detected near-infrared spectral data can be captured. After multiple regression prediction heads perform regression prediction in sequence, the to-be-detected multi-scale spatial features can be output by the regression prediction head at the concatenated tail.

[0131] As can be seen from the above description, the quality parameter detection model should be constructed first. Specifically, when constructing the quality parameter detection model, the construction method includes:

[0132] Construct a quality parameter detection basic model, and make a basic model training data set for training the quality parameter detection basic model, where

[0133] The quality parameter detection basic model further includes a reconstruction decoding unit and a discriminator, where the reconstruction decoding unit and the discriminator are both adaptively connected to the domain-invariant feature extraction unit;

[0134] The basic model training data set includes several model data samples. When making the basic model training data set, the near-infrared spectra of the training substances are collected at different training acquisition distances, so as to form a model data sample based on the collected training near-infrared spectral data and the quality labels of the training substances.

[0135] The training substances and the to-be-detected substances belong to the same category of substances, and the training acquisition distances are also within the acquisition thresholds of the multi-distance domain;

[0136] Divide the basic model training data set into at least a training sample set and a validation sample set, so as to use the training sample set to train the multi-distance domain quality parameter detection basic model, and use the validation sample set to verify the multi-distance domain quality parameter detection basic model, where

[0137] When using the training sample set to train the multi-distance domain quality parameter detection basic model, in each batch training process, first train the domain-invariant feature extraction unit, the reconstruction decoding unit and the regression prediction unit in the quality parameter detection basic model, and then train the discriminator;

[0138] After the model training of the basic model for multi-distance domain quality parameter detection reaches the target state, and after the model verification of the basic model for multi-distance domain quality parameter detection is passed using the verification sample set, a multi-distance quality parameter detection model is formed based on the basic model for multi-distance domain quality parameter detection that has reached the target state in model training.

[0139] It should be noted that when constructing the quality parameter detection model, the basic model for quality parameter detection should be constructed first. Different from the above construction of the quality parameter detection model, the basic model for quality parameter detection further includes a reconstruction decoding unit and a discriminator. Specifically, both the reconstruction decoding unit and the discriminator are adaptively connected to the domain-invariant feature extraction unit; that is, in the construction training stage, the reconstruction decoding unit and the discriminator are required for model training, while in the inference stage, the reconstruction decoding unit and the discriminator need to be frozen. The situations of the reconstruction decoding unit and the discriminator will be described separately below.

[0140] In an embodiment of the present invention, the reconstruction decoding unit includes a plurality of sequentially connected reconstruction decoding modules, where

[0141] the number of reconstruction decoding modules in the reconstruction decoding unit is the same as the number of domain-invariant feature extraction modules in the domain-invariant feature extraction unit;

[0142] For any one reconstruction decoding module, the reconstruction decoding module includes a reconstruction decoding splicer, a reconstruction decoding convolutional module, and a reconstruction decoding transposed convolutional module connected in sequence, where

[0143] For any two sequentially connected reconstruction decoding modules, along the connection direction, the reconstruction decoding transposed convolutional module of the previous reconstruction decoding module is connected to the reconstruction decoding splicer in the subsequent reconstruction decoding module;

[0144] When constructing the basic model for quality parameter detection, the domain-invariant feature extraction module is jump-connected to the corresponding reconstruction decoding module, and when jump-connecting, it is connected to the output end of the domain-invariant feature extraction module corresponding to the jump connection through the reconstruction decoding splicer.

[0145] Specifically, the reconstruction decoding unit should include multiple reconstruction decoding modules, and the number of reconstruction decoding modules in the reconstruction decoding unit should be the same as the number of domain-invariant feature extraction modules in the domain-invariant feature extraction unit. For example, Figure 2 shows an embodiment in which the reconstruction decoding unit includes four sequentially connected reconstruction decoding modules. Figure 2Here, N is the number of reconstruction decoding modules. Generally, the reconstruction decoding modules adopt the same structure. For any reconstruction decoding module, it should include a reconstruction decoding splicer, a reconstruction decoding convolutional module, and a reconstruction decoding transposed convolutional module. During specific implementation, when connecting the reconstruction decoding unit and the domain-invariant feature extraction unit, it can be specifically consistent with the connection between the regression prediction unit and the domain-invariant feature extraction unit. For the corresponding connection description, please refer to the relevant connection description between the regression prediction unit and the domain-invariant feature extraction unit, which will not be elaborated here.

[0146] During specific implementation, the output end of the first domain-invariant feature extraction module is connected to the fourth reconstruction decoding module through a skip connection. The output end of the second domain-invariant feature extraction module is connected to the third reconstruction decoding module through a skip connection. The output end of the third domain-invariant feature extraction module is connected to the second reconstruction decoding module through a skip connection. The output end of the fourth domain-invariant feature extraction module is connected to the first reconstruction decoding module, but no skip connection is adopted. For the specific situation of the skip connection, please refer to the above corresponding description. In addition, as can be seen from the above description, for the first reconstruction decoding module, the reconstruction decoding splicer can be omitted. For the specific corresponding connection, please refer to the relevant description of the first review prediction head above, which will not be elaborated here.

[0147] When the reconstruction decoding module adopts the above structural form, convolution operations are performed through the reconstruction decoding convolutional module, and transposed convolution operations are executed through the reconstruction decoding transposed convolutional module. Specifically, upsampling operations are realized through the transposed convolution operations of the reconstruction decoding transposed convolutional module to gradually expand the dimension of the features and restore the spatial information of the input data. When the reconstruction decoding module and the corresponding domain-invariant feature extraction module adopt skip connections, the decoding module of this layer can utilize richer feature information for more accurate reconstruction.

[0148] In an embodiment of the present invention, the discriminator includes a discriminant first linear layer, a discriminant batch normalization layer, a discriminant Mish activation function, a discriminant second linear layer, and a discriminant Sigmoid activation function connected in sequence, where

[0149] When the discriminator is connected to the domain-invariant feature extraction unit, the domain-invariant feature extraction module at the end of the cascade is connected to the discriminant first linear layer of the discriminator.

[0150] Figure 2 An embodiment of the discriminator is shown in Figure 2 where XN3 is the discriminant first linear layer, BN1 is the discriminant batch normalization layer, M1 is the discriminant Mish activation function, XN4 is the discriminant second linear layer, and S1 is the discriminant Sigmoid activation function.

[0151] It should be noted that the discriminator can determine whether the training domain-invariant features generated by the domain-invariant feature extraction unit are real features, thus helping the basic model for quality parameter detection to learn more accurate cross-domain feature representations. The discriminative Mish activation function introduces a non-linear mapping relationship, and the discriminative Sigmoid activation function is a conversion function for predicting probabilities, mapping the output to the interval (0, 1). In specific implementation, when the discriminator is connected to the domain-invariant feature extraction unit, specifically, within the domain-invariant feature extraction unit, the output end of the domain-invariant feature extraction module at the end of the concatenation is connected to the first discriminative linear layer of the discriminator.

[0152] It can be understood that when performing model training, a basic model training dataset should be made, and after making the basic model training dataset, the basic model for quality parameter detection should be trained. The basic model training dataset generally should include multiple model data samples. Among them, each model data sample should include a training near-infrared spectrum data and a quality label. Specifically, the training near-infrared spectrum data is generated by collecting the near-infrared spectrum of the training substance at least. Therefore, the situation of the training near-infrared spectrum data can be consistent with the above-mentioned near-infrared spectrum data to be detected. The quality label in the model data sample is the quality parameter of the training substance.

[0153] In specific implementation, the training substance and the substance to be detected belong to the same type of substance. For example, when the substance to be detected mentioned above can be bauxite, the training substance should also be bauxite. In addition, when collecting the near-infrared spectrum of the training substance, the corresponding training collection distance should also be within the collection threshold of the multi-distance domain, where the training collection distance is the distance corresponding to collecting the near-infrared spectrum of the training substance.

[0154] It should be noted that in order to achieve multi-distance domain generalization, the model data samples in the basic model training dataset should cover multiple different training collection distances. Below, taking the training substance and the substance to be detected as bauxite as an example, the method and process of making the basic model training dataset are described in terms of distance. Specifically:

[0155] Collect 1,336 bauxite samples with a particle size of 0.15 mm after crushing, grinding, and sieving. Place each bauxite sample on a near-infrared spectroscopy collection platform to collect the near-infrared spectroscopy data of each bauxite sample. Among them, the near-infrared spectroscopy collection platform uses the MicroNIR Pro handheld near-infrared spectrometer of VIAVI Corporation. Specifically, the working parameters of the near-infrared spectroscopy collection platform can be set as follows: the spectral wavelength range is 900 - 1700 nm, the resolution is 6.24 nm, and the number of wavelength points is 125, with different distances. In addition, the training collection distances for different bauxite samples are set to 5 mm, 10 mm, 15 mm, 20 mm, and 25 mm respectively. Of course, the training collection distance can also be other situations, which can be specifically selected according to needs.

[0156] As can be seen from the above description, after placing the bauxite sample at the set training collection distance and collecting the near-infrared spectroscopy data using the near-infrared spectroscopy collection platform, preprocessing of standard normal transformation should be performed on each near-infrared spectroscopy data, and the corresponding training near-infrared spectroscopy data can be obtained after preprocessing. In addition, for each bauxite sample, the corresponding quality parameters can be obtained by using the commonly used technical means in this technical field, so as to obtain the corresponding quality label. Based on the training near-infrared spectroscopy data and the quality label, a model training sample can be formed.

[0157] When the training substance is of other types, the corresponding basic model training data set can be constructed by referring to the above method, and no further examples will be given here.

[0158] In order to meet the training requirements, generally, the basic model training data set can be at least divided into a training sample set and a validation sample set to train the multi-distance domain quality parameter detection basic model using the training sample set and verify the multi-distance domain quality parameter detection basic model using the validation sample set. In addition, a test sample set can also be obtained. For example, the basic model training data set can be divided into a training sample set, a validation sample set, and a test sample set in a ratio of 7:1:2. Among them, when dividing, it is necessary to follow the principle that the distance labels (domain labels) of the training set and the validation set do not overlap with the distance labels (domain labels) of the test set. For example, the model data samples with training collection distances of 5 mm, 10 mm, and 15 mm are included in the training sample set and the validation sample set, and the model data samples with training collection distances of 20 mm and 25 mm should only be included in the test sample set.

[0159] When training the basic model for quality parameter detection, the model training conditions should generally be set. Through the set model training conditions, the training of the basic model for quality parameter detection can be configured. Among them, the model training conditions can include the training loss function. Of course, the model training conditions can also include other necessary conditions. For example, the Adam optimizer with a regularization weight of 0.001 can be used, the initial learning rate is set to 0.0001, the ReduceLROnPlateau learning rate decay strategy is adopted, and the learning rate is dynamically adjusted according to the loss value of the validation set. The size of each batch is 64, and the maximum number of iterations is set to 150.

[0160] Since the basic model for quality parameter detection also includes a reconstruction decoding unit and a discriminator, in order to meet the requirements of model training, the present invention adopts a phased training strategy. Specifically, for a batch of training samples in the training sample set, the part except the discriminator is trained first, and then the discriminator is trained. This phased training method helps prevent the discriminator from quickly saturating due to the overly simple output of the initial generator, thereby achieving continuous improvement of the performance of both parties in the two training stages and stable convergence of the model.

[0161] In specific implementation, after using the training sample set to perform one round of model training on the basic model for quality parameter detection, the validated sample set is used to validate the basic model for quality parameter detection after model training, and the learning rate is dynamically adjusted according to the validation set loss to achieve adaptive learning rate control. After using the training sample set to perform 150 rounds of model training on the basic model for quality parameter detection, finally, the comprehensive performance of the trained basic model for quality parameter detection is evaluated on the test set, and its prediction accuracy and generalization ability are quantitatively analyzed.

[0162] It should be noted that after performing 150 rounds of model training on the basic model for quality parameter detection, the basic model for quality parameter detection after the 150th round of model training can generally be configured as a multi-distance quality parameter detection model, that is, the construction of the multi-distance domain quality parameter model is realized.

[0163] In an embodiment of the present invention, the training loss function adopts a comprehensive loss, including regression loss, reconstruction loss, Maximum Mean Discrepancy (MMD) loss, and adversarial loss. The calculation of the training loss function will be specifically described below. Specifically, as can be seen from the above description, the structures commonly used by the regression prediction head and the reconstruction decoding module are basically the same. However, the difference is that the regression prediction unit can obtain a value with a feature dimension of 1 through the prediction output unit. That is, for each training sample in the training sample set, the corresponding quality parameter prediction value can be predicted through the prediction output unit, and the quality parameter prediction value is a value with a feature dimension of 1.

[0164] For the reconstruction decoding unit, a reconstruction decoding linear layer is set in the reconstruction decoding module at the end of the concatenation. Figure 2 XN2 in Figure 2 is the reconstruction decoding linear layer. Near-infrared spectrum reconstruction can be achieved through the reconstruction decoding linear layer, that is, the reconstructed near-infrared spectrum data can be generated through the reconstruction decoding linear layer. The feature dimension of the reconstructed near-infrared spectrum data is consistent with that of the training near-infrared spectrum data, both being L×1. The reconstruction decoding linear layer can adopt the existing common form, as long as it can meet the requirement of generating the reconstructed near-infrared spectrum data.

[0165] The regression loss is used to calculate the difference between the predicted quality parameter value predicted by the prediction output unit and the corresponding quality label of each training sample. Then there is:

[0166]

[0167] Among them, is the regression loss, N is the total number of training samples in the training sample set, represents the i th predicted quality parameter value output by the regression prediction unit for the th training sample, i represents the actual value of the quality parameter of the

[0168] th training sample. i Specifically, the actual value of the quality parameter of the th training sample i can be directly obtained from the quality label of the Figure 2 th training sample. Therefore, the regression loss in Figure 2 is the regression loss calculation using the predicted quality parameter value output by the regression prediction unit.

[0169] The reconstruction loss is used to calculate the difference between the reconstructed near-infrared spectrum data restored by the reconstruction decoding unit and the training samples loaded into the domain-invariant feature extraction unit. Then there is:

[0170]

[0171] Among them, is the reconstruction loss, represents the reconstruction value of the reconstructed near-infrared spectrum data generated based on the i th training sample at the k th wavelength point, represents the near-infrared spectrum value of the i th training sample at the k th wavelength point. m is the number of wavelength points in the training near-infrared spectrum data, that is, the sampling points of the training near-infrared spectrum data. Generally, m should be consistent with the above-mentioned L.

[0172] Figure 2 The reconstruction loss in

[0173] is calculated by using the reconstructed near-infrared spectral data generated by the reconstruction decoding unit. The MMD loss is used to calculate the difference between the training near-infrared spectral data in different distance domains input into the domain-invariant feature extraction unit and the corresponding training domain-invariant features output by the domain-invariant feature extraction unit, so as to promote the quality parameter detection basic model to learn a domain-invariant feature space. For example, if the acquisition distance of one training sample is 5 mm and the acquisition distance of another training sample is 10 mm, the MMD loss is to calculate the difference between the corresponding training domain-invariant features formed after the two training samples are extracted by the domain-invariant feature extraction unit. Its calculation formula is:

[0174]

[0175] where is the MMD loss, and represent the training domain-invariant features output by the domain-invariant feature extraction unit for the training near-infrared spectral data of training sample i and training sample j . and represent the distance domain labels to which training sample i and training sample j belong.

[0176]

[0177] where represents the Euclidean norm. Here, represents the square of the difference in the feature centers between two domains. Assuming that the feature centers of two distance domains are and respectively, the calculation formula for the norm is:

[0178]

[0179] and represent the feature means of the two distance domains at the k th wavelength point. represents the mathematical expectation, and represent and the distributions of the distance domains to which they belong. and represent the feature mapping values of all samples in the distance domains and for and Take the average for the set of sample features in each domain , .

[0180] For each wavelength point , map it to a high-dimensional feature space using, for example, the RBF kernel function. In this feature space, each component represents the similarity to a specific center point. Suppose there is a set of center points , then the mapping of the RBF kernel function can be expressed as,

[0181]

[0182] where, is usually selected from the training samples or uses fixed sampling wavelength points, then there is:

[0183] , is the hyperparameter of the RBF kernel function.

[0184] It should be noted that when performing the above mapping, in addition to using the above RBF kernel function, other mapping functions can also be used, and no further examples will be given here.

[0185] When calculating the adversarial loss, adversarial discriminative features need to be loaded into the discriminator, and the calculation method is as follows:

[0186]

[0187] where, is the adversarial loss, represents the discriminator, represents the adversarial discriminative features input to the discriminator, is the label status corresponding to the adversarial discriminative features. The adversarial discriminative features are real discriminative features or false discriminative features. When the adversarial discriminative features are real discriminative features, the label status corresponding to the adversarial discriminative features is 1, and when the adversarial discriminative features are false discriminative features, the label status corresponding to the adversarial discriminative features is 0.

[0188] It should be noted that the real discriminative features are the feature sequences after the domain-invariant attention mechanism loaded by the domain-invariant feature extraction unit at the concatenated tail, and the false discriminative features are the features generated by simulating the domain-invariant attention mechanism using a normal distribution. Therefore, Figure 2The normal distribution herein specifically refers to that the false discriminant features conform to the normal distribution. It can be seen from the above description that during model training, N domain-invariant attention mechanism post-feature sequences should be formed. That is, when calculating the adversarial loss, the number of true discriminant features is N, so the number of false discriminant features should also be N. is the discriminant value output by the discriminator for the adversarial discriminant features.

[0189] It should be understood that adversarial learning can be achieved through the above adversarial loss. Through adversarial learning, the quality detection basic model can drive the to-be domain-invariant features extracted from the true discriminant features to tend to the normal distribution.

[0190] It should be noted that when using staged training, in the first step, the discriminator is frozen, and the regression loss, reconstruction loss, and maximum mean discrepancy loss can be calculated, while the adversarial loss is not calculated; in the second step, the discriminator is unfrozen, and then the adversarial loss can be calculated. Specifically, when the training loss function uses the MMD loss, the distance-invariant spectral features can be extracted through the dynamic domain confusion mechanism, forcing the constructed quality parameter detection model to establish a non-linear mapping relationship between the near-infrared spectral data and the material quality parameters.

[0191] Specifically, when using the MMD loss combined with the dynamic domain confusion mechanism, its core goal is to force the quality parameter detection basic model to ignore the differences in near-infrared spectral data in different acquisition distance domains through adversarial training, so as to extract features with cross-domain consistency. Specifically, "dynamic domain confusion" means continuously adjusting the feature space mapping during the training process, making the feature distributions between distance domains gradually overlap. By calculating the MMD distance of the distance domain features in real time and minimizing this distance during backpropagation optimization, it is equivalent to pushing the distance domain features closer in the latent space; at the same time, this confusion process is dynamically adaptive to avoid overfitting caused by single-batch sample bias. Finally, the "distance-invariant spectral features" extracted are manifested as: the relative distances of the feature vectors of the same substance in different distance domains approach in the high-dimensional space. Even if the near-infrared spectral data has non-linear distortion due to the acquisition distance, its deep features can still maintain discriminability, thus improving the robustness of cross-domain prediction.

[0192] It should be noted that the dynamic domain confusion mechanism specifically refers to the structure of the quality parameter detection basic model and the above-mentioned method of model training for the quality parameter detection basic model. When using the validation sample set to validate the quality parameter basic model, only the regression loss is calculated, and the learning rate used for training is adaptively adjusted using the calculated regression loss. For example, the ReduceLROnPlateau learning rate decay strategy is adopted to dynamically adjust the learning rate according to the loss value of the validation set.

[0193] As can be seen from the above description, by training the model in the above manner and reaching the target state, a quality parameter detection model can be obtained. Thereafter, the quality parameter detection model can be used for rapid detection.

[0194] In summary, a rapid detection system based on NIR and multi-distance domain generalization can be obtained, including a rapid detection processing device. Among them, a quality parameter detection model is deployed inside the rapid detection processing device;

[0195] For the near-infrared spectral data to be detected of the substance to be tested, the rapid detection processing device uses the above-mentioned rapid detection method for quality detection processing to output the quality parameters of the substance to be tested after quality detection processing.

[0196] Specifically, the rapid detection processing device can use existing commonly used computer equipment. The quality parameter detection model can be constructed in the above manner and deployed in the rapid detection processing device in a commonly used manner in the technical field. Thereafter, the above-mentioned rapid detection can be performed using the rapid detection processing device. The method of rapid detection can refer to the above description and will not be elaborated here.

[0197] As can be seen from the above description, in the prior art, the traditional deep learning model directly establishes the correlation between the spectrum and the composition through end-to-end mapping. However, its essential defect is that it does not consider the influence of the inevitable sampling distance fluctuation in the industrial scenario on the spectral distribution. When the traditional deep learning model is directly applied to an unknown distance domain after being trained in a fixed distance domain, due to the fact that the distance-related noise patterns such as the intensity attenuation and baseline drift of the spectral signal are highly coupled with the substance composition characteristics, the traditional deep learning model will produce systematic prediction biases due to the domain distribution mismatch.

[0198] To break through this bottleneck, the quality parameter detection model of the present invention forces the domain-invariant feature extraction unit to strip the distance-sensitive information through a generative adversarial mechanism, and uses the discriminator to dynamically distinguish the domain labels to guide the quality parameter detection basic model to learn cross-domain invariant spectral representations; at the same time, the MMD loss is introduced to explicitly constrain the alignment of the multi-distance domain feature distributions in the high-dimensional reproducing kernel Hilbert space, combined with the above-mentioned RBF kernel function to capture the high-order statistical differences, realizing the progressive adaptation of the near-infrared spectral data under different acquisition distances, that is, it can be used to solve the problem of spectral acquisition distance change in the near-infrared detection technology, breaking through the strong dependence of the traditional single-domain modeling paradigm on the sampling distance, and providing an essential technical breakthrough for on-line detection in complex industrial environments.

[0199] The above has schematically described the present invention and its implementation manners. This description is not restrictive. Without departing from the spirit or basic features of the present invention, the present invention can be implemented in other specific forms. What is shown in the drawings is only one of the implementation manners of the present invention, and the actual structure is not limited thereto. Any reference signs in the present invention should not limit the claimed rights. Therefore, if those of ordinary skill in the art are inspired by it and, without departing from the purpose of this creation, design similar structural manners and embodiments to this technical solution without creative efforts, they shall fall within the protection scope of the present invention. In addition, the term "including" does not exclude other elements or steps, and the word "a" before an element does not exclude including "a plurality of" such elements. The plurality of elements stated in the product claims can also be implemented by one element through software or hardware. The words such as "first" and "second" are used to indicate names and do not represent any specific order.

Claims

1. A fast detection method based on NIR and multi-distance domain generalization, characterized in that: The rapid detection method comprises: Providing near infrared spectrum data of the substance to be tested, and loading the near infrared spectrum data to be tested into the constructed quality parameter detection model, so as to use the quality parameter detection model to perform quality detection processing on the near infrared spectrum data to be tested, and generating the quality parameters of the substance to be tested after the quality detection processing, wherein, When providing the near infrared spectrum data to be tested, it at least includes collecting the near infrared spectrum of the substance to be tested, wherein when collecting the near infrared spectrum of the substance to be tested, the collecting distance is within the collecting threshold of the multiple distance domains; During the quality detection process, at least domain invariant feature extraction and multi-scale spatial feature extraction and prediction are performed, wherein: The quality parameter detection model first performs domain-invariant feature extraction on the near-infrared spectrum data to be tested, so as to extract the domain-invariant features of the near-infrared spectrum data to be tested, and then performs multi-scale spatial feature extraction and prediction processing on the domain-invariant features to be tested, so as to generate the quality parameters of the substance to be tested; The quality parameter detection model includes a detection linear layer, a domain invariant feature extraction unit, a regression prediction unit and a prediction output unit, wherein: The detection linear layer is connected to the domain invariant feature extraction unit, and the domain invariant feature extraction unit is adaptively connected to the regression prediction unit; When performing quality inspection, the detection linear layer is used to perform linear transformation on the near-infrared spectrum data to be inspected, and the near-infrared spectrum transformation data to be inspected obtained by the linear transformation is loaded into the domain invariant feature extraction unit; The domain-invariant feature extraction unit is used to extract domain-invariant features from the near-infrared spectrum transformation data to be inspected, and the domain-invariant features to be inspected obtained by the domain-invariant feature extraction are loaded into the regression prediction unit; The regression prediction unit is used to perform multi-scale spatial feature extraction and prediction processing on the invariant features of the to-be-tested domain, and the obtained multi-scale spatial features to be tested are loaded into the prediction output unit; Based on the received multi-scale spatial features of the substance to be tested, the prediction output unit outputs the quality parameters of the substance to be tested; The domain invariant feature extraction unit includes a plurality of domain invariant feature extraction modules connected in series, wherein the domain invariant feature extraction module at the head of the series connection is connected to the detection linear layer; The regression prediction unit comprises a plurality of regression prediction heads connected in series, wherein the number of the regression prediction heads in the regression prediction unit is consistent with the number of the domain invariant feature extraction modules in the domain invariant feature extraction unit, wherein the regression prediction head at the end of the series connection is adaptively connected to the prediction output unit; In the quality parameter detection model, each domain-invariant feature extraction module is jump-connected to the corresponding regression prediction head; When building a quality parameter detection model, the construction method includes: Constructing a basic model for quality parameter detection, and preparing a basic model training data set for training the basic model for quality parameter detection, wherein: The quality parameter detection basic model also includes a reconstruction decoding unit and a discriminator, wherein the reconstruction decoding unit and the discriminator are adaptively connected to the domain invariant feature extraction unit; The basic model training data set includes a plurality of model data samples, wherein when preparing the basic model training data set, near infrared spectra of the training material are collected at different training collection distances to form a model data sample based on the collected training near infrared spectrum data and the quality label of the training material. The training substance and the substance to be tested belong to the same category of substances, and the training acquisition distance is also within the acquisition threshold of the multi-distance domain; The basic model training data set is divided into at least a training sample set and a verification sample set, so as to use the training sample set to perform model training on the basic model for multi-distance domain quality parameter detection, and use the verification sample set to perform model verification on the basic model for multi-distance domain quality parameter detection, wherein: When the training sample set is used to train the basic model of multi-distance domain quality parameter detection, in each batch training process, the detection linear layer, domain invariant feature extraction unit, prediction output unit, reconstruction decoding unit and regression prediction unit in the basic model of quality parameter detection are firstly trained, and then the discriminator is trained; The basic model for multi-distance domain quality parameter detection is trained to reach a target state, and after the basic model for multi-distance domain quality parameter detection is verified using a verification sample set, a quality parameter detection model is formed based on the basic model for multi-distance domain quality parameter detection that has reached a target state through model training.

2. The rapid detection method based on NIR and multi-distance domain generalization according to claim 1 is characterized in that: The domain-invariant feature extraction module includes a domain-invariant convolution module, a domain-invariant downsampling module, and a spatial channel attention module connected in sequence, wherein: For any two domain-invariant feature extraction modules connected in series, along the direction of the series connection, the output end of the spatial channel attention module in the previous domain-invariant feature extraction module is connected to the domain-invariant convolution module in the next domain-invariant feature extraction module; For any domain-invariant feature extraction module, the output end of the spatial channel attention module in the domain-invariant feature extraction module is connected to the corresponding regression prediction head through a skip connection; When performing domain-invariant feature extraction, for any domain-invariant feature extraction module, the domain-invariant feature sequence to be extracted loaded into the current domain-invariant feature extraction module is convolved using the domain-invariant convolution module to extract local features of the domain-invariant feature sequence to be extracted, and generate a domain-invariant convolved feature sequence; A domain-invariant downsampling module is used to downsample the domain-invariant convolution feature sequence to generate a domain-invariant downsampled feature sequence, wherein the feature dimension of the domain-invariant downsampled feature sequence is lower than the feature dimension of the domain-invariant convolution feature sequence; The spatial channel attention module is used to perform attention mechanism processing on the domain-invariant down-sampling feature sequence to generate a domain-invariant post-attention mechanism feature sequence after the attention mechanism processing.

3. The rapid detection method based on NIR and multi-distance domain generalization according to claim 2 is characterized in that: The domain invariant convolution module includes at least two domain invariant convolution submodules connected in series, wherein: For any domain-invariant convolution submodule, the domain-invariant convolution submodule includes a domain-invariant sub-block convolution layer, a domain-invariant batch normalization layer, and a domain-invariant sub-block Mish activation function; When any two domain-invariant convolutional submodules are connected in series, along the direction of the connection, the domain-invariant subblock Mish activation function of the previous domain-invariant convolutional submodule is connected to the domain-invariant subblock convolutional layer in the next domain-invariant convolutional submodule; In the domain-invariant feature extraction module, the domain-invariant convolution submodule at the end of the concatenation is connected to the domain-invariant downsampling module through the corresponding domain-invariant sub-block Mish activation function.

4. The rapid detection method based on NIR and multi-distance domain generalization according to claim 2 is characterized in that: The spatial channel attention module includes a spatial attention mechanism module using residual connection and a channel attention mechanism module using residual connection, wherein: Using the spatial attention mechanism module to perform spatial attention mechanism processing on the domain-invariant down-sampled feature sequence, so as to generate a domain-invariant spatial attention processed feature sequence after the spatial attention mechanism processing; A channel attention mechanism module is used to perform channel attention mechanism processing on the domain-invariant down-sampling feature sequence, so as to generate a domain-invariant channel attention processed feature sequence after the channel attention mechanism processing; Performing a matrix multiplication operation on the feature sequence after the domain-invariant spatial attention processing and the feature sequence after the domain-invariant downsampling, so as to generate a domain-invariant spatial multiplication feature sequence after the matrix multiplication operation; Performing a matrix multiplication operation on the feature sequence after the domain-invariant channel attention processing and the feature sequence after the domain-invariant downsampling, so as to generate a domain-invariant channel multiplied feature sequence after the matrix multiplication operation; A matrix addition operation is performed on the feature sequence after the domain-invariant spatial multiplication and the feature sequence after the domain-invariant channel multiplication to generate a feature sequence after the domain-invariant attention mechanism after the matrix addition operation.

5. The rapid detection method based on NIR and multi-distance domain generalization according to claim 1 is characterized in that: The regression prediction head includes a regression prediction splicer, a regression prediction convolution module and a regression prediction transposed convolution module connected in sequence, wherein: For any two regression prediction heads connected in series, along the direction of the connection, the regression prediction transposed convolution module of the previous regression prediction head is connected to the regression prediction splicer of the next regression prediction head; For any regression prediction head, when a jump connection is used, the output end of the domain-invariant feature extraction module of the corresponding jump connection is connected through the regression prediction splicer.

6. The rapid detection method based on NIR and multi-distance domain generalization according to claim 1 is characterized in that: The reconstruction decoding unit includes a plurality of reconstruction decoding modules connected in series, wherein: The number of reconstruction decoding modules in the reconstruction decoding unit is consistent with the number of domain invariant feature extraction modules in the domain invariant feature extraction unit; For any reconstruction decoding module, the reconstruction decoding module includes a reconstruction decoding splicer, a reconstruction decoding convolution module and a reconstruction decoding transposed convolution module connected in sequence, wherein: For any two reconstruction and decoding modules connected in series, along the direction of the series connection, the reconstruction and decoding transposed convolution module of the previous reconstruction and decoding module is connected to the reconstruction and decoding splicer in the next reconstruction and decoding module; When constructing the basic model for quality parameter detection, the domain invariant feature extraction module is jump-connected to the corresponding reconstruction decoding module, and when the jump connection is made, the reconstruction decoding splicer is connected to the output end of the domain invariant feature extraction module of the corresponding jump connection.

7. A fast detection system based on NIR and multi-range domain generalization, characterized in that: It includes a rapid detection and processing device, wherein a quality parameter detection model is deployed in the rapid detection and processing device; For the near-infrared spectrum data to be tested of the substance to be tested, the rapid detection processing device adopts the rapid detection method described in any one of claims 1 to 6 to perform quality detection processing, so as to output the quality parameters of the substance to be tested after the quality detection processing.

Citation Information

Patent Citations

  • Domain adaptation method using residual attention module

    CN115578593A

  • Garbage category grabbing, classifying and identifying method and system

    CN117688466A