Rapid nondestructive testing system based on the fusion of near-infrared spectroscopy and Raman spectroscopy
By combining near-infrared spectroscopy and Raman spectroscopy, the use of automated sample storage containers and smart terminals, the problems of low efficiency and insufficient feature extraction capabilities of the existing spectral detection system are solved, and efficient and accurate sample detection is achieved.
Patent Information
- Application Number
- CN202510609172.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-05-13
AI Technical Summary
The existing spectral detection system has low detection efficiency, limited spectral feature extraction capabilities, poor generalization capabilities of models and more manual interventions, making it difficult to meet the needs of large-scale rapid detection.
A fast non-destructive detection system combining near-infrared spectroscopy and Raman spectroscopy uses a rotatable sample storage container, built-in data processing module and smart terminal to extract features through a dual-mode encoder and optimize feature representations using a contrast learning algorithm to realize the automated acquisition and processing of spectral data.
It significantly improves the detection efficiency and automation level, enhances the spectral feature extraction ability and model generalization ability, reduces manual intervention, and achieves fast and accurate sample detection.
Smart Images

Figure CN120121571B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of spectral detection and analysis, and in particular relates to a rapid non-destructive detection system based on the fusion of near-infrared spectroscopy and Raman spectroscopy. Background Art
[0002] In the fields of agriculture, food safety and bioengineering, the safety and authenticity testing of agricultural products is of great significance.
[0003] Traditional detection methods primarily rely on biochemical analysis techniques such as polymerase chain reaction (PCR) and enzyme-linked immunosorbent assay (ELISA). While these methods offer high accuracy, they suffer from limitations such as long testing cycles, high costs, complex procedures, and demanding laboratory environments, making them difficult to meet the needs of large-scale, rapid testing. Therefore, there is an urgent need for efficient, convenient, and non-destructive detection technologies to improve the screening efficiency of genetically modified agricultural products.
[0004] Spectroscopic detection technology, due to its non-destructive, rapid, and real-time analysis capabilities, has become a key research area in agricultural product testing in recent years. Near-infrared spectroscopy (NIR) and Raman spectroscopy (Raman) each offer advantages in analyzing material composition. NIR primarily reflects the vibrational absorption of organic components in a sample, making it suitable for rapid detection of components such as moisture, protein, and oil. Raman, based on molecular vibrational scattering, is sensitive to the sample's molecular structure and chemical bonding, providing detailed molecular characterization.
[0005] Currently, single spectral technology has certain limitations. Existing spectral detection systems usually have the following problems:
[0006] First, low detection efficiency: Traditional multispectral systems mostly use single-point sampling, which makes it difficult to achieve rapid batch detection;
[0007] Second, the ability to extract spectral features is limited: existing methods rely on traditional machine learning models, which have poor learning capabilities for complex spectral features, resulting in limited detection accuracy.
[0008] Third, the model has poor generalization ability: the spectral characteristics of different varieties and different growth environments vary, resulting in low model transferability and difficulty in applying to different batches of samples;
[0009] Fourth, there is a lot of manual intervention: the spectral data acquisition and analysis process still relies on manual adjustment of the light source, sample position and data processing parameters, which affects the degree of automation and operability of the detection. Summary of the Invention
[0010] The purpose of the embodiments of the present invention is to provide a rapid nondestructive testing system based on the fusion of near-infrared spectroscopy and Raman spectroscopy, aiming to solve the technical problems of low detection efficiency, limited spectral feature extraction capability, poor model generalization ability and high manual intervention in existing spectral detection systems.
[0011] To achieve the above objectives, the present invention provides the following technical solutions.
[0012] An embodiment of the present invention provides a rapid nondestructive testing system based on the fusion of near-infrared spectroscopy and Raman spectroscopy, comprising a testing device and an intelligent terminal; the intelligent terminal is a mobile phone;
[0013] The detection device includes:
[0014] The upper container has a replaceable sample storage container that is rotatably arranged inside the upper container; the top layer of the replaceable sample storage container has an openable screw cover, and the replaceable sample storage container has a compartment structure that is divided into eight areas by four diagonal lines, each diagonal line is divided into two radial lines along the center, and a sample slot is fixed in the middle of each radial line, and the sample slot is used to place the sample to be tested; the bottom layer of the replaceable sample storage container is a light-transmitting structure;
[0015] A middle container is provided with two openings, both of which are provided with glass gates; the two openings are located on the same diameter of the middle container; one opening corresponds to the data collection port of the near-infrared spectrometer, and the other opening corresponds to the data collection port of the Raman spectrometer;
[0016] The lower container is provided with an edge end inside the lower container, and the edge end is connected to the near-infrared spectrometer and the Raman spectrometer through two data lines respectively; data interaction and instruction transmission are carried out between the edge end and the smart terminal. The edge end of the lower container has a data processing unit, which includes a data acquisition control module, a data modeling module, a model adaptation module, an inference and prediction module and an upper sample rotation control module. The upper sample rotation control module is used to control the replaceable sample storage container to rotate in 45° increments inside the upper container.
[0017] Furthermore, the opening provided on the middle container is located directly below the movement path of the sample slot when the replaceable sample storage container rotates, so that the collection ports of the near-infrared spectrometer and the Raman spectrometer can be aligned with the sample on the sample slot.
[0018] Furthermore, the near-infrared spectrometer and the Raman spectrometer are both arranged inside the middle container to collect spectral data of the sample in the upper container;
[0019] The near-infrared spectrometer and the Raman spectrometer are both externally connected to data lines, which are connected to the edge ends of the lower container;
[0020] The near-infrared spectrometer covers the 900nm-1700nm band;
[0021] The Raman spectrometer covers the 271nm-2453nm band, and the laser excitation wavelength of the Raman spectrometer is 785nm.
[0022] Furthermore, the data modeling module is used to process near-infrared and Raman spectral data, including preprocessing, feature extraction, feature fusion, and optimizing feature representation using contrastive learning algorithms; wherein:
[0023] The pre-processing step includes Raman spectrum pre-processing based on near infrared spectrum and near infrared spectrum pre-processing based on Raman spectrum;
[0024] In the feature extraction step, a dual-mode encoder is used for feature extraction, including: using a near-infrared encoder to extract near-infrared spectral features , using Raman encoder to extract Raman spectrum features ; Enhance the spectral features through the feature enhancement module; Combine the global attention module and the cross attention module to optimize the bimodal information interaction;
[0025] In the feature fusion step, feature splicing, weighted fusion, and feature selection dimensionality reduction are used to optimize feature representation. The feature splicing process is represented as follows: , where represents the spectral characteristics after splicing, is the spectral feature after near-infrared spectrum fusion, is the spectral feature after Raman spectrum fusion;
[0026] In the step of optimizing feature representation using the contrastive learning algorithm, data enhancement is first performed, and a positive and negative sample construction strategy based on contrastive learning is adopted to expand data according to the data distribution in different spectral modes; then the contrastive loss is calculated, where the total loss of the model is expressed as:
[0027] ;
[0028] Among them, L is the total loss value of the model, N is the total number of samples, is the feature vector of the i-th sample, is the feature vector of the sample that is positively correlated with the i-th sample; is the feature vector of the jth sample, is a temperature parameter used to control the smoothing degree of contrast loss; Indicates the The feature vector of each sample is obtained; in the model training phase, the back propagation algorithm is used to calculate the gradient of the loss function model parameters, and the model parameters are updated through the gradient; in the model optimization phase, the model weights are adjusted based on the loss function minimization strategy.
[0029] Furthermore, the Raman spectrum preprocessing step based on the near-infrared spectrum includes background correction, noise removal and feature alignment;
[0030] The steps of near-infrared spectrum preprocessing based on Raman spectrum include baseline correction, feature normalization and feature alignment.
[0031] Furthermore, in the step of combining the global attention module and the cross attention module to optimize the bimodal information interaction, the global attention is expressed as: ; ;
[0032] Among them, Q, K, V are the query, key and value of the input feature, d is the feature dimension, is the attention weight matrix, is the weighted global feature;
[0033] Cross attention is expressed as:
[0034] ; ; ; ;
[0035] in, , , Represent the query, key and value of near infrared spectrum respectively, , , Represent the query, key and value of Raman spectrum respectively, represents the attention weight matrix of the near-infrared spectrum, is the attention weight matrix of Raman spectroscopy, is the spectral feature after near-infrared spectrum fusion, is the spectral feature after Raman spectrum fusion, and d represents the feature dimension.
[0036] Furthermore, in the model adaptation module, the similarity between the feature vector of the new data and the feature vector stored in the model is calculated, and data comparison is performed based on the similarity;
[0037] According to the comparison results, the parameters of the model are dynamically adjusted; among them, the learning rate is adjusted according to the gradient of the objective function based on the adaptive learning rate adjustment algorithm, which is expressed as:
[0038] ;
[0039] in, is the current learning rate, is the attenuation factor, is the minimum value of the learning rate, is the sum of squared gradients, is a constant;
[0040] Calculate the accuracy performance index of the model on the validation set to verify the performance of the updated model, which is expressed as:
[0041] ;
[0042] in, represents the number of true positives, represents the number of true negative examples, represents the total sample size;
[0043] When the model validation result is positive, the updated model parameters are saved.
[0044] Furthermore, in the inference prediction module, the pre-trained model is used to predict the real-time spectral data, including:
[0045] Obtain real-time spectral data files and pre-process the data;
[0046] Use convolutional neural network for model inference, expressed as: ,in, and The distribution is the weights and biases of the model, is the normalized input data;
[0047] The prediction results are evaluated by accuracy and F1 value.
[0048] Compared with the existing technology, the rapid nondestructive testing system based on the fusion of near-infrared spectroscopy and Raman spectroscopy of the present invention has the following beneficial effects:
[0049] First, the rotatable, replaceable sample storage container in the upper container of the present invention is divided into eight areas by four diagonal lines. The replaceable sample storage container can rotate the sample in 45° increments, ensuring that multiple samples can be tested sequentially, significantly improving detection efficiency and the degree of automation of sample processing;
[0050] Second, in the middle container of the present invention, both the near-infrared spectrometer and the Raman spectrometer are fixed inside the middle container to collect spectral data of the sample; the collected data is exported via a connecting line; a glass gate is provided at the opening to control the passage of the light beam at the end of shooting or measurement, ensuring unobstructed passage of the light beam during data collection and shielding the light from interference during non-collection periods;
[0051] Third, the lower container of the present invention includes an edge end with a built-in data processing module, and the data processing module includes a data acquisition control module, a data modeling module, a model adaptation module, an inference and prediction module and an upper sample rotation control module, wherein: the data acquisition module is used to initialize the spectrometer and the communication interface, configure the acquisition parameters, start data acquisition, and temporarily store the collected spectral data in a storage unit; the data modeling module is used to preprocess the collected near-infrared and Raman spectral data, including basis preprocessing, feature extraction, feature fusion, and use of a contrastive learning algorithm to optimize feature representation; the model adaptation module is used to dynamically adjust the model parameters using the newly collected data, update the model through an online learning algorithm to adapt to changes in data distribution, and verify the performance of the updated model; the inference and prediction module is used to use the optimized model to perform inference and prediction on the newly collected data, output the prediction results and temporarily store them in a local cache; the above modules work together to ensure the smoothness and efficiency of the entire process from data acquisition to result output.
[0052] In summary, the rapid nondestructive testing system of the present invention overcomes the shortcomings of a single technology in sample testing by combining the advantages of two spectral technologies, thereby improving the accuracy and efficiency of detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention.
[0054] Figure 1 This is an overall diagram of the detection device in the rapid non-destructive detection system based on the fusion of near-infrared spectroscopy and Raman spectroscopy of the present invention;
[0055] Figure 2 An explosion diagram of the detection device provided by the present invention;
[0056] Figure 3 This is a schematic structural diagram of the upper container in the detection device provided by the present invention;
[0057] Figure 4 This is a schematic structural diagram of the middle container in the detection device provided by the present invention;
[0058] Figure 5 This is a schematic structural diagram of the lower container in the detection device provided by the present invention;
[0059] Figure 6 This is the overall flow chart of the edge module of the rapid nondestructive testing system provided by the present invention;
[0060] Figure 7This is a flowchart of near-infrared and Raman depth comparison learning modeling in the rapid nondestructive testing system provided by the present invention.
[0061] The reference numerals are as follows:
[0062] 1. Upper container; 101. Replaceable sample storage container; 1011. Sample slot; 102. Screw cap;
[0063] 2. Middle container; 201. Near-infrared spectrometer; 202. Raman spectrometer;
[0064] 3. Lower container; 301. Edge end; 302. Liquid crystal display;
[0065] 4. Mobile phone. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0067] The specific implementation of the present invention is described in detail below with reference to specific embodiments.
[0068] like Figure 1-Figure 4 In one embodiment of the present invention, a rapid nondestructive detection system based on the fusion of near-infrared spectroscopy and Raman spectroscopy is provided. The rapid nondestructive detection system includes a detection device and an intelligent terminal;
[0069] Preferably, the smart terminal is a mobile phone 4, and the smart terminal may also be an electronic device such as a computer, without specific limitation;
[0070] Specifically, such as Figure 1-Figure 3 As shown, the detection device provided by the present invention includes an upper container 1, wherein a replaceable sample storage container 101 for placing a sample to be detected is provided inside the upper container 1, and the top layer of the replaceable sample storage container 101 has an openable screw cover 102, which can be opened by a threaded connection or a snap connection. In addition, the sample to be detected in the embodiment of the present disclosure can be soybean seeds, corn seeds, or seed powder, etc.
[0071] Preferably, in an embodiment of the present invention, the replaceable sample storage container 101 is a partition structure, which is divided into eight areas by four diagonal lines, and each diagonal line is divided into two radial lines along the center. Therefore, the four diagonal lines total eight radial lines, and a sample slot 1011 is fixed in the middle of each radial line. Each sample slot 1011 is used to place a sample, such as soybean and corn seed samples or sample powder, to ensure uniform distribution of the sample in the container and improve measurement consistency.
[0072] Furthermore, the replaceable sample storage container 101 is rotatably arranged inside the upper container 1, and the screw cover 102 is a black cover, which can block external light, ensuring that the interior of the replaceable sample storage container 101 is in a dark environment, reducing the interference of ambient light, and thus ensuring the accuracy of spectral measurement; the replaceable sample storage container 101 for storing soybean and corn seeds or seed powder samples supports the interchange of powdered and seed-like samples, increasing the applicability and flexibility of the container.
[0073] Furthermore, the bottom layer of the replaceable sample storage container 101 is a light-transmitting structure, specifically made of transparent material, such as transparent glass, which allows the light beams of the near-infrared spectrometer 201 and the Raman spectrometer 202 to pass smoothly, thereby ensuring the accuracy of spectral data acquisition; and the top layer of the replaceable sample storage container 101 is equipped with a screw cover 102. After opening the screw cover 102, it is convenient to put in the sample, which simplifies the sample loading process while maintaining the sealing of the container.
[0074] In addition, the bottom of the replaceable sample storage container 101 is equipped with a rotating device, which is used to rotate the replaceable sample storage container 101 according to a certain time sequence. When configuring the rotating device, those skilled in the art can use an electric motor with a servo function to drive the replaceable sample storage container 101 to rotate, and the specific details are not limited; the embodiment of the present disclosure uses a rotating device to rotate the replaceable sample storage container 101 in increments of 45°, which facilitates the detection of samples in eight areas in sequence, significantly improving the detection efficiency and the degree of automation of sample processing.
[0075] like Figure 1 、 Figure 2 and Figure 4 As shown, the detection device provided by the embodiment of the present invention also includes a middle container 2 with a circular design. The circular structure of the middle container 2 matches the circular structures of the upper container 1 and the lower container 3, which facilitates the connection between the top of the middle container 2 and the upper container 1, and facilitates the connection between the lower container 3 and the bottom of the middle container 2; preferably, the connection method between the middle container 2 and the upper container 1 and the lower container 3 can adopt a threaded connection structure.
[0076] Furthermore, the middle container 2 is provided with two openings, which are located on the same diameter of the middle container 2; one opening corresponds to the data acquisition port of the near-infrared spectrometer 201, and the other opening corresponds to the data acquisition port of the Raman spectrometer 202;
[0077] Preferably, the opening provided on the middle container 2 is located directly below the movement path of the sample slot 1011 when the replaceable sample storage container 101 rotates, so that the collection ports of the near-infrared spectrometer 201 and the Raman spectrometer 202 can be aligned with the sample on the sample slot 1011.
[0078] Preferably, in the embodiment of the present invention, the near-infrared spectrometer 201 covers the 900nm-1700nm band; the Raman spectrometer 202 covers the 271nm-2453nm band, and the laser excitation wavelength of the Raman spectrometer 202 is 785nm.
[0079] Specifically, the near-infrared spectrometer 201 and the Raman spectrometer 202 are both arranged inside the middle container 2 and are used to collect spectral data of the sample in the upper container 1;
[0080] The near-infrared spectrometer 201 and the Raman spectrometer 202 are both externally connected to data lines, which are connected to the edge end 301 in the lower container 3 for realizing spectral data transmission.
[0081] Preferably, in an embodiment of the present invention, glass shutters are provided on both openings to control the passage of the light beam during shooting or at the end of the shooting. The glass shutters can be opened or closed by a button to ensure that the light beam can pass through unimpeded when collecting data, and can block the light during non-collection periods to avoid interference.
[0082] In an optional implementation, the glass gate can adopt an opening and closing mechanism in the existing technology, such as one based on the iris principle, to realize the opening or closing of the glass gate; or a movable light-blocking plate (such as controlling the extension and retraction of a micro telescopic rod to move the light-blocking plate) can be used to control whether the light passes through. The specific structure is not limited; the glass gate in the embodiment of the present disclosure is only used to block the light beam, and those skilled in the art can make reasonable settings as needed.
[0083] Furthermore, the embodiment of the present disclosure provides a near-infrared spectrometer 201 and a Raman spectrometer 202, which work in conjunction with the rotating device of the replaceable sample storage container 101 of the upper container 1. When the sample is rotated in increments of 45°, the near-infrared spectrometer 201 and the Raman spectrometer 202 can detect multiple samples in sequence, thereby significantly improving the detection efficiency and the degree of automation of sample processing.
[0084] like Figure 1 、 Figure 2 and Figure 5 As shown, the detection device provided by the present invention further includes a lower container 3, and an edge end 301 is provided inside the lower container 3. The edge end 301 is connected to the near-infrared spectrometer 201 and the Raman spectrometer 202 through two data lines to realize the transmission of spectral data;
[0085] Optionally, a liquid crystal display 302 for real-time display is further provided on the lower container 3 for synchronous display of data during the collection process, so that the operator can monitor the collection status and results in real time and make timely adjustments and optimizations.
[0086] Preferably, data interaction and command transmission are carried out between the edge terminal 301 and the smart terminal, and multiple communication modes such as Wi-Fi and Bluetooth are supported to ensure the stability and real-time performance of data transmission.
[0087] Please refer to Figure 5 and Figure 6 The edge 301 of the lower container 3 contains a data processing unit, which includes a data acquisition control module, a data modeling module, a model adaptation module, an inference prediction module, and an upper sample rotation control module. The upper sample rotation control module is used to control the replaceable sample storage container 101 to rotate in 45° increments to achieve sample rotation. These modules work together to ensure a smooth and efficient process from data acquisition to result output.
[0088] In the data acquisition control module of the present invention, the near-infrared spectrometer 201 and the Raman spectrometer 202 and their communication interfaces are first initialized, and acquisition parameters such as time and resolution are configured, and the data acquisition process is started. The collected spectral data is then temporarily stored in the data storage unit for subsequent processing and analysis;
[0089] In one implementation, the data modeling module performs preprocessing tasks on near-infrared and Raman spectral data, including preprocessing, feature extraction, feature fusion, and optimizing feature representation using a contrastive learning algorithm, thereby laying the foundation for building an accurate data model;
[0090] In one implementation, the model adaptation module dynamically adjusts model parameters using newly collected data, updates the model through an online learning algorithm to adapt to changes in data distribution, and verifies the performance of the updated model to ensure that the model's predictive ability continues to improve as new data is added;
[0091] In one implementation, the inference prediction module uses the optimized model to perform inference prediction on the newly collected data, outputs the prediction results and temporarily stores them in the local cache to support the final decision;
[0092] In one implementation, the rotation control module is responsible for managing the sample collection order and status, controlling the rotation of the sample stage, and prompting the user to change samples after completing the collection of a set of samples, thereby ensuring the orderly progress of the collection process;
[0093] In addition, the edge end 301 is designed with a data storage unit for temporarily storing the collected spectral data and processed results, ensuring the security and accessibility of the data; the data storage unit is used for data interaction and command transmission with the mobile phone end 4, and supports multiple communication methods such as Wi-Fi and Bluetooth to ensure the stability and real-time performance of data transmission; an LCD display is also provided on the lower container 3 for synchronous display during the acquisition process, enabling the operator to monitor the acquisition status and results in real time and make timely adjustments and optimizations.
[0094] Specifically, such as Figure 6 and Figure 7 As shown, in the data modeling module, the modeling process of near infrared and Raman deep comparative learning is adopted, including the following steps:
[0095] Data input: collected near-infrared and Raman raw spectral data;
[0096] Data preprocessing: The data preprocessing process includes: Raman spectrum preprocessing based on near-infrared spectroscopy, background correction, noise removal and feature alignment to reduce the systematic error between different spectral data sources;
[0097] Among them, the background correction process is expressed as: ;
[0098] The noise removal process is expressed as: ;
[0099] The feature alignment process is expressed as: ;
[0100] in, is the original spectral data, is the average value of the background signal, is the spectral data after background correction, is the spectral data after denoising, is the spectral data after feature alignment, is the denoising algorithm, is the feature alignment algorithm;
[0101] Furthermore, the data preprocessing process also includes: near-infrared spectrum preprocessing based on Raman spectroscopy, baseline correction, feature normalization, and feature alignment to improve the data quality of near-infrared spectrum;
[0102] The purpose of the data preprocessing process provided in the embodiments of the present disclosure is to enhance the quality of data and extract more useful features, thereby improving the accuracy and reliability of subsequent analysis.
[0103] The modeling process also includes a feature extraction step, in which a dual-modal encoder is used. The dual-modal encoder includes a near-infrared encoder (NIR encoder) and a Raman encoder (Raman encoder);
[0104] The near infrared spectral features are extracted using a near infrared encoder and expressed as: ;
[0105] The Raman spectral features are extracted using the Raman encoder and expressed as: ;
[0106] in, An encoder representing the near-infrared spectrum, represents the Raman spectrum encoder; represents the spectral features after preprocessing;
[0107] The feature enhancement module FEM is used to improve the feature representation capability, which can be expressed as:
[0108] ;
[0109] Among them, F is the input spectral feature vector, W is the trainable weight matrix, b is the bias term, σ is the activation function, is the enhanced feature representation;
[0110] Furthermore, the global attention module GAM and the cross attention module are combined to optimize the bimodal information interaction and improve the feature fusion effect; the global attention is expressed as:
[0111] ; ;
[0112] Among them, Q, K, and V are the query, key, and value of the input feature. is the transpose of the key, d is the feature dimension, is the attention weight matrix, is the weighted global feature;
[0113] Cross attention is expressed as:
[0114] ; ; ; ;
[0115] in, , , Represent the query, key and value of near infrared spectrum respectively, , , Represent the query, key and value of Raman spectrum respectively, represents the attention weight matrix of the near-infrared spectrum, is the attention weight matrix of Raman spectroscopy, is the transpose of the near-infrared spectral bond vector, is the transpose of the Raman spectrum bond vector, is the spectral feature after near-infrared spectrum fusion, is the spectral feature after Raman spectrum fusion, d represents the feature dimension;
[0116] The modeling process also includes the step of feature fusion. In the step of feature fusion, feature splicing, weighted fusion, and feature selection and dimensionality reduction are used to optimize feature representation and improve the generalization ability of the model. Among them, the feature splicing process is expressed as: , where represents the spectral characteristics after splicing, is the spectral feature after near-infrared spectrum fusion, is the spectral feature after Raman spectrum fusion;
[0117] The modeling process also includes a contrastive learning step. In this step, data augmentation is first performed, and a positive and negative sample construction strategy based on contrastive learning is adopted to expand the data distribution under different spectral modes to improve the robustness of the model. Then, contrastive loss is calculated. In the supervised contrastive learning framework, the total loss of the model is expressed as:
[0118] ;
[0119] Among them, L is the total loss value of the model, N is the total number of samples, is the feature vector of the i-th sample, is the characteristic vector of the sample that is positively correlated with the i-th sample, is the feature vector of the jth sample, is a temperature parameter used to control the smoothness of contrast loss, Indicates the The feature vector of the sample, It can be i or other indexes, representing any sample in the batch. During the model training phase, the backpropagation algorithm is used to calculate the gradient of the loss function model parameters, and the model parameters are updated through the gradient. During the model optimization phase, the model weights are adjusted based on the loss function minimization strategy to improve detection accuracy and generalization ability.
[0120] Furthermore, in the model adaptation module provided in the embodiment of the present disclosure, the model receives new data input and compares it with the existing features. The similarity between the feature vector of the new data and the feature vector stored in the model is calculated, which is expressed as: ,in, The feature vector representing the new data, Represents the existing feature vector of the model;
[0121] Based on the comparison results between the new data and the existing features, the model parameters are dynamically adjusted. Specifically, an adaptive learning rate adjustment algorithm is used and the learning rate is adjusted according to the gradient of the objective function. The formula is expressed as:
[0122] ;
[0123] Among them, α t is the current learning rate, β is the decay factor, is the minimum value of the learning rate, v t-1 is the sum of the squares of the gradients, c is a constant; α t-1 Indicates the previous learning rate;
[0124] The performance of the updated model is verified by calculating the accuracy of the model and other performance indicators on the validation set. The formula is expressed as:
[0125] ;
[0126] Among them, Accuracy represents the accuracy index, TP represents the number of true positive examples, TN represents the number of true negative examples, and Total Samples represents the total number of samples;
[0127] Finally, when the model validation result is positive, the updated model parameters are saved. That is, if the validation result shows that the model performance has improved, the updated model parameters will be saved.
[0128] Through the above update strategy, the model can continuously adapt to new data and improve the accuracy and robustness of its predictions.
[0129] Furthermore, the inference prediction module uses the pre-trained model to quickly and accurately predict the real-time spectral data, obtains the real-time spectral data file, pre-processes the data, and uses the convolutional neural network to perform model inference, which is expressed as: Y = softmax (W T X norm +b); where W and b distributions are the weights and biases of the model, W T represents the transpose of the weight; X norm is the normalized input data; Y represents the output result of inference;
[0130] Furthermore, the prediction results are evaluated by accuracy and F1 value; this evaluation step ensures that the prediction results of the model are reliable and provides a basis for the final decision.
[0131] Furthermore, the APP provides a user interface for controlling the operation of the detection device, including sample rotation, data acquisition, model training and result viewing; through the APP, users can monitor the collected spectral data and processing results in real time, including feature extraction, model inference and prediction results; in addition, the APP supports data export function, allowing users to export the collected spectral data and analysis results to local or cloud, ensuring the stability and real-time performance of data transmission.
[0132] The above solutions are only examples of preferred embodiments, but are not limited thereto. When implementing the present invention, appropriate replacements and / or modifications can be made according to user needs.
[0133] The number of devices and processing scales described herein are intended to simplify the description of the present invention. Applications, modifications, and variations of the present invention will be readily apparent to those skilled in the art.
[0134] Although the embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the specification and exemplary embodiments. They can be applied to a variety of fields suitable for the present invention. Further modifications will be readily apparent to those skilled in the art. Therefore, the present invention is not limited to the specific details and illustrations shown and described herein without departing from the general concept defined by the claims and their equivalents.
Claims
1. A rapid non-destructive testing system based on the fusion of near-infrared spectroscopy and Raman spectroscopy, including a detection device and an intelligent terminal; It is characterized by: The detection device includes: An upper container (1) is provided with a replaceable sample storage container (101) rotatably disposed inside the upper container (1); the top layer of the replaceable sample storage container (101) has a screw cover (102); the replaceable sample storage container (101) is a partition structure, the partition structure is divided into eight areas by four diagonal lines, each diagonal line is divided into two radial lines along the center, and a sample groove (1011) is provided in the middle of each radial line; the bottom layer of the replaceable sample storage container (101) is a light-transmitting structure; A middle container (2), wherein the middle container (2) is provided with two openings, both of which are provided with glass gates; the two openings are located on the same diameter of the middle container (2); one opening corresponds to the data collection port of the near-infrared spectrometer (201), and the other opening corresponds to the data collection port of the Raman spectrometer (202); A lower container (3), wherein an edge end (301) is provided inside the lower container (3); data interaction and instruction transmission are performed between the edge end (301) and the intelligent terminal, and the edge end (301) has a data processing unit, which includes a data acquisition control module, a data modeling module, a model adaptation module, an inference prediction module, and an upper sample rotation control module, wherein the upper sample rotation control module is used to control the replaceable sample storage container (101) to rotate in increments of 45 degrees inside the upper container (1); In the model adaptation module, the similarity between the feature vector of the new data and the feature vector stored in the model is calculated, and data comparison is performed based on the similarity; According to the comparison results, the model parameters are dynamically adjusted. The learning rate is adjusted based on the adaptive learning rate adjustment algorithm and the gradient of the objective function, which is expressed as: ;in, is the current learning rate, is the attenuation factor, is the minimum value of the learning rate, is the sum of squared gradients, is a constant; Indicates the previous learning rate; Calculate the accuracy performance index of the model on the validation set to verify the updated model performance. When the model validation result is positive, save the updated model parameters.
2. The rapid nondestructive testing system based on the fusion of near infrared spectroscopy and Raman spectroscopy according to claim 1 is characterized in that: The opening provided on the middle container (2) is located directly below the movement path of the sample slot (1011) when the replaceable sample storage container (101) rotates.
3. The rapid nondestructive testing system based on the fusion of near infrared spectroscopy and Raman spectroscopy according to claim 2 is characterized in that: The near-infrared spectrometer (201) and the Raman spectrometer (202) are both arranged inside the middle container (2) and are used to collect spectral data of the sample in the upper container (1); The near-infrared spectrometer (201) and the Raman spectrometer (202) are both externally connected to data lines, and the data lines are connected to the edge end (301) in the lower container (3); The near-infrared spectrometer (201) covers the 900nm-1700nm band; The Raman spectrometer (202) covers a wavelength range of 271 nm to 2453 nm, and the laser excitation wavelength of the Raman spectrometer (202) is 785 nm.
4. The rapid nondestructive testing system based on the fusion of near infrared spectroscopy and Raman spectroscopy according to claim 3 is characterized in that: The data modeling module is used to process near-infrared and Raman spectral data, including preprocessing, feature extraction, feature fusion, and feature representation optimization using contrastive learning algorithms. The pre-processing step includes Raman spectrum pre-processing based on near infrared spectrum and near infrared spectrum pre-processing based on Raman spectrum; In the feature extraction step, a dual-mode encoder is used for feature extraction, including: using a near-infrared encoder to extract near-infrared spectral features ;Use Raman encoder to extract Raman spectrum features ; Enhance the spectral features through the feature enhancement module; Combine the global attention module and the cross attention module to optimize the bimodal information interaction; In the feature fusion step, feature splicing, weighted fusion, and feature selection dimensionality reduction are used to optimize feature representation. The feature splicing process is represented as follows: , where represents the spectral characteristics after splicing, is the spectral feature after near-infrared spectrum fusion, is the spectral feature after Raman spectrum fusion; Concat represents the concatenation operation; In the step of optimizing feature representation using the contrastive learning algorithm, data enhancement is first performed, and a positive and negative sample construction strategy based on contrastive learning is adopted to expand data according to the data distribution in different spectral modes; then the contrastive loss is calculated, where the total loss of the model is expressed as: ; Among them, L is the total loss value of the model, N is the total number of samples, is the feature vector of the i-th sample, is the feature vector of the sample that is positively correlated with the i-th sample; is the feature vector of the jth sample, is a temperature parameter used to control the smoothing degree of contrast loss; Indicates the The feature vector of each sample is obtained; in the model training phase, the back propagation algorithm is used to calculate the gradient of the loss function model parameters, and the model parameters are updated through the gradient; in the model optimization phase, the model weights are adjusted based on the loss function minimization strategy.
5. The rapid nondestructive testing system based on the fusion of near infrared spectroscopy and Raman spectroscopy according to claim 4 is characterized in that: The Raman spectrum preprocessing steps based on near-infrared spectroscopy include background correction, noise removal and feature alignment; The steps of near-infrared spectrum preprocessing based on Raman spectrum include baseline correction, feature normalization and feature alignment.
6. The rapid nondestructive testing system based on the fusion of near infrared spectroscopy and Raman spectroscopy according to claim 5 is characterized in that: In the step of combining the global attention module and the cross attention module to optimize the bimodal information interaction, the global attention is expressed as: ; ; where Q, K, and V are the query, key, and value of the input feature, is the transpose of the key; d is the feature dimension, A is the attention weight matrix, is the weighted global feature; Cross attention is expressed as: ; ; ; ; in, 、 、 Represent the query, key and value of near infrared spectrum respectively, , , Represent the query, key and value of Raman spectrum respectively, represents the attention weight matrix of the near-infrared spectrum, is the attention weight matrix of Raman spectroscopy, is the transpose of the near-infrared spectral bond vector, is the transpose of the Raman spectrum bond vector, is the spectral feature after near-infrared spectrum fusion, is the spectral feature after Raman spectrum fusion, and d represents the feature dimension.
7. The rapid nondestructive testing system based on the fusion of near infrared spectroscopy and Raman spectroscopy according to claim 6 is characterized in that: The accuracy performance index of the model is calculated on the validation set to verify the performance of the updated model, which is expressed as: ; Among them, Accuracy represents the accuracy index, TP represents the number of true positive examples, and TN represents the number of true negative examples. Indicates the total number of samples.
8. The rapid nondestructive testing system based on the fusion of near infrared spectroscopy and Raman spectroscopy according to claim 7 is characterized in that: In the inference prediction module, the pre-trained model is used to predict real-time spectral data, including: Obtain real-time spectral data files and pre-process the data; Use convolutional neural network for model inference, expressed as: , where W and b distributions are the weights and biases of the model, is the normalized input data; W T represents the transpose of the weight; Y represents the output result of the reasoning; The prediction results are evaluated by accuracy and F1 value.
Citation Information
Patent Citations
Device capable of testing transmission absorption spectrum of multiple physical liquid combinations
CN104535512A
Quantitative adulteration detection method for peanut oil based on multiple-source spectroscopic data fusion
CN104807803A
Deep forgery detection method based on balanced contrast learning
CN119068319A
Multispectral target detection method based on adaptive attention mechanism
CN119963962A