Substance classification method and device based on terahertz spectrum
Through the EfficientVMamba lightweight model combined with Transformer feature extraction, the problem of difficulty in terahertz spectral substance classification is solved, and efficient and accurate substance classification is achieved, suitable for resource-constrained equipment, and non-destructive testing characteristics are provided.
Patent Information
- Application Number
- CN202411108128.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-12-27
AI Technical Summary
In the classification of terahertz spectral substances, the classification accuracy is low and it is difficult to take into account both classification accuracy and training speed. Especially when applying the Transformer network on resource-constrained devices, the calculation complexity is high, resulting in limited performance of lightweight models. .
The terahertz spectrum classification model is constructed based on the EfficientVMamba lightweight model, combined with Transformer global feature extraction and local feature extraction, and the absorption spectrum feature map is generated through preprocessing and feature matching, and the EfficientVMamba-T model is used for identification and classification, reducing hardware resource consumption.
It improves the accuracy and speed of terahertz spectral substance classification, realizes efficient classification on resource-constrained equipment, and uses lossless human detection, significantly improving the accuracy of classification.
Smart Images

Figure CN119198617A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a material classification method and device, in particular to a material classification method and device based on terahertz spectroscopy. Background Art
[0002] At present, when testing drugs and other substances, the detection methods may include chemical methods, spectroscopy, ion mobility spectrometry, chromatography, mass spectrometry, and chromatography-mass spectrometry. Although different detection methods have their own advantages, they also have corresponding limitations, as follows:
[0003] The chemical method has low testing costs, but it is not easy to detect drugs with low content and similar chemical structures. It is generally used in laboratory environments and cannot be tested quickly.
[0004] Spectroscopy mostly refers to the use of X-rays for detection. X-rays have strong penetrating power and can detect the shape of items in a package. However, some drugs can only be seen in their outer contours under X-rays, making it difficult to conduct qualitative analysis. In addition, there are radiation hazards to the human body.
[0005] Ion mobility spectrometry is very sensitive to trace substances and can detect whether there are drug residues in the human body by testing human hair, blood or urine. However, ion mobility spectrometry has low resolution and poor quantitative performance, and is only suitable for detection within a low concentration range;
[0006] Chromatography and mass spectrometry have high sensitivity, but are complex to operate and costly, and are not suitable for on-site testing of drugs.
[0007] With the development of terahertz technology, terahertz waves have been widely used in the field of material detection and have achieved remarkable results. Terahertz waves usually refer to electromagnetic waves with a frequency of 0.1-10THz, a wavelength range of 30μm-3000μm, and a frequency between infrared waves and microwaves. Compared with waves in other frequency bands, terahertz waves have the characteristics of coherence, high penetration, low energy, fingerprint spectrum, and strong water absorption.
[0008] Terahertz time-domain spectroscopy (THZ-TDS) is a common method for obtaining high signal-to-noise ratio spectral data in the terahertz frequency range. The frequency band of terahertz waves covers the vibrational energy levels and rotational energy levels of many macromolecules. It is highly sensitive to intermolecular vibrations, especially to small differences in collective vibration modes and spatial structures. Therefore, terahertz spectroscopy can be used to distinguish substances with similar chemical compositions. The transient, coherent, and broadband characteristics of terahertz spectroscopy can be used to quickly and effectively obtain the internal molecular structure of the drug being tested and the complex interactions between molecules; at the same time, the single photon energy of terahertz waves is also low, which will not cause harm to the human body, nor will it cause electrolysis and separation of the substance being tested. Compared with other spectra, terahertz waves are more suitable for rapid and non-destructive detection of substances such as banned drugs.
[0009] Most of the material detection of terahertz time-domain spectroscopy is based on principal component analysis-traditional machine learning. First, the sample signal is Fourier transformed, then the principal component analysis is used to extract features of different samples, and finally the classification model is established using traditional machine learning; for example, the gradient boosting decision tree model and support vector machine model are used to identify materials in the terahertz spectrum after dimension reduction. However, when some dimensionality reduction methods such as principal component analysis are used to reduce the dimension of some compounds with small overall differences in terahertz time-domain spectral curves, it is easy to lose important feature information of the differences between samples, resulting in poor classification results. If the original terahertz time-domain spectral data is not reduced in dimension, traditional machine learning classification algorithms will find it difficult to classify spectral data with higher dimensions.
[0010] With the development of deep learning, neural networks have shown good results in material detection in multiple categories and complex backgrounds due to their powerful ability to automatically extract features. In order to solve the problem of low classification accuracy of existing machine learning algorithms, the application with publication number CN113344051A uses neural networks to classify terahertz data. The application with publication number CN116310575A uses the ConvNext-Tiny network model and compares it with the currently popular Resnet model, further improving the accuracy of contraband classification and identification.
[0011] For natural data such as terahertz spectra, deep learning can transform raw data into more abstract expressions using some nonlinear structures, realize automatic feature extraction, and improve algorithm performance as data becomes richer. However, convolution can only extract local features through local receptive fields, and the superposition of multiple layers of convolution and pooling operations will gradually reduce the resolution of feature maps, resulting in defects in global feature extraction of the model, thus affecting classification accuracy.
[0012] The rise of Transformer has completely solved some of the drawbacks of neural networks. Transformer uses a self-attention mechanism to capture the global dependencies of input data. Each input position (such as a pixel or feature in an image) can interact with all other positions, thereby better extracting global features. In order to retain the position information of the input sequence in the self-attention mechanism, Transformer introduces position encoding, which enables the model to recognize and utilize the relative position information of the input. Transformer has performed well in the field of natural language processing (NLP) and has gradually expanded to the field of image recognition. For example, VIT (Vision Transformer) has been applied to image and spectral data classification, and its performance is better than CNN. In the application with publication number CN116883933A, MSA-DETR based on the Transformer architecture was used to classify contraband, and good results were achieved. However, the computational complexity of the self-attention mechanism is Ο(N 2 ), where N is the length of the input sequence (the number of pixels for images). Compared to the local operation of convolution, self-attention needs to calculate the correlation between all positions, so the computation is more expensive. As the amount of data increases, the classification accuracy of materials will increase, and the impressive performance achieved by these architectures usually comes from the powerful model size, which makes applying them on resource-constrained devices a key challenge.
[0013] In pursuit of lightweight models, a lot of research has been done to reduce the resource consumption of the model while maintaining competitiveness. Early research on efficient CNNs focused on shrinking the original convolutional blocks through effective group convolutions, lightweight jumps, etc. For Transformer networks, some studies have proposed reducing the computational complexity of VIT and trying to fuse VIT with CNN in lightweight models. However, the lightweighting of VIT usually comes at the expense of the global capture ability in self-attention. Therefore, existing efficient VIT methods have to be limited to local self-attention operations within divided windows, or global self-attention operations only at deeper stages with low resolution. This embarrassing trade-off and the fallback of VIT to CNN hinder the possibility of further improving the performance of lightweight models.
[0014] Some of the applications and reference papers cited above basically use traditional machine learning and deep learning to classify terahertz materials, and a small number of them use Transformer networks. These methods are difficult to take into account both classification accuracy and training speed at the same time.
[0015] From the above description, it can be seen that how to effectively and quickly classify substances is a technical problem that urgently needs to be solved. Summary of the invention
[0016] The purpose of the present invention is to overcome the deficiencies in the prior art and to provide a method and device for material classification based on terahertz spectroscopy, which can effectively meet the needs of material classification, improve the accuracy of classification, and reduce the consumption of hardware resources.
[0017] According to the technical solution provided by the present invention, a material classification method based on terahertz spectroscopy comprises:
[0018] Providing a reference substance group, and constructing a terahertz spectrum classification model for substance classification based on the reference substance group, wherein the reference substance group includes a plurality of reference-type substances;
[0019] Providing a target substance to be classified, and performing terahertz spectrum processing on the target substance to generate an absorption spectrum characteristic diagram of the target substance based on the terahertz spectrum processing on the target substance;
[0020] The absorption spectrum characteristic graph of the target substance is loaded into the above-constructed terahertz spectrum classification model, so as to use the terahertz spectrum classification model to perform identification and classification processing on the absorption spectrum characteristic graph of the target substance, so as to generate the category of the target substance after the identification and classification processing, wherein:
[0021] A category of the target substance is generated for the identification classification, where the category is a corresponding reference-type substance in the reference substance group.
[0022] When generating the absorption spectrum characteristic diagram of the target substance based on the terahertz spectrum processing of the target substance, it includes:
[0023] Performing terahertz time-domain spectral transmission processing on the target substance to obtain a terahertz spectral reference signal and a terahertz spectral signal of the target substance corresponding to the target substance;
[0024] Preprocessing the terahertz spectrum reference signal and the target material terahertz spectrum signal to generate a terahertz spectrum reference target signal and a target material terahertz spectrum target signal respectively after the preprocessing;
[0025] Based on the terahertz spectrum reference target signal and the terahertz spectrum target signal of the target substance, a target absorption coefficient of the target substance is calculated and generated;
[0026] Based on the target absorption coefficient of the target substance, an absorption spectrum characteristic graph of the target substance is generated.
[0027] The preprocessing of the terahertz spectrum signal of the target substance includes:
[0028] Searching and determining a target peak of a terahertz spectrum signal of a target substance, and configuring a target processing window that matches the terahertz spectrum signal of the target substance based on the searched and determined target peak;
[0029] Generate a target material mapping spectrum signal based on the target processing window and the target material terahertz spectrum signal;
[0030] A dimension matching process is performed on the target material mapping spectrum signal based on a preset target dimension to generate a target material terahertz spectrum target signal after the dimension matching process.
[0031] When generating the target material mapping spectrum signal, the target processing window is dot-multiplied with the target material terahertz spectrum signal to generate the target material mapping spectrum signal after the dot multiplication;
[0032] When the dimension matching processing is performed on the target substance mapping spectrum signal, it includes truncation processing or filling processing on the target substance mapping spectrum signal.
[0033] When calculating the target absorption coefficient of the target substance, include:
[0034] The terahertz spectrum reference target signal and the target material terahertz spectrum target signal are subjected to frequency domain conversion processing to generate corresponding terahertz spectrum reference frequency domain signal and target material terahertz spectrum frequency domain signal respectively after the frequency domain conversion processing;
[0035] Filtering the terahertz spectrum reference frequency domain signal and the target substance terahertz spectrum frequency domain signal to generate a terahertz spectrum reference target frequency domain signal and a target substance terahertz spectrum target frequency domain signal respectively;
[0036] Based on the terahertz spectrum reference target frequency domain signal and the target material terahertz spectrum target frequency domain signal, the target absorption coefficient of the target material is calculated and generated. The target absorption coefficient of the target material is:
[0037]
[0038] Wherein, ω is the angular frequency, S(w) is the target frequency domain signal of the terahertz spectrum of the target material; R(w) is the reference target frequency domain signal of the terahertz spectrum; H(w) is the transfer function at frequency ω; d is the thickness of the target material; c is the speed of light in a vacuum; ρ(ω) is the amplitude ratio of the target frequency domain signal of the terahertz spectrum of the target material and the reference target frequency domain signal of the terahertz spectrum; arg(S(w)) is the phase of the target frequency domain signal of the terahertz spectrum of the target material; arg(R(w)) is the phase of the reference target frequency domain signal of the terahertz spectrum; is the phase difference between the target frequency domain signal of the terahertz spectrum of the target material and the reference target frequency domain signal of the terahertz spectrum; n(ω) is the refractive index parameter of the target material; α(ω) is the target absorption coefficient of the target material.
[0039] When generating the absorption spectrum characteristic graph of the target substance, it includes:
[0040] Configure the absorption coefficient frequency band based on the type of target substance;
[0041] The target absorption coefficient of the target substance generated by calculation is screened by using the configured absorption coefficient frequency band, so as to extract the screened target absorption coefficient of the target substance corresponding to the absorption coefficient frequency band;
[0042] Based on the target absorption coefficient after the target substance is screened, an absorption spectrum characteristic diagram of the target substance is generated, wherein the absorption spectrum characteristic diagram of the target substance includes a two-dimensional grayscale diagram of the absorption spectrum of the target substance.
[0043] The terahertz spectrum classification model is generated based on the EfficientVMamba lightweight model, where:
[0044] When a terahertz spectrum classification model is generated based on the EfficientVMamba lightweight model, the terahertz spectrum classification model includes a classification starting layer, a classification identification first module, a classification identification second module, a classification identification third module, a classification identification fourth module and a classifier connected in sequence, wherein:
[0045] When the absorption spectrum characteristic diagram of the target substance is identified and classified, the absorption spectrum characteristic diagram of the target substance is processed in sequence by the starting layer, the first classification and identification module, the second classification and identification module, the third classification and identification module, the fourth classification and identification module and the classifier, and the classifier outputs the category of the target substance.
[0046] When building a terahertz spectroscopy classification model based on a reference material group, it includes:
[0047] A terahertz spectrum classification basic model corresponding to the terahertz spectrum classification model is constructed, and a classification model training data set for training the terahertz spectrum classification basic model is prepared, wherein:
[0048] The classification model training data set includes a number of training samples;
[0049] When preparing the classification model training data set, for each reference class substance in the reference class substance group, the terahertz spectrum information of the reference class substance is obtained, and based on the terahertz spectrum information of each reference class substance, an absorption spectrum characteristic graph corresponding to the reference class substance is prepared, and a training sample in the classification model training data set is formed based on one absorption spectrum characteristic graph;
[0050] The terahertz spectrum classification basic model is trained using the classification model training data set, and when the terahertz spectrum classification basic model training reaches a target state, a terahertz spectrum classification model is formed based on the terahertz spectrum classification basic model.
[0051] The first classification recognition module includes at least one efficient visual state space unit, wherein:
[0052] Each efficient visual state space unit includes two visual state space blocks connected in series;
[0053] For any visual state space block, including the first visual state branch and the second visual state branch,
[0054] Performing local feature extraction using the first branch of the visual state to generate a local feature extraction feature map after the local feature extraction;
[0055] The second branch of the visual state performs global feature extraction based on efficient two-dimensional selective scanning to generate a global feature extraction feature map after global feature extraction;
[0056] A compression-excitation network is used to perform feature balance on a local feature extraction feature map and a global feature extraction feature map, and a patch merging operation is performed after the feature balancing, and a visual state space block processed feature map is generated after the patch merging operation.
[0057] A material classification device based on terahertz spectroscopy includes a material classification terminal, wherein the material classification terminal uses the above-mentioned material classification method to perform identification and classification processing on a target material, so as to generate a category of the target material after the identification and classification processing.
[0058] The advantages of the present invention are as follows: a terahertz spectrum classification model is constructed based on the reference material class. When the terahertz spectrum classification model is constructed and generated based on the EfficientVMamba-T model, the terahertz spectrum classification model has the advantages of trasnfomer global feature extraction and lightweight characteristics, thereby reducing the consumption of hardware resources;
[0059] The terahertz spectrum signal of the target substance is used to obtain the corresponding absorption spectrum characteristic diagram through preprocessing. The absorption spectrum characteristic diagram is identified and classified using the terahertz spectrum classification model to obtain the category of the target substance. That is, terahertz spectrum can effectively meet the needs of material classification. Terahertz detection has the advantages of fast speed, non-destructive detection, and harmlessness to the human body. By obtaining the absorption spectrum data of the target substance, the inherent characteristics of the target substance can be fully explored, thereby significantly improving the accuracy of classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A flow chart of an embodiment of material classification according to the present invention.
[0061] Figure 2 This is a schematic diagram of an embodiment of the terahertz spectrum frequency domain signal of the target substance of the present invention.
[0062] Figure 3 A schematic diagram of an embodiment of the target processing window of the present invention.
[0063] Figure 4 This is a schematic diagram of an embodiment of the terahertz spectrum target signal of the target substance of the present invention.
[0064] Figure 5 This is a schematic diagram of an embodiment of the present invention for classifying target substances using a terahertz spectrum classification model.
[0065] Figure 6 This is a block diagram of an embodiment of the terahertz spectrum classification model of the present invention. DETAILED DESCRIPTION
[0066] The present invention will be further described below in conjunction with specific drawings and embodiments.
[0067] In order to meet the demand for material classification based on terahertz spectroscopy and improve the accuracy of classification, the present invention provides a material classification method based on terahertz spectroscopy. Specifically, the material classification method includes:
[0068] Providing a reference substance group, and constructing a terahertz spectrum classification model for substance classification based on the reference substance group, wherein the reference substance group includes a plurality of reference-type substances;
[0069] Providing a target substance to be classified, and performing terahertz spectrum processing on the target substance to generate an absorption spectrum characteristic diagram of the target substance based on the terahertz spectrum processing on the target substance;
[0070] The absorption spectrum characteristic graph of the target substance is loaded into the above-constructed terahertz spectrum classification model, so as to use the terahertz spectrum classification model to perform identification and classification processing on the absorption spectrum characteristic graph of the target substance, so as to generate the category of the target substance after the identification and classification processing, wherein:
[0071] A category of the target substance is generated for the identification classification, where the category is a corresponding reference-type substance in the reference substance group.
[0072] It should be noted that the reference material group generally includes several reference-type materials. The type of reference-type materials can be selected according to needs, generally based on the requirements of terahertz spectrum processing. For example, when the reference-type materials are subjected to terahertz time-domain spectrum transmission processing, the reference-type materials cannot completely absorb terahertz light. Of course, the target material also needs to meet the same characteristics, that is, the target material cannot completely absorb terahertz light. When classifying materials, it is necessary to determine the category to which the target material belongs. The category of the target material specifically refers to the target material and the corresponding reference-type material in the reference material group, that is, to identify the target material as a corresponding reference-type material in the reference material group.
[0073] In specific implementation, according to the scenario requirements for target substance identification, reference-type substances corresponding to the target substances are provided, and a reference-type substance group can be formed based on all reference-type substances, wherein the reference-type substances corresponding to the target substances, that is, the classification and identification range of the target substances is set using multiple reference-type substances. Therefore, the number of reference-type substances in the reference-type substance group can be selected as needed to satisfy the identification of the target substances within the preset classification range.
[0074] After determining the reference substance group, a terahertz spectrum classification model can be constructed based on the reference substance group, so that the constructed terahertz spectrum classification model can be used to identify and classify the target substances. The method for classifying the target substances can refer to Figure 1 It can be understood that after the terahertz spectrum classification model is constructed, the terahertz light classification model can be used to perform corresponding identification and classification processing on the target substance, that is, the category of the target substance can be obtained.
[0075] In one embodiment of the present invention, when classifying and identifying the target substance, it is necessary to perform terahertz spectrum processing on the target substance, and generate an absorption spectrum characteristic graph of the target substance based on the terahertz spectrum processing of the target substance. After obtaining the absorption spectrum characteristic graph of the target substance, the absorption spectrum characteristic graph of the target substance can be loaded into a terahertz spectrum classification model, so as to use the terahertz spectrum classification model to perform identification and classification processing on the absorption spectrum characteristic graph of the target substance, and the category of the target substance can be obtained after the identification and classification processing. It can be seen from the above description that the category of the target substance is a corresponding reference class substance in the reference substance group. The following specifically describes the process of generating the absorption spectrum characteristic graph of the target substance and the identification and classification processing of the absorption spectrum characteristic graph by the terahertz spectrum classification model.
[0076] In one embodiment of the present invention, when processing the terahertz spectrum of a target substance and generating an absorption spectrum characteristic diagram of the target substance, the method includes:
[0077] Performing terahertz time-domain spectral transmission processing on the target substance to obtain a terahertz spectral reference signal and a terahertz spectral signal of the target substance corresponding to the target substance;
[0078] Preprocessing the terahertz spectrum reference signal and the target material terahertz spectrum signal to generate a terahertz spectrum reference target signal and a target material terahertz spectrum target signal respectively after the preprocessing;
[0079] Based on the terahertz spectrum reference target signal and the terahertz spectrum target signal of the target substance, a target absorption coefficient of the target substance is calculated and generated;
[0080] Based on the target absorption coefficient of the target substance, an absorption spectrum characteristic graph of the target substance is generated.
[0081] In specific implementation, the target substance can be subjected to terahertz time-domain spectroscopy transmission processing in an existing commonly used manner, so that after the terahertz time-domain spectroscopy transmission processing, a terahertz spectroscopy reference signal and a target substance terahertz spectroscopy signal corresponding to the target substance can be obtained. The following example illustrates the method of subjecting the target substance to terahertz time-domain spectroscopy transmission processing. A feasible method is: providing a terahertz time-domain spectrometer (THz-TDS), and when the terahertz time-domain spectrometer is detected to determine that the terahertz time-domain spectrometer is working normally, the target substance can be subjected to terahertz time-domain spectroscopy transmission processing. Specifically, the terahertz time-domain spectrum of air is first collected. At this time, the target substance is not placed in the light beam path of the terahertz time-domain spectrometer, and a terahertz spectroscopy reference signal is formed after the collection; thereafter, the target substance is placed in the light path of the terahertz time-domain spectrometer, and the corresponding terahertz spectroscopy signal of the target substance can be collected using the terahertz time-domain spectrometer.
[0082] It should be noted that the terahertz time-domain spectrometer can use existing commonly used equipment, such as a portable fiber-coupled terahertz spectrometer with dual probes. At this time, the central wavelength of the light wave emitted by the portable fiber-coupled terahertz spectrometer is 1550nm, the spectrum range is 0.1-3THz, the dynamic range in transmission mode is greater than 70db, the fast scanning time is 0-320ps, and the time resolution is 0.1ps. It can be understood that the specific method of processing the target substance through terahertz time-domain spectroscopy transmission and generating terahertz spectral reference signals and target substance terahertz spectral signals can be consistent with the existing ones, Figure 2 An embodiment of the terahertz spectrum signal of the target substance is shown in FIG. Figure 2 In the figure, the horizontal axis is the sampling time, in ps; the vertical axis is the amplitude of the terahertz spectrum signal of the target material. The situation of the terahertz spectrum reference signal can be referred to Figure 2 Example of terahertz spectroscopy signal of target material in Figure 2The Original Signal in is the terahertz spectrum signal of the target substance.
[0083] In order to obtain the absorption spectrum characteristic diagram of the target substance, in an embodiment of the present invention, after obtaining the terahertz spectrum signal and the target substance terahertz spectrum signal, the terahertz spectrum reference signal and the target substance terahertz spectrum signal need to be preprocessed respectively, wherein after the terahertz spectrum reference signal is preprocessed, a terahertz spectrum reference target signal can be generated, and when the terahertz spectrum signal of the target substance is preprocessed, a terahertz spectrum target signal of the target substance can be obtained. Specifically, the terahertz spectrum reference signal and the target substance terahertz spectrum signal are preprocessed mainly to extract useful information and improve data quality, so as to improve the accuracy of identifying and classifying the target substance.
[0084] In specific implementation, the methods for preprocessing the terahertz spectrum reference signal and the terahertz spectrum signal of the target substance are the same. Of course, the methods for preprocessing the terahertz spectrum reference signal and the terahertz spectrum signal of the target substance can also be different. The specific methods can be selected according to needs, so as to achieve the extraction of the required information. The following takes the preprocessing of the terahertz spectrum signal of the target substance as an example to explain the specific preprocessing method and process.
[0085] In one embodiment of the present invention, preprocessing the terahertz spectrum signal of the target substance includes:
[0086] Searching and determining a target peak of a terahertz spectrum signal of a target substance, and configuring a target processing window that matches the terahertz spectrum signal of the target substance based on the searched and determined target peak;
[0087] Generate a target material mapping spectrum signal based on the target processing window and the target material terahertz spectrum signal;
[0088] A dimension matching process is performed on the target material mapping spectrum signal based on a preset target dimension to generate a target material terahertz spectrum target signal after the dimension matching process.
[0089] Figure 2An embodiment of the terahertz spectrum signal of the target substance is shown in FIG. Therefore, for a specific terahertz spectrum signal of the target substance, the target peak value of the terahertz spectrum signal of the target substance can be searched and determined, wherein the existing commonly used technical means can be used to realize the peak search of the terahertz spectrum signal of the target substance, such as defining the peak search condition, and then searching for the peak that meets the peak search condition. Generally, the peak search condition may include peak significance, peak height and / or peak distance, wherein the peak significance specifically refers to the relative height difference between the height of a peak and the corresponding surrounding estimates, and the peak significance can be used to filter out those peaks that are not significant enough compared with the surrounding data, the greater the significance, the more prominent the peak, and the peak height specifically refers to the absolute height threshold of the peak, that is, when the height of a peak is greater than or equal to the peak height, the current sampling point will be regarded as a peak; the peak distance specifically refers to the minimum distance between peaks, and the peak distance can avoid detecting multiple peaks that are too close, and also prevent repeated detection of peaks that are too close.
[0090] In specific implementation, according to the type of target substance and the target substance terahertz spectrum signal of the target substance, the specific peak search conditions can be set with reference to the above description, and the specific conditions are based on the conditions that can satisfy the peak search of the target substance terahertz spectrum signal. After the search, the target peak value can be obtained. In one embodiment of the present invention, the target peak value can be the maximum peak value of the target terahertz spectrum signal, that is, the peak value with the largest amplitude. In addition, when no peak value is detected based on the peak search condition, or the selected peak index is out of range, a prompt of a search error is output.
[0091] After the target peak is searched, a target processing window needs to be configured, wherein the target processing window can be a commonly used window function, and the target area in the terahertz spectrum signal of the target material can be extracted by using the target processing window, and the target area is also the area of interest. The following uses the Tukey window as a reference and generates a target processing window as an example to illustrate the specific configuration method and process of the target processing window of the present invention.
[0092] Specifically, the Tukey window is a window function commonly used in signal processing. It combines the characteristics of a rectangular window and a cosine window and has a smooth transition region. When generating a target processing window based on the Tukey window, it is necessary to set the window length of the configured Tukey window. Among them, the window length of the Tukey window can be: window parameter / time interval between adjacent data points in the signal, and then round the result, that is, window_size = int(window_params / time_interval), where window_size is the window length, window_params is the window parameter, time_interval is the time interval between adjacent data points in the signal, and int is the rounding operation. Specifically, the window parameter can be selected according to actual needs; the time interval between adjacent data points in the signal, that is, the time interval between adjacent data points in the terahertz spectral signal of the target substance, that is, the sampling period of the terahertz spectral signal of the target substance. Therefore, the time interval between adjacent data points in the signal can be determined according to the category of the target substance and the sampling period during terahertz time-domain spectral transmission processing using a terahertz time-domain spectrometer.
[0093] After setting the window length of the Tukey window in the above manner, the Tukey basic window can be configured. When configuring the Tukey basic window, it is necessary to configure the window start parameters. Among them, the window start parameters include a peak left shift parameter and / or a peak right shift parameter. The peak left shift parameter specifically refers to the offset of the starting point of the Tukey basic window relative to the target peak, and the peak right shift parameter specifically refers to the offset of the ending point of the Tukey basic window relative to the target peak. The target peak should be within the main region of the Tukey basic window. Figure 3 The "Ji" - shaped region in the figure is the Tukey basic window. It can be seen from the figure that the characteristics of the Tukey basic window are: flat in the middle and gradually transitioning to zero on both sides; the value in the flat region in the middle of the Tukey basic window remains a constant 1; that is, the flat region in the middle is the main region of the Tukey basic window, and the target peak should be located in the flat region in the middle.
[0094] It should be noted that, for the transition areas on both sides of the middle flat area, the width of the transition area can be controlled by the α parameter (also called taper fraction or taper ratio). The α parameter is a value between 0 and 1, which specifies the percentage of the transition area in the entire window length. A larger α value means a wider transition area and a shorter middle flat part; a smaller α value means a narrower transition area and a longer middle flat part. In a feasible embodiment: the α parameter can be set to 0.25. At this time, the middle flat area accounts for 50%, and the transition areas on both sides of the flat area each account for 25%. In specific implementation, the window starting parameter can be selected according to the situation of the terahertz spectrum signal of the target substance. It can be seen from the above description that the selected window starting parameter is based on the ability to effectively extract the target area.
[0095] From the above description and Figure 3 It can be seen that the dimension of the Tukey basic window is lower than the dimension of the terahertz spectrum signal of the target material, that is, the data length of the Tukey basic window is lower than the data length of the terahertz spectrum signal of the target material. At this time, the Tukey basic window needs to be filled with data. After the data is filled, the Tukey target window can be formed. The Tukey target window is also the above-mentioned target processing window. In specific implementation, after the Tukey basic window is filled with data, the data length of the Tukey target window should be consistent with the data length of the terahertz spectrum signal of the target material. A feasible data filling method can be: fill the starting point and the end point of the Tukey basic window with a value of 0.00001; of course, other data filling methods can also be used, which can be selected according to needs, and will not be listed here one by one. Figure 3 An embodiment of forming a target processing window based on a Tukey target window is shown in FIG. Figure 3 In the example, Tueky window is the Tukey target window.
[0096] The above provides an embodiment of using a Tukey window to form a target processing window. After the target processing window is formed, a target material mapping spectrum signal can be generated based on the target processing window and the target material terahertz spectrum signal. In one embodiment of the present invention, when generating the target material mapping spectrum signal, the target processing window and the target material terahertz spectrum signal are dot-multiplied to generate the target material mapping spectrum signal after the dot multiplication;
[0097] When the dimension matching processing is performed on the target substance mapping spectrum signal, it includes truncation processing or filling processing on the target substance mapping spectrum signal.
[0098] From the above description, it can be seen that the target processing window and the target material terahertz spectrum signal have the same data length. At this time, the target processing window and the target material terahertz spectrum signal can be point-multiplied, where the point multiplication specifically refers to point-by-point multiplication, that is, multiplying the data at the same position, and the target material mapping spectrum signal can be generated according to the result of the multiplication of all position data.
[0099] It can be seen from the above description that after generating the target material mapping spectrum signal, it is necessary to perform dimension matching processing on the target material mapping spectrum signal to generate the target material terahertz spectrum target signal after the dimension matching processing. It can be seen that the data length of the target material terahertz spectrum target signal is consistent with the target dimension of the dimension matching. Generally, the target dimension can be determined according to the category of the target material. For example, when the target material is a drug, the target dimension can be set to 2048, that is, the target material terahertz spectrum target signal should contain spectral signals corresponding to 2048 sampling points.
[0100] Since the data length of the target substance mapping spectral signal may be different from the target dimension, the target substance mapping spectral signal may be truncated or padded according to the data length of the target substance mapping spectral signal when performing the dimension matching process. Since the target substance mapping spectral signal corresponds to the target processing window, at this time, the data length of the target substance mapping spectral signal is from the position corresponding to the starting point of the target processing window to the end position of the target substance mapping spectral signal; when the data length of the target substance mapping spectral signal is greater than the target dimension, a truncation process is performed, wherein when the truncation process is performed, starting from the position corresponding to the starting point of the target processing window until the target dimension is reached, the remaining data points after reaching the target dimension position are truncated. It can be understood that when the data length of the target substance mapping spectral signal is less than the target dimension, a filling process is performed, and when filling, the data length of the target substance mapping spectral signal is mainly filled to the target dimension, and the filled data is preferably 0, Figure 4 An embodiment of forming a target signal of a terahertz spectrum of a target substance after truncation or filling is shown in FIG.
[0101] It can be seen from the above description that an embodiment of preprocessing the terahertz spectrum signal of the target material and generating the terahertz spectrum target signal of the target material is given; when the same preprocessing method is used for the terahertz spectrum reference signal, the above preprocessing process description can be referred to, and examples will not be given one by one here.
[0102] In one embodiment of the present invention, when calculating and generating a target absorption coefficient of a target substance, the method includes:
[0103] The terahertz spectrum reference target signal and the target material terahertz spectrum target signal are subjected to frequency domain conversion processing to generate corresponding terahertz spectrum reference frequency domain signal and target material terahertz spectrum frequency domain signal respectively after the frequency domain conversion processing;
[0104] Filtering the terahertz spectrum reference frequency domain signal and the target substance terahertz spectrum frequency domain signal to generate a terahertz spectrum reference target frequency domain signal and a target substance terahertz spectrum target frequency domain signal respectively;
[0105] Based on the terahertz spectrum reference target frequency domain signal and the target material terahertz spectrum target frequency domain signal, the target absorption coefficient of the target material is calculated and generated. The target absorption coefficient of the target material is:
[0106]
[0107] Wherein, ω is the angular frequency, S(w) is the target frequency domain signal of the terahertz spectrum of the target material; R(w) is the reference target frequency domain signal of the terahertz spectrum; H(w) is the transfer function at frequency ω; d is the thickness of the target material; c is the speed of light in a vacuum; ρ(ω) is the amplitude ratio of the target frequency domain signal of the terahertz spectrum of the target material and the reference target frequency domain signal of the terahertz spectrum; arg(S(w)) is the phase of the target frequency domain signal of the terahertz spectrum of the target material; arg(R(w)) is the phase of the reference target frequency domain signal of the terahertz spectrum; is the phase difference between the target frequency domain signal of the terahertz spectrum of the target material and the reference target frequency domain signal of the terahertz spectrum; n(ω) is the refractive index parameter of the target material; α(ω) is the target absorption coefficient of the target material.
[0108] As can be seen from the above description, the terahertz spectrum reference target signal and the target material terahertz spectrum target signal both contain target dimension data points, wherein each data point corresponds to a sampling time and an amplitude corresponding to the sampling time. Therefore, the target absorption coefficient of the target material calculated by the present invention specifically refers to the target absorption coefficient of a data point, wherein the target absorption coefficient of each data point can be calculated in the same way.
[0109] Specifically, the terahertz spectrum reference target signal and the terahertz spectrum target signal of the target material can be frequency-domain converted by means of fast Fourier transform, that is, the terahertz spectrum reference target information is fast Fourier transformed to generate a corresponding terahertz spectrum reference frequency-domain signal; the terahertz spectrum target signal of the target material is fast Fourier transformed to generate a corresponding terahertz spectrum frequency-domain signal of the target material. The method and process of frequency-domain conversion processing using Fourier transform can be consistent with the existing method of time-domain-frequency domain conversion, which will not be repeated here.
[0110] After obtaining the terahertz spectrum reference frequency domain signal and the target substance terahertz spectrum frequency domain signal, frequency domain filtering can be performed. It can be seen from the above description that the terahertz spectrum reference frequency domain signal and the target substance terahertz spectrum frequency domain signal can be generated by fast Fourier transform, and after fast Fourier transform, the frequency domain signal has symmetry. Therefore, when performing frequency filtering, only half of the frequency domain signal can be taken to avoid redundancy. In one embodiment of the present invention, for the terahertz spectrum reference frequency domain signal and the target substance terahertz spectrum frequency domain signal, a frequency point with a frequency greater than 0 is selected, so that after the frequency point selection, the terahertz spectrum reference target frequency domain signal and the target substance terahertz spectrum target frequency domain signal can be generated respectively. It can be understood that when the target dimension is 2048, the terahertz spectrum reference target frequency domain signal and the target substance terahertz spectrum target frequency domain signal include 1024 frequency point signals.
[0111] After obtaining the target frequency domain signal based on the terahertz spectrum reference and the target frequency domain signal of the terahertz spectrum of the target material, the target absorption coefficient of the corresponding frequency point can be calculated. Therefore, for a certain frequency point, the corresponding angular frequency ω can be determined. After that, the above calculation formula can be sampled to calculate the target absorption coefficient of the current frequency point. For all frequency points, the corresponding target absorption coefficient can be calculated in the same calculation method, thereby calculating multiple target absorption coefficients.
[0112] In one embodiment of the present invention, when generating an absorption spectrum characteristic graph of a target substance, the process includes:
[0113] Configure the absorption coefficient frequency band based on the type of target substance;
[0114] The target absorption coefficient of the target substance generated by calculation is screened by using the configured absorption coefficient frequency band, so as to extract the screened target absorption coefficient of the target substance corresponding to the absorption coefficient frequency band;
[0115] Based on the target absorption coefficient after the target substance is screened, an absorption spectrum characteristic diagram of the target substance is generated, wherein the absorption spectrum characteristic diagram of the target substance includes a two-dimensional grayscale diagram of the absorption spectrum of the target substance.
[0116] From the above description, it can be seen that the frequencies of the corresponding frequency points of the terahertz spectrum reference target frequency domain signal and the target substance terahertz spectrum target frequency domain signal are both greater than 0. When configuring the absorption coefficient frequency band, it should generally be related to the type of target substance. For example, when the target substance is a drug, the reference substance in the reference substance group is generally also a drug. For example, when the reference substance is monoacetylmorphine, beta-phenylethylamine, ketamine, papaverine and other drugs, the frequency domain of interest can be 0-2.5 THz. At this time, the absorption coefficient frequency band is configured to be 0-2.5 THz. The frequency domain of interest specifically refers to the frequency range of the standard absorption peak distribution. When the target substance is of other categories, the corresponding absorption coefficient frequency band can be selected to effectively select all standard absorption peaks.
[0117] It can be seen from the above description that for a target frequency domain signal of the terahertz spectrum of a target substance, multiple target absorption coefficients can be calculated; after the absorption coefficient frequency band is configured, the target absorption coefficient of the calculated target substance can be screened using the configured absorption coefficient frequency band to extract the target absorption coefficient of the target substance after screening corresponding to the absorption coefficient frequency band. Based on the target absorption coefficients of all the target substances after screening, an absorption spectrum characteristic diagram of the target substance is generated. Specifically, the absorption spectrum characteristic diagram can be a two-dimensional grayscale diagram of the absorption spectrum, that is, the absorption spectrum characteristic diagram is a two-dimensional grayscale diagram. The specific method and process of generating the absorption spectrum characteristic diagram can be consistent with the prior art.
[0118] In one embodiment of the present invention, the terahertz spectrum classification model is generated based on the EfficientVMamba lightweight model, wherein:
[0119] When a terahertz spectrum classification model is generated based on the EfficientVMamba lightweight model, the terahertz spectrum classification model includes a classification starting layer, a classification identification first module, a classification identification second module, a classification identification third module, a classification identification fourth module and a classifier connected in sequence, wherein:
[0120] When the absorption spectrum characteristic diagram of the target substance is identified and classified, the absorption spectrum characteristic diagram of the target substance is processed in sequence by the starting layer, the first classification and identification module, the second classification and identification module, the third classification and identification module, the fourth classification and identification module and the classifier, and the classifier outputs the category of the target substance.
[0121] In order to reduce the consumption of hardware resources, the terahertz spectrum classification model of the present invention can be generated based on the EfficientVMamba lightweight model. Figure 5 and Figure 6An embodiment of generating a terahertz spectrum classification model based on the EfficientVMamba lightweight model is shown. It should be noted that there are three model variants of the EfficientVMamba lightweight model, namely: EfficientVMamba-T, EfficientVMamba-S, and EfficientVMamba-B, which correspond to different scales of the model. EfficientVMamba-T is the lightest model, and EfficientVMamba-B is the most complex model. Considering the amount of data and the size of the absorption spectrum characteristic diagram, preferably, the terahertz spectrum classification model of the present invention is constructed based on EfficientVMamba-T. It can be understood that when the terahertz spectrum classification model is constructed based on EfficientVMamba-T, the terahertz spectrum classification model has the advantages of Trasnfomer global feature extraction and greatly reduces the consumption of hardware resources (lightweight).
[0122] Figure 5 An embodiment of using the terahertz spectrum classification model to identify and classify the absorption spectrum characteristic graph is shown in the figure. The classification starting layer is a Stem module similar to VIT. The classification starting layer can be used to divide the absorption spectrum characteristic graph of the target substance, that is, to divide the absorption spectrum characteristic graph into patches. In order to adapt to the size of the absorption spectrum characteristic graph of the target substance, when the classification starting layer uses the Stem module, the convolution kernel size of the Stem module is changed from 4*4 to 2*2, and the stride is also changed from 4 to 2. While reducing the amount of calculation, it can also improve the accuracy of identifying and classifying the target substance. In specific implementation, when the corresponding characteristic size of the absorption spectrum characteristic graph of the target substance is H×W×1, after being processed by the classification starting layer, the classification starting layer characteristic graph can be obtained, wherein the size of the classification starting layer characteristic graph is
[0123] The classification starting layer is connected to the first classification recognition module, and the first classification recognition module, the second classification recognition module, the third classification recognition module, the fourth classification recognition module and the classifier are connected in sequence, wherein after being processed by the fourth classification recognition module, the classifier can output the category of the target substance; it should be noted that the classifier Figure 5 as well as Figure 6 Not shown in the figure, the classifier can adopt the default classification network in EfficientVMamba-T.
[0124] In one embodiment of the present invention, the first classification and recognition module includes at least one efficient visual state space unit, wherein:
[0125] Each efficient visual state space unit includes two visual state space blocks connected in series;
[0126] For any visual state space block, including the first visual state branch and the second visual state branch,
[0127] Performing local feature extraction using the first branch of the visual state to generate a local feature extraction feature map after the local feature extraction;
[0128] The second branch of the visual state performs global feature extraction based on efficient two-dimensional selective scanning to generate a global feature extraction feature map after global feature extraction;
[0129] A compression-excitation network is used to perform feature balance on a local feature extraction feature map and a global feature extraction feature map, and a patch merging operation is performed after the feature balancing, and a visual state space block processed feature map is generated after the patch merging operation.
[0130] Figure 5 An embodiment of including two efficient visual state space units in the first classification recognition module is shown in FIG. Figure 5 The "x2" in the embodiment specifically refers to an embodiment including two efficient visual state space units, Figure 5 In the description, the second classification identification module, the third classification identification module and the corresponding identifiers in the classification identification modules all represent the same meaning, which can be referred to here and will not be explained one by one.
[0131] When the first classification recognition module includes two efficient visual state space units, the two efficient visual state space units are connected in series. Figure 5 and Figure 6 , an embodiment of each efficient visual state space unit is shown. In the figure, each efficient visual state space unit includes two visual state space blocks (EVSS) connected in series. Figure 6 An embodiment of a visual state space block is shown in FIG. Figure 6 In , each visual state space block includes two branches, the two branches are a visual state first branch and a visual state second branch; specifically, Figure 6 In the figure, the branch that sets the local feature extraction block is the first visual state branch, the branch that sets the efficient two-dimensional selective scanning block (ES2D) is the second visual state branch, and the feature map connected to the first visual state branch and the second visual state branch is the input feature map of each visual state space block.
[0132] In a specific implementation, when a feature map input to the first branch of the visual state is processed by a local feature extraction block, a local feature map can be obtained, wherein the input feature map can be processed as follows: local features are extracted in each channel through a depthwise separable convolution (the convolution kernel size is 3*3), and then after batch normalization and GELU activation function processing, dimensionality transformation and feature fusion are achieved using a 1*1 convolution, that is, after dimensionality transformation and feature fusion, a local feature map can be obtained.
[0133] When the feature map input to the second branch of the visual state is processed by an efficient two-dimensional selective scanning block, a global feature map can be obtained. When the efficient two-dimensional selective scanning block processes the input feature map, a feasible method is: the efficient two-dimensional selective scanning block efficiently scans the feature map, and performs four different slicing operations on the feature map. Each operation starts from a different starting point, and performs feature extraction according to a skip sampling step length p to complete efficient scanning, so as to realize global feature extraction of the feature map and generate a global feature map.
[0134] In specific implementation, the efficient two-dimensional selective scanning block selectively scans the area on the feature map by skipping sampling the local receptive field, thereby significantly reducing the computational complexity. Due to the small size of the absorption spectrum feature map, the skip sampling step length p is preferably reduced from 4 to 2 to improve the classification and recognition effect.
[0135] Figure 6 An embodiment of an efficient two-dimensional selective scanning block is output in the figure. In the figure, the efficient two-dimensional selective scanning block includes an efficient scanning module, an S6 module and an efficient merging module, wherein the efficient scanning module, the S6 module and the efficient merging module are connected in sequence, and the efficient scanning module can perform the above-mentioned feature extraction according to the skip sampling step length p to complete the efficient scanning. It should be noted that the S6 module in the EfficientVMamba-T model generally includes a cross scanning module, an S6 block and a merging operation module. The S6 block is the core SSM operator, which derives the matrix state transfer matrix A, the input matrix B, and the observation matrix C from the input data x, so that the S6 block can know the context information embedded in the input, ensuring the dynamic nature of the weight in the mechanism. It can be understood that the S6 module of the present invention, as well as the corresponding situations of the cross scanning module, the S6 block and the merging operation module in the S6 module, can adopt the default structural form in the EfficientVMamba-T model.
[0136] In specific implementation, after completing the skip sampling of the feature map, the S6 module further extracts features. Specifically, the S6 module first scans the image feature block along four different directions through the cross scanning module (CSM) in the S6 module: from the upper left to the lower right, from the lower right to the upper left, from the upper right to the lower left, and from the lower left to the upper right corner. In this way, any pixel integrates the information of all other pixels in different directions. After that, the four output features processed by the S6 block are merged using the merging operation module to construct the final 2D feature map. The cross scanning block, the S6 block, and the merging operation module are not included in the image. Figure 6 As shown in the S6 module in the figure, it can be seen from the above description that the cross scanning block, S6 block and merging operation module can adopt the default structure in the EfficientVMamba-T model. Finally, the global spatial feature map can be regrouped through the efficient merging module, and the four obtained 2D feature maps are combined to reconstruct the global structure of the feature map. At this time, the global feature map can be obtained. This integration allows the capture of a wider range of contextual information and effectively balances local details and global context in the feature extraction process.
[0137] In specific implementation, the efficient scanning module, S6 module and efficient merging module constitute an efficient two-dimensional selective scanning block, and the working mode of the efficient two-dimensional selective scanning block is consistent with the working mode of the existing EfficientVMamba-T model. Please refer to the above description for details.
[0138] For the local feature map generated by the first branch of the visual state and the global feature map generated by the second branch of the visual state, a compression-excitation network can be used for feature balance. The compression-excitation network uses the attention mechanism SE block (Squeeze-and-Excitation) to balance the local feature map and the global feature map by explicitly modeling the dependency between feature channels. The balanced local feature extraction feature map and the balanced global feature extraction feature map are extracted, and the patch merging operation commonly used in the Transformer network is used to reduce the spatial resolution of the feature map while increasing the channel dimension, that is, Figure 6 The ⊕ in is a patch merging operation. When two visual state space blocks are connected in series, the output of the first visual state space block is used as the input of the second visual state space block.
[0139] Figure 5An embodiment of the second module of classification recognition is shown. Different from the first module of classification recognition, a downsampling module is added to the second module of classification recognition, that is, in the second module of classification recognition, the downsampling module and two visual state space blocks connected in series constitute a unit body, and the two units are connected in series. The visual state space blocks in the second module of classification recognition can refer to the above description, which will not be repeated here. In specific implementation, the downsampling module in the second module of classification recognition can adopt the default parameters of the EfficientVMamba-T model, and the two visual state space blocks connected in series can refer to the corresponding description of the first module of classification recognition.
[0140] Figure 5 Also shown is an embodiment of the third classification recognition module and the fourth classification recognition module. In the figure, the third classification recognition module and the fourth classification recognition module adopt the same form. In the figure, the third classification recognition module includes 4 third classification recognition sub-modules, each of which includes a downsampling module and two inverted residual modules (Inverted Residual) connected in series; the fourth classification recognition module includes 2 fourth classification recognition sub-modules, each of which includes a downsampling module and two inverted residual modules connected in series. In the specific implementation, the third classification recognition module, the fourth classification recognition module, the downsampling module and the inverted residual module can use the default parameters in the EfficientVMamba-T model.
[0141] When the target substance is a medicine, for the absorption spectrum characteristic diagram of the medicine, the number of input channels of the classification starting layer is adjusted from 3 to 1 to adapt to the absorption spectrum characteristic diagram of the present invention. Figure 5 In the example, for the absorption spectrum feature map with a size of H×W×1, the classification starting layer feature map is output after the classification starting layer, and the size of the classification starting layer feature map is After the first module is classified and identified, the first module feature map is output. The size of the first module feature map is After the second module is classified and identified, the second module feature map is output. The size of the second module feature map is After the classification and recognition third module, the classification and recognition third module feature map is output. The size of the classification and recognition third module feature map is After the classification and recognition fourth module, the classification and recognition fourth module feature map is output. The size of the classification and recognition fourth module feature map is It can be understood that the category of the target substance can be determined by processing the feature graph of the fourth module of classification and recognition using a classifier.
[0142] In specific implementation, C1 can be set to 48. When the number of channels of each subsequent module is determined by multiplication, C2 should be 96, C3 should be 192, and C4 should be 384. It can be understood that when other settings are used, C 1~ The corresponding values of C4 are not listed here one by one.
[0143] In one embodiment of the present invention, when constructing a terahertz spectrum classification model based on a reference material group, it includes:
[0144] A terahertz spectrum classification basic model corresponding to the terahertz spectrum classification model is constructed, and a classification model training data set for training the terahertz spectrum classification basic model is prepared, wherein:
[0145] The classification model training data set includes a number of training samples;
[0146] When preparing the classification model training data set, for each reference class substance in the reference class substance group, the terahertz spectrum information of the reference class substance is obtained, and based on the terahertz spectrum information of each reference class substance, an absorption spectrum characteristic graph corresponding to the reference class substance is prepared, and a training sample in the classification model training data set is formed based on one absorption spectrum characteristic graph;
[0147] The terahertz spectrum classification basic model is trained using the classification model training data set, and when the terahertz spectrum classification basic model training reaches a target state, a terahertz spectrum classification model is formed based on the terahertz spectrum classification basic model.
[0148] Specifically, constructing a terahertz spectrum classification model based on a reference material group specifically refers to constructing a classification model training data set based on the reference material group, and training the terahertz light classification basic model through the classification model training data set. The terahertz spectrum classification model can refer to the description of the above terahertz spectrum classification model.
[0149] As can be seen from the above description, the reference material needs to meet the requirements of terahertz time-domain spectroscopy transmission processing, and is generally a product of the same type as the target material. For example, when the target material is a drug, the reference material is generally also a drug. In this case, each reference material is a corresponding drug. For each reference material, the above method can be used to prepare the absorption spectrum characteristic diagram of the current reference material, which can also refer to the absorption spectrum characteristic diagram of the target material. The specific method and process of preparing the absorption spectrum characteristic diagram can refer to the above description and will not be described here.
[0150] During training, the Adam optimizer can be used to train the model, the number of iterations is set to 300, the batch size is set to 32, and the cosine annealing learning rate is used, with an initial value of 10 -3, and preheated within the first 10 epochs. In terms of training data enhancement, Mixup data enhancement technology is used to mix two samples in the input data by linear interpolation to generate new training samples, so as to increase the diversity and robustness of the training data, thereby improving the generalization ability of the model on the test data.
[0151] During training, the training samples in the classification model training data set can be divided into a training set, a test set, and a validation set. The training set is used to train the terahertz spectrum classification basic model, the test set is used to test the trained model, and the validation set is used to evaluate the performance of the model during the training process and help select the best hyperparameters. In addition, the default loss function of the EfficientVMamba-T model can be used. When the training reaches 300 times, the training of the terahertz spectrum classification basic model is completed. After that, the terahertz spectrum classification basic model with the optimal weight (that is, the model with the best performance on the validation set, that is, the smallest validation loss) is selected as the final terahertz spectrum classification model. Of course, other methods can also be used for training, and the specific method is based on the terahertz spectrum classification model that can be trained.
[0152] From the above description, it can be seen that the material classification device based on terahertz spectroscopy of the present invention includes a material classification terminal, wherein the material classification terminal uses the above-mentioned material classification method to perform identification and classification processing on the target substance to generate the category of the target substance after the identification and classification processing.
[0153] Specifically, the material classification terminal can be an existing commonly used computer terminal device. The type of the material classification terminal can be selected according to actual needs. The method of classifying and identifying the target material can refer to the above description and will not be repeated here.
Claims
1. A material classification method based on terahertz spectroscopy, characterized in that: The substance classification method includes: Providing a reference substance group, and constructing a terahertz spectrum classification model for substance classification based on the reference substance group, wherein the reference substance group includes a plurality of reference-type substances; Providing a target substance to be classified, and performing terahertz spectrum processing on the target substance to generate an absorption spectrum characteristic diagram of the target substance based on the terahertz spectrum processing on the target substance; The absorption spectrum characteristic graph of the target substance is loaded into the above-constructed terahertz spectrum classification model, so as to use the terahertz spectrum classification model to perform identification and classification processing on the absorption spectrum characteristic graph of the target substance, so as to generate the category of the target substance after the identification and classification processing, wherein: A category of the target substance is generated for the identification classification, where the category is a corresponding reference-type substance in the reference substance group.
2. The method for material classification based on terahertz spectroscopy according to claim 1, characterized in that: When processing the terahertz spectrum of the target substance and generating the absorption spectrum characteristic diagram of the target substance, it includes: Performing terahertz time-domain spectral transmission processing on the target substance to obtain a terahertz spectral reference signal and a terahertz spectral signal of the target substance corresponding to the target substance; Preprocessing the terahertz spectrum reference signal and the target material terahertz spectrum signal to generate a terahertz spectrum reference target signal and a target material terahertz spectrum target signal respectively after the preprocessing; Based on the terahertz spectrum reference target signal and the terahertz spectrum target signal of the target substance, a target absorption coefficient of the target substance is calculated and generated; Based on the target absorption coefficient of the target substance, an absorption spectrum characteristic graph of the target substance is generated.
3. The material classification method based on terahertz spectroscopy according to claim 2 is characterized in that: The preprocessing of the terahertz spectrum signal of the target substance includes: Searching and determining a target peak of a terahertz spectrum signal of a target substance, and configuring a target processing window that matches the terahertz spectrum signal of the target substance based on the searched and determined target peak; Generate a target material mapping spectrum signal based on the target processing window and the target material terahertz spectrum signal; A dimension matching process is performed on the target material mapping spectrum signal based on a preset target dimension to generate a target material terahertz spectrum target signal after the dimension matching process.
4. The method for material classification based on terahertz spectroscopy according to claim 3, characterized in that: When generating the target material mapping spectrum signal, the target processing window is dot-multiplied with the target material terahertz spectrum signal to generate the target material mapping spectrum signal after the dot multiplication; When the dimension matching processing is performed on the target substance mapping spectrum signal, it includes truncation processing or filling processing on the target substance mapping spectrum signal.
5. The method for material classification based on terahertz spectroscopy according to claim 2, characterized in that: When calculating the target absorption coefficient of the target substance, include: The terahertz spectrum reference target signal and the target material terahertz spectrum target signal are subjected to frequency domain conversion processing to generate corresponding terahertz spectrum reference frequency domain signal and target material terahertz spectrum frequency domain signal respectively after the frequency domain conversion processing; Filtering the terahertz spectrum reference frequency domain signal and the target substance terahertz spectrum frequency domain signal to generate a terahertz spectrum reference target frequency domain signal and a target substance terahertz spectrum target frequency domain signal respectively; Based on the terahertz spectrum reference target frequency domain signal and the target material terahertz spectrum target frequency domain signal, the target absorption coefficient of the target material is calculated and generated. The target absorption coefficient of the target material is: Wherein, ω is the angular frequency, S(w) is the target frequency domain signal of the terahertz spectrum of the target material; R(w) is the reference target frequency domain signal of the terahertz spectrum; H(w) is the transfer function at frequency ω; d is the thickness of the target material; c is the speed of light in a vacuum; ρ(ω) is the amplitude ratio of the target frequency domain signal of the terahertz spectrum of the target material and the reference target frequency domain signal of the terahertz spectrum; arg(S(w)) is the phase of the target frequency domain signal of the terahertz spectrum of the target material; arg(R(w)) is the phase of the reference target frequency domain signal of the terahertz spectrum; is the phase difference between the target frequency domain signal of the terahertz spectrum of the target material and the reference target frequency domain signal of the terahertz spectrum; n(ω) is the refractive index parameter of the target material; α(ω) is the target absorption coefficient of the target material.
6. The method for material classification based on terahertz spectroscopy according to claim 2, characterized in that: When generating the absorption spectrum characteristic graph of the target substance, it includes: Configure the absorption coefficient frequency band based on the type of target substance; The target absorption coefficient of the target substance generated by calculation is screened by using the configured absorption coefficient frequency band, so as to extract the screened target absorption coefficient of the target substance corresponding to the absorption coefficient frequency band; Based on the target absorption coefficient after the target substance is screened, an absorption spectrum characteristic diagram of the target substance is generated, wherein the absorption spectrum characteristic diagram of the target substance includes a two-dimensional grayscale diagram of the absorption spectrum of the target substance.
7. The method for material classification based on terahertz spectroscopy according to any one of claims 1 to 6, characterized in that: The terahertz spectrum classification model is generated based on the EfficientVMamba lightweight model, where: When a terahertz spectrum classification model is generated based on the EfficientVMamba lightweight model, the terahertz spectrum classification model includes a classification starting layer, a classification identification first module, a classification identification second module, a classification identification third module, a classification identification fourth module and a classifier connected in sequence, wherein: When the absorption spectrum characteristic diagram of the target substance is identified and classified, the absorption spectrum characteristic diagram of the target substance is processed in sequence by the starting layer, the first classification and identification module, the second classification and identification module, the third classification and identification module, the fourth classification and identification module and the classifier, and the classifier outputs the category of the target substance.
8. The method for material classification based on terahertz spectroscopy according to claim 7, characterized in that: When building a terahertz spectroscopy classification model based on a reference material group, it includes: A terahertz spectrum classification basic model corresponding to the terahertz spectrum classification model is constructed, and a classification model training data set for training the terahertz spectrum classification basic model is prepared, wherein: The classification model training data set includes a number of training samples; When preparing the classification model training data set, for each reference class substance in the reference class substance group, the terahertz spectrum information of the reference class substance is obtained, and based on the terahertz spectrum information of each reference class substance, an absorption spectrum characteristic graph corresponding to the reference class substance is prepared, and a training sample in the classification model training data set is formed based on one absorption spectrum characteristic graph; The terahertz spectrum classification basic model is trained using the classification model training data set, and when the terahertz spectrum classification basic model training reaches a target state, a terahertz spectrum classification model is formed based on the terahertz spectrum classification basic model.
9. The method for material classification based on terahertz spectroscopy according to claim 7, characterized in that: The first classification recognition module includes at least one efficient visual state space unit, wherein: Each efficient visual state space unit includes two visual state space blocks connected in series; For any visual state space block, including the first visual state branch and the second visual state branch, Performing local feature extraction using the first branch of the visual state to generate a local feature extraction feature map after the local feature extraction; The second branch of the visual state performs global feature extraction based on efficient two-dimensional selective scanning to generate a global feature extraction feature map after global feature extraction; A compression-excitation network is used to perform feature balance on a local feature extraction feature map and a global feature extraction feature map, and a patch merging operation is performed after the feature balancing, and a visual state space block processed feature map is generated after the patch merging operation.
10. A material classification device based on terahertz spectroscopy, characterized in that: It comprises a substance classification terminal, wherein the substance classification terminal uses the substance classification method described in any one of claims 1 to 9 to perform identification and classification processing on the target substance, so as to generate the category of the target substance after the identification and classification processing.
Citation Information
Cited By
Rock debris identification method and device, electronic equipment and computer storage medium
CN120490008A
Chinese herbal medicine production place identification method
CN121117815A
