Functional group identification method and system, computer equipment and storage medium

By combining the LEC-Former model with self-attention and cross-attention mechanisms, the problem of insufficient accuracy of the Transformer model in infrared spectral signal analysis is solved, achieving efficient identification of complex spectral bands and effective expression of weak peak features, thus improving the accuracy of functional group identification.

CN121347434APending Publication Date: 2026-01-16SOUTHWEAT UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511451067.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-11
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

Existing Transformer models are insufficient in their accuracy of functional group identification when dealing with complex spectral bands with overlapping peak interference in infrared spectral signal analysis. They are also unable to effectively characterize potential characteristic peaks caused by high-dimensional redundancy and peak overlap, and weak peak information is difficult to model effectively.

Method used

The LEC-Former model is adopted to capture the global dependencies between infrared spectral fragments through self-attention mechanism. It combines local peak position change feature enhancement and modality fusion, uses cross-attention mechanism for feature fusion, and introduces bidirectional long short-term memory network (BiLSTM) to capture local continuous change trends, thereby improving the ability to express weak peak features.

Benefits of technology

It enhances the accuracy of identifying complex spectral bands, highlights the response differences of spectral band signals, strengthens the ability to express weak absorption peaks, reduces the risk of weak peak signals being lost in the context of strong peaks and noise, and improves the accuracy of functional group identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121347434A_ABST
    Figure CN121347434A_ABST
Patent Text Reader

Abstract

The invention provides a functional group identification method and system, computer equipment and a storage medium, and belongs to the field of chemical structure detection.The method comprises the steps that an infrared spectrum of a to-be-identified functional group is obtained; dividing the infrared spectrum to obtain a plurality of spectrum segments, performing linear mapping on the plurality of spectrum segments, and embedding position codes to obtain an embedded vector sequence; adding category identifiers to the embedded vector sequences, and capturing a global dependency relationship among the plurality of embedded vector sequences based on a self-attention mechanism to obtain global features; performing independent convolution and channel normalization processing on the plurality of embedded vector sequences to obtain local peak position change features; fusing the local peak position change features and the global features based on a cross attention mechanism to obtain fused features; and performing functional group probability distribution calculation on the feature vectors corresponding to the category identifiers in the fusion features to obtain the functional group type of the to-be-identified functional group. The method ensures the accuracy of the functional group identification method in various environments.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of chemical structure detection, and particularly relates to a functional group recognition method and system, a computer device and a storage medium. BACKGROUND

[0002] Infrared spectrum detection is an analysis method based on the absorption characteristics of molecules to infrared radiation, which can provide rich chemical information for the molecular structure and chemical composition of the research object. With the advantages of rapidity, non-destructiveness and high sensitivity, this method is widely used in the field of chemistry, especially in the analysis of compound structure, the identification of functional groups, and the quality control and synthesis process monitoring of drug ingredients. On this basis, with the continuous expansion of research needs, the application range of infrared spectrum detection has extended to interdisciplinary fields such as environmental monitoring, materials science and food safety, and has shown unique value in the identification of microplastics, the determination of silicate components and the detection of olive oil adulteration. However, to convert the above advantages into reliable detection capabilities, the key lies in the accurate analysis of complex infrared spectra.

[0003] The formation of infrared spectrum is due to the selective absorption of certain wavelengths by different chemical bonds in the target sample under infrared radiation, causing the transition between molecular vibration energy levels, and thus showing representative absorption peaks in the spectrum. Spectroscopists can manually interpret the types of functional groups of target compounds by the wave number position and absorption intensity of the absorption peaks, but this method is highly dependent on experience and has certain subjectivity and errors, and at the same time, the analysis efficiency is low when facing large-scale samples, which is difficult to meet the needs of high-throughput detection and automated analysis. In addition, the infrared spectrum range can be roughly divided into two parts: 400−1350 , 1350−4000 . The region between 400−1350 is called the "fingerprint region", which usually contains a large number of peaks, and the group absorption bands of molecular vibration are highly overlapped, even if the structures of the molecules are similar, the spectra in the fingerprint region can be quite different. Therefore, manual interpretation of infrared spectrum is usually only carried out in the range of 1350−4000 , which means that the differential information in the fingerprint region will be ignored. Traditional spectrum analysis methods based on artificial rules usually rely on significant feature peaks for functional group recognition, but under complex spectrum conditions, their expression ability is limited and the analysis efficiency is low, which is difficult to meet the actual needs, so more efficient and automated feature extraction and recognition means are needed.

[0004] Machine learning methods provide a new paradigm for the identification of functional groups in infrared spectroscopy. By automatically learning the complex mapping between features and labels from large-scale spectral data, researchers can simultaneously determine multiple types of functional groups, breaking through the limitations of traditional methods that rely on artificial rules. Specifically, various algorithms have been introduced in the field of spectral analysis, including unsupervised and supervised learning methods. Krzyżanowski et al. proposed a hybrid method combining expert priority rules and ML classification, which first combined rules and ML algorithms to identify the main functional groups in FTIR spectra. Matyszczak systematically evaluated several traditional classification algorithms, including logistic regression, KNN, random forest, and multilayer perceptron, on the performance of infrared spectral functional group prediction tasks. The results showed that KNN outperformed other models in terms of running efficiency and F1 score. Wang et al. used a support vector machine model for multi-label classification of infrared spectra, achieving accurate identification of 16 functional groups. Although these traditional methods perform stably in feature extraction and pattern recognition, their performance is highly dependent on manual feature engineering, and their ability to analyze high-dimensional nonlinear spectral data is limited. The development of new deep learning network architectures provides technical support for solving spectral analysis. Various deep learning models, such as multilayer perceptron, recurrent neural network, and convolutional neural network, have been successfully applied to spectral analysis, significantly improving the analysis accuracy and generalization ability compared to shallow machine learning models. Acquarelli et al. designed a convolutional neural network framework for molecular spectral classification, and the results showed that CNN outperformed other models in both spectral preprocessing and non-preprocessing scenarios. Enders et al. inputted the spectrum in the form of an image into a convolutional neural network model, successfully training a model suitable for identifying 15 common functional groups, achieving end-to-end automatic identification of spectral images to functional group labels. Lu et al. proposed a lightweight PACE model that effectively integrates local and global information through deep separable convolution, achieving excellent classification results on multiple public spectral datasets.

[0005] The excellent performance of the Transformer in signal, image and text tasks has attracted the attention of existing researchers. Compared with traditional sequence models, the performance advantage comes from the introduction of the self-attention mechanism. The self-attention mechanism is a technology capable of capturing long-range dependencies between different parts of the data, and through a learnable query-key-value (Query-Key-Value) triple mapping, it realizes the adaptive modeling of global features. The infrared spectrum data presents a continuous and ordered structure on the wave number axis, in which there is potential dependency and pattern information between adjacent wave bands, which can be modeled as a one-dimensional sequence signal. The Fcg-Former model proposed by Doan et al. uses the Transformer architecture to identify the functional groups of FTIR spectra, and based on the multi-head attention mechanism, a two-dimensional attention weight matrix is constructed in the wave number dimension to realize the feature interaction modeling across the wave number interval. At the same time, by calculating the attention score of each block, the importance relationship between different blocks is revealed, which confirms that the self-attention mechanism has advantages over traditional CNN in cross-scale feature interaction and long-range dependency modeling. However, the application of the Transformer model in infrared spectrum signal analysis is still in its infancy, resulting in insufficient accuracy when facing complex spectral segments with overlapping peak interference, which in turn restricts its accuracy in functional group identification. SUMMARY

[0006] In order to solve the problem of insufficient accuracy of the existing Transformer model in functional group identification, the present application provides a functional group identification method, system, computer device and storage medium.

[0007] In order to achieve the above purpose, the present application provides the following technical solutions: A functional group identification, comprising: Obtaining an infrared spectrum of a functional group to be identified; dividing the infrared spectrum to obtain a plurality of spectral segments, and performing linear mapping and embedding position coding on the plurality of spectral segments to obtain an embedded vector sequence; Adding a class identifier to the embedded vector sequence, and capturing global dependencies between the plurality of embedded vector sequences based on a self-attention mechanism to obtain global features; independently convolving and channel normalizing the plurality of embedded vector sequences to obtain local peak position change features; and fusing the local peak position change features and the global features based on a cross-attention mechanism to obtain fused features; Performing functional group probability distribution calculation on the feature vectors corresponding to the class identifier in the fused features to obtain the type of the functional group to be identified.

[0008] Optionally, in the functional group identification method provided by the present application, the embedded vector sequence with the added class identifier is processed by the LEC-Former model to obtain the type of the functional group to be identified. The LEC-Former model comprises a global feature modeling module, a local peak change feature enhancement and mode fusion module and a sequence modeling module and a classification module connected in sequence; the local peak change feature enhancement and mode fusion module and the sequence modeling module comprise a deep convolution layer, a channel normalization layer, a point-by-point convolution layer and a cross-attention fusion module connected in sequence.

[0009] Optionally, the functional group identification method provided by the present application further comprises: obtaining the international chemical identifier of the compound and the corresponding standard infrared spectrum, and analyzing the international chemical identifier to obtain the structure information of the compound; performing substructure matching on the compound through a pre-set identifier list, and constructing a multi-label vector according to the substructure matching structure; inputting the standard infrared spectrum of the compound into the untrained LEC-Former model to obtain the functional group type of the compound; performing hyperparameter tuning on the untrained LEC-Former model according to the functional group type of the compound and the difference of the multi-label vector, to obtain the LEC-Former model.

[0010] Optionally, the functional group identification method provided by the present application further comprises: respectively performing independent convolution processing on the plurality of embedded vector sequences to obtain a plurality of independent local peak change features; performing channel normalization and nonlinear transformation processing on the plurality of independent local peak change features to obtain normalized local peak change features; performing point-by-point convolution on the normalized local peak change features to obtain local peak change features with fused cross-channel information.

[0011] Optionally, the functional group identification method provided by the present application further comprises: calculating the similarity between the global feature and the local peak change feature with fused cross-channel information to obtain an attention weight matrix of the global feature to the local peak change feature; performing weighted aggregation on the local peak change feature with fused cross-channel information according to the attention weight matrix to obtain a fusion feature.

[0012] Optionally, the functional group identification method provided by the present application further comprises: capturing local continuous change trend and inter-band long-range dependence features from the fusion feature; performing functional group probability distribution calculation on the feature vector corresponding to the class identifier in the local continuous change trend and inter-band long-range dependence feature to obtain the functional group type of the to-be-identified functional group.

[0013] Optionally, the functional group identification method provided by the present application further comprises: The infrared spectrum is converted by wavelength and transmittance to obtain an infrared spectrum with wavenumber and absorbance as coordinates. The infrared spectrum with wavenumber and absorbance as coordinates is filled with boundary padding and linearly interpolated to obtain the preprocessed infrared spectrum.

[0014] The present invention also provides a functional group recognition system, comprising: The infrared spectral preprocessing module is used to acquire the infrared spectrum of the functional group to be identified; the infrared spectrum is divided into multiple spectral segments, and the multiple spectral segments are linearly mapped and embedded with position codes to obtain an embedding vector sequence; The fusion feature generation module adds category identifiers to the embedded vector sequence and captures the global dependencies between multiple embedded vector sequences based on the self-attention mechanism to obtain global features; it performs independent convolution and channel normalization on multiple embedded vector sequences to obtain local peak position change features; and it fuses the local peak position change features and global features based on the cross-attention mechanism to obtain fusion features. The probability distribution calculation module is used to calculate the functional group probability distribution of the feature vector corresponding to the category identifier in the fused features, so as to obtain the type of functional group to be identified.

[0015] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement any of the steps of a functional group identification method.

[0016] The present invention also provides a computer-readable storage medium storing a computer program that, when loaded by a processor, can execute any of the steps of a functional group identification method.

[0017] The functional group identification method, system, computer device, and medium provided by this invention have the following beneficial effects: Because the functional group identification method provided by this invention can extract local peak position change features from the embedded vector sequence of infrared spectral conversion, and combine the local peak position change features to calculate the functional group type probability, it highlights the response differences of the spectral band signal, strengthens the ability of the identification method to express weak absorption peaks, and can identify functional group types through local features in the face of complex spectral bands with overlapping peak interference, thus ensuring the accuracy of the functional group identification method in various environments. Attached Figure Description

[0018] To more clearly illustrate the embodiments and design schemes of the present invention, the accompanying drawings required for this embodiment will be briefly described below. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of a functional group identification method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the LEC-Former model architecture provided in an embodiment of the present invention; Figure 3 This is one example of comparing the accuracy of various functional group identifications provided in the embodiments of the present invention; Figure 4 This is a second example of comparing the accuracy of various functional group identification methods provided in the embodiments of the present invention. Figure 5 This is a schematic diagram of a functional group recognition system provided in an embodiment of the present invention. Detailed Implementation

[0020] To enable those skilled in the art to better understand and implement the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention.

[0021] Fourier transform infrared spectroscopy (FTIR) is widely used in chemical structure analysis and functional group identification, and is an important tool for analyzing unknown compounds. However, existing machine learning methods still have shortcomings under complex spectral conditions: high-dimensional redundancy and peak overlap prevent the effective characterization of potential characteristic peaks, and the difficulty in effectively modeling weak peak information limits the utilization of key spectral bands. In other words, existing rule-based or machine learning models cannot fully reveal potential structural differences, have limited spectral characterization capabilities, and thus result in insufficient accuracy in functional group identification.

[0022] To address the aforementioned shortcomings, this invention employs a functional group identification model that enhances the representation of weak peak signals. It models the long-range dependencies between infrared spectral peaks using a peak-coupled encoder based on a self-attention mechanism. Simultaneously, it innovatively introduces an LEC module to strengthen local feature perception, achieving enhanced expression of weak peak features and effective integration of discrete peak positions, thus improving the identification capability of key spectral segments of target functional groups. This not only addresses issues such as high-dimensional redundancy, overlapping peak interference, and insufficient weak peak representation in infrared spectra by performing fine-grained modeling of local peak position changes, highlighting response differences in key spectral segments, effectively strengthening the representation of potential feature peaks and suppressing redundant interference, but also improves the signal-to-noise ratio and distinguishability of weak peaks in the feature space, reducing the risk of weak peak signals being lost against strong peak and noise backgrounds. Furthermore, it addresses the difficulty of effectively representing discretely distributed weak peaks in spectral signals due to insufficient correlation. A bidirectional long short-term memory network (BiLSTM) is introduced to embed isolated weak peaks into the dependencies between preceding and following spectral segments to form a continuous representation. While maintaining the advantage of global attention, it enhances the capture and integration of discrete weak peak features, thereby obtaining a coherent and consistent feature expression and improving the accuracy of functional group recognition.

[0023] Example 1 This invention provides a method for functional group identification, specifically as follows: Figure 1 As shown, it includes the following steps: Step 11: Obtain the infrared spectrum of the functional group to be identified; divide the infrared spectrum into multiple spectral segments, perform linear mapping on the multiple spectral segments and embed position codes to obtain an embedding vector sequence.

[0024] In step 11 of the functional group identification method provided by this invention, after acquiring the infrared spectrum of the functional group to be identified, the Fourier Transform Infrared Spectroscopy (FTIR) spectrum can be preprocessed in the following manner before dividing the spectral segments: Step 111: Perform wavelength conversion and transmittance conversion on the infrared spectrum to obtain an infrared spectrum with wavenumber and absorbance as coordinates.

[0025] Step 112: Perform boundary filling and linear interpolation on the infrared spectrum with wavenumber and absorbance as coordinates to obtain the preprocessed infrared spectrum.

[0026] Specifically, in the functional group identification method provided by this invention, the infrared spectrum of the compound whose functional group needs to be identified is first obtained, and data preprocessing is performed to convert the infrared spectrum into an XY file. Considering that the infrared spectrum of the compound may be obtained under different conditions, the horizontal axis may be represented by units of... The wave number, or possibly in units of The wavelength is represented by the x-axis, while the y-axis may represent absorbance or transmittance. Therefore, the infrared spectral data with wavelength on the x-axis needs to be uniformly converted to wavenumber, and the infrared spectral data with transmittance on the y-axis needs to be uniformly converted to absorbance, as shown in formulas (1) and (2): (1) (2) in, For wave number, For wavelength, Transmittance, Absorption rate. After the infrared spectral data has undergone unit conversion, it still needs to be cleaned and standardized. For example, the wavenumbers of the spectral data are inverted to an ascending sequence, and the wavenumber range is set to 400. ~4000 For data that does not meet the range, boundary padding is performed, and data outside the wavenumber range and those with absorbance less than zero are cropped to ensure that all spectral data have a uniform numerical range.

[0027] Furthermore, considering the non-uniform distribution of infrared spectral data, sampling is required to unify the input dimension of all samples. The functional group identification method provided in this invention employs linear interpolation to interpolate the standardized data, transforming the original spectrum into a one-dimensional vector with 600 equally spaced wavenumber points. This preserves the continuity of the spectral data without losing its fine-grained features.

[0028] After the infrared spectrum has completed data preprocessing, the functional group identification method provided by this invention divides the input infrared spectrum into multiple fixed-length segments and converts them into an embedding vector sequence through linear mapping and position encoding, which serves as the input data for the LEC-Former model.

[0029] Furthermore, the functional group identification method provided by this invention can train the LEC-Former model through the following steps: Step 12: Obtain the international chemical identifier and corresponding standard infrared spectrum of the compound, and analyze the international chemical identifier to obtain the structural information of the compound.

[0030] Step 13: Perform substructure matching on the compound using a pre-set list of identifiers, and construct a multi-label vector based on the substructure matching structure.

[0031] Step 14: Input the standard infrared spectrum of the compound into the untrained LEC-Former model to obtain the functional group type of the compound.

[0032] Step 15: Based on the functional group type of the compound and the differences in multi-label vectors, perform hyperparameter tuning on the untrained LEC-Former model to obtain the LEC-Former model.

[0033] Specifically, the functional group identification method provided by this invention achieves infrared spectral analysis and functional group prediction through an end-to-end architecture based on a Transformer encoder. In this embodiment, this architecture is named the LEC-Former model, and the training method of the LEC-Former model is as follows: First, the International Chemical Identifier (InChI) and corresponding FTIR spectra of the corresponding compounds were obtained from the National Institute of Standards and Technology Chemistry WebBook (NIST Chemistry WebBook) using the CAS number. The InChI strings were stored in txt format and the FTIR spectra were stored in jcamp-dx format. The naming method was unified with the compound's ID number in the NIST database. Finally, 23,337 sets of infrared spectral data and InChI string files were obtained. Each set of data corresponds to an independent compound. The data was preprocessed using the data conversion methods of formula (1) and formula (2).

[0034] Subsequently, considering that InChI strings are a standardized molecular structure encoding defined by IUPAC, the structural information of the target compound is obtained by deconstructing the InChI string. In the functional group identification method provided by this invention, the RDKit software package can be used to perform substructure matching on the compound based on the pre-edited list of SMARTS identifiers for functional groups shown in Table 1, thereby determining whether the compound's structure contains a specific functional group structure.

[0035] Table 1 List of SMARTS identifiers Table 1 includes not only the SMARTS identifiers of functional groups in the LEC-Former model dataset, but also the probability of each SMARTS identifier. Vector labels for compounds are constructed based on the list of SMARTS identifiers. For example, if a compound contains a certain functional group, it is labeled as 1; if the compound does not contain that functional group, it is labeled as 0. Ultimately, each compound generates a multi-label vector consisting of 0s and 1s. The compound vector label file is named the same as the infrared spectrum file, facilitating subsequent pairing for model training.

[0036] Finally, these preprocessed standard infrared spectra and their corresponding vector labels are input into the model. The model predicts the functional group types of the standard infrared spectra and compares them with the vector labels, thereby adjusting the model parameters until the functional groups of the infrared spectra can be accurately identified.

[0037] In this embodiment, the LEC-Former model training employs diverse performance evaluation methods to comprehensively measure its performance in the functional group recognition task. Accuracy measures the model's overall prediction correctness across all test samples, reflecting its overall classification performance. Precision calculates the proportion of samples predicted as positive that actually belong to the positive class. In this embodiment, the false positive cost of functional group recognition is high; this metric reflects the model's ability to control the risk of false positives, ensuring the reliability of the model's recognition results. Recall focuses on the proportion of all actually positive samples correctly identified by the model, reflecting the model's coverage of positive samples. Especially in the context of numerous functional group types and complex spectral signals, recall helps evaluate the model's ability to detect various functional group features.

[0038] Furthermore, considering the imbalance in sample class distribution, relying solely on precision or recall may not fully reflect model performance. The F1 score, as the harmonic average of the two, is less sensitive to class imbalance and provides a more representative evaluation result. Moreover, given that functional group identification is a multi-label classification task, multiple functional group types may coexist in a single sample. This embodiment introduces the Exact Match Rate (EMR) as a supplementary metric to verify whether the model's predicted label set for each sample is completely consistent with the true label set, further validating the model's reliability in identifying complex label combinations.

[0039] Once the LEC-Former model is trained, the functional group identification method provided by this invention can extract fusion features from the embedded vector sequence through the following steps: Step 16: Add category identifiers to the embedded vector sequences and capture the global dependencies between multiple embedded vector sequences based on the self-attention mechanism to obtain global features; perform independent convolution and channel normalization on multiple embedded vector sequences to obtain local peak position change features; fuse the local peak position change features and global features based on the cross-attention mechanism to obtain fused features.

[0040] Specifically, the LEC-Former model is used to process the embedding vector sequence with added category identifiers to obtain the functional group type of the functional group to be identified. The LEC-Former model consists of a global feature modeling module, a local peak position change feature enhancement and modality fusion module, and a sequence modeling and classification module connected in sequence. The local peak position change feature enhancement and modality fusion module and the sequence modeling module consist of a deep convolutional layer, a channel normalization layer, a pointwise convolutional layer, and a cross-attention fusion module connected in sequence.

[0041] Specifically, such as Figure 2 As shown, the LEC-Former model includes a global feature modeling module (TransformerEncoder), a local feature enhancement and modality fusion module (LEC Module), and a sequence modeling and classification module (SMCModule). The input infrared spectrum is processed by image patch embedding to obtain multiple spectral segments with embedded position encoding, such as the embedding vector sequence of positional embedding and linear projection. Then, the embedding vector sequence is input into the global feature modeling module, and a learnable class token is added as a global feature identifier. The embedding vector sequence is processed by a multi-layer Transformer encoder, which uses self-attention as shown in formula (3) to capture the global dependencies between spectral segments, and enhances the feature expression capability through a feedforward network to obtain the global features of the infrared spectrum:

[0042] (3) Where Q is the query matrix, which serves as the input for the current processing, K is the key matrix, which represents the context, and V is the value matrix, which contains the output corresponding to each key; The dimension of the key vector is used to prevent the dot product result from being too large.

[0043] For example, such as Figure 2As shown, firstly, a dot product is performed on Q and K to calculate their similarity. The sharpness of the attention distribution is controlled by a learnable temperature scaling mechanism. Then, a mask is applied and processed using a soft-max normalization function. Following this, another dot product is performed with V to capture global dependencies based on a self-attention mechanism. Next, the dot product results are added and normalized, and a feedforward network is used to perform a non-linear transformation on the features at each location. Finally, another addition and normalization process is performed before outputting from the Transformer encoder.

[0044] In step 16 of the functional group identification method provided by the present invention, local peak position variation characteristics can be obtained through the following steps: Step 161: Perform independent convolution processing on multiple embedded vector sequences to obtain multiple independent local peak position change features.

[0045] Step 162: Normalize the channels of multiple independent local peak position variation features and perform nonlinear transformation to obtain normalized local peak position variation features.

[0046] Step 163: Perform point convolution on the normalized local peak position change features to obtain local peak position change features that integrate cross-channel information.

[0047] Specifically, to compensate for the Transformer's insufficient focus on local details, the LEC-Former model, while extracting global features from the embedded vector sequence using the global feature modeling module, also employs a Local Feature Enhancement and Modality Fusion Module (LEC Module) to extract local peak position variation features. The LEC Module divides the embedded vector sequence into multiple patches of spectral sequences and performs independent convolutions on each, focusing on mining fine-grained feature information within the segments. Each patch, after depthwise convolution, forms an independent feature map, which is then normalized through channels to ensure a consistent distribution of features across different patches, preventing gradient vanishing or exploding. These local features undergo nonlinear transformation using the GELU activation function, and cross-channel information integration is achieved through pointwise convolution, enabling independent features between patches to interact and collaboratively fuse across channels.

[0048] Furthermore, in step 16 of the functional group identification method provided by this invention, after both global features and local peak position change features have been extracted, feature fusion can be achieved through the following steps: Step 164: Calculate the similarity between global features and local peak position change features fused from cross-channel information to obtain the attention weight matrix of global features to local peak position change features.

[0049] Step 165: Based on the attention weight matrix, perform weighted aggregation of the local peak position change features of the fused cross-channel information to obtain the fused features.

[0050] Specifically, after both local peak position variation features and global features are extracted, the global feature modeling module and the local feature enhancement and modality fusion module respectively fuse the global features and local peak position variation features using the local feature enhancement and modality fusion module. In the local feature enhancement and modality fusion module, based on the cross-attention mechanism, the sequence of global features is used as the query, and the local features are used as the key and value. By calculating the similarity between the query and the key, the attention weight matrix of global features to local features of different patches is obtained. Based on this, the local features are weighted and aggregated to form the enhanced global feature representation, which is used as the fused feature for the sequence modeling and classification module to perform functional group classification.

[0051] For example, such as Figure 2 As shown, the local feature enhancement and modality fusion module comprises a processing chain consisting of four stacked identical sub-modules. Each sub-module performs a series of operations on its input features and uses the output as K and V for the next cross-attention step. Specifically, first, depth-wise filtering is applied; second, batch normalization accelerates convergence; then, the GELU activation function is used; and finally, point-wise convolution is used for inter-channel information fusion and dimensionality transformation. The results are then summed and output to a sub-module based on the cross-attention mechanism. Next, the Transformer encoder output is used as Q, and its similarity is calculated by dot product with K in the output. This is then scaled and processed using the soft-max activation function. Finally, a weighted sum (Weight-Sum) is performed with V in the output, followed by addition and normalization.

[0052] After feature fusion is completed, the functional group identification method provided by this invention can identify functional group types through the following steps: Step 17: Calculate the functional group probability distribution of the feature vector corresponding to the category identifier in the fused features to obtain the type of functional group to be identified.

[0053] In the functional group identification method provided by the present invention, step 17 can achieve functional group type identification in the following manner: Step 171: Capture the local continuous change trend and long-range dependence features between bands from the fusion features.

[0054] Step 172: Calculate the functional group probability distribution of the feature vectors corresponding to the category identifiers in the local continuous change trend and long-range dependence features between bands to obtain the functional group type to be identified.

[0055] Specifically, considering the potential dependencies between characteristic patterns of spectral absorption bands, and the fact that adjacent bands jointly characterize the absorption patterns of certain functional groups, this embodiment, based on the fused feature representation, introduces a Bidirectional Long Short-Term Memory (BiLSTM) sequence modeling and classification module (SMC Module) to further model the global dependencies in the spectral segment sequence. BiLSTM captures the gradual change trends of local continuous patterns and the cooperative features between distant bands through feature propagation in both forward and backward directions. Furthermore, to alleviate the problem of model overfitting, this embodiment performs regularization on the output features of BiLSTM, and then extracts the feature vector corresponding to the Class Token in the sequence, which is then used as the global representation of the feature sequence and input into the classification head of the sequence modeling and classification module.

[0056] The classification head of the sequence modeling and classification module consists of a fully connected layer and a Softmax activation function, which is used to perform probability statistics on each functional group in the feature vector and output the probability distribution of each functional group label, so as to accurately identify the functional group type of the compound based on infrared spectroscopy.

[0057] For example, such as Figure 2 As shown, in the sequence modeling and classification module, sequences are processed in order and in reverse order through forward hiding and backward hiding, respectively. The sequences are then labeled with dot products and tokens. After processing through fully connected layers and the Softmax activation function, the probability statistics of each functional group are output.

[0058] Because the functional group identification method provided by this invention can extract local peak position change features from the embedded vector sequence of infrared spectral conversion, and combine the local peak position change features to calculate the functional group type probability, it highlights the response differences of the spectral band signal, strengthens the ability of the identification method to express weak absorption peaks, and can identify functional group types through local features in the face of complex spectral bands with overlapping peak interference, thus ensuring the accuracy of the functional group identification method in various environments.

[0059] Example 2 Building upon Example 1, this invention also provides a specific example of facultative group identification. The LEC-Former model was first experimentally validated on the publicly available dataset by Doan et al., using the same data partitioning and preprocessing methods as the original paper to evaluate model performance. Secondly, a more comprehensive and abundant experimental dataset—the LEC Dataset—was reconstructed based on the NIST data source, and supplementary experiments were conducted on this expanded dataset.

[0060] Specifically, in this embodiment, the LEC-Dataset is divided into a training set (75%), a validation set (15%), and a test set (10%). During model training, LEC-Former uses the Adam optimization algorithm with a learning rate of 0.002, employing supervised learning for end-to-end optimization. After training and hyperparameter tuning, the model is validated for 600 epochs, and hyperparameter tuning and early stopping strategies are set based on the performance on the validation set.

[0061] First, comparative experiments were conducted on the FTIR dataset used by Fcg-Former proposed by Doan et al. The comparison models included Fcg-Former and IRCNN, the best-performing convolutional neural network. The functional group prediction results are shown in Table 2.

[0062] Table 2. Comparison of prediction results of various models on the Fcg-Former dataset. Among them, LEC-Former achieved an overall accuracy of 0.9783, which is an improvement over Fcg-Former and IRCNN, both of which have an overall accuracy of 0.9715. In terms of recall and precision, LEC-Former achieved 0.9449 and 0.9538 respectively, representing improvements of 2.4% and 2.0% compared to Fcg-Former. In terms of F1 score, LEC-Former achieved 0.9433, an improvement of approximately 1.5% over Fcg-Former. Regarding the Multi-Label Recognition Consistency (EMR) metric, the LEC-Former model scored 0.765, an improvement of 9.0% compared to Fcg-Former. In summary, the model provided in this embodiment achieves superior performance compared to the comparative models in all metrics.

[0063] Furthermore, for scenarios with larger scales and more complex sample distributions, this embodiment further introduces an expanded spectral experimental dataset to verify the robustness and generalization ability of the model, as shown in Table 3: Table 3. Comparison of prediction results of various models on the LEC dataset LEC-Former maintained its excellent performance, achieving an overall accuracy of 0.9643, significantly higher than the comparison models. In terms of recall and precision, LEC-Former achieved 0.9149 and 0.9067 respectively, representing improvements of 17.2% and 5.8% compared to Fcg-Former, demonstrating that the model's ability to identify positive samples did not decrease with increasing sample complexity. The F1 score improved to 0.9109, indicating that the model significantly reduced false positives while decreasing false negatives, balancing the accuracy and completeness of functional group identification. Notably, LEC-Former achieved an EMR score of 0.6324, showing significant performance compared to other models. These results demonstrate that even under more complex sample distribution conditions, the model provided in this embodiment can still more accurately reconstruct functional group combinations, maintaining high predictive consistency and classification stability.

[0064] In addition, such as Figure 3 As shown, different models exhibit varying performance in recognizing labels across different functional groups. Compared to other models such as Feg-Former and IRCNN, LEC-Former leads in accuracy, recall, precision, and F1 score across multiple functional groups, including Alkane. It is particularly effective in distinguishing spectral signals in categories with discrete feature distributions or overlapping absorption bands.

[0065] Specifically, carbonyl functional groups in esters and carboxylic acids are found in the range of 1700–1750. The absorption exhibits significant C=O stretching vibration absorption within the range, and together with the stretching of carboxylic acids or esters, it constitutes a highly specific absorption pattern. Traditional CNN models can only extract features within a local window, making it difficult to integrate information across regions. LEC-Former utilizes an attention mechanism to establish long-range dependencies across the entire frequency domain, simultaneously capturing structural correlations between key spectral bands from multiple absorption regions, thereby achieving more accurate recognition on labels with discrete information distribution but clear patterns.

[0066] For saturated hydrocarbon functional groups such as alkane and methyl, the absorption frequency range of the corresponding C–H tensile vibrations is mainly concentrated in the 2800–3000 GHz range. This absorption band is widely present in various organic structures, with overlapping characteristic absorption peaks and a lack of clear absorption boundaries, making it difficult for attention mechanisms to focus accurately. In categories dominated by weak peaks, such as alkyl halides and ethers, LEC-Former also exhibits significant advantages. The C–X stretching absorption of the former is typically located in the 500–800 nm range. The characteristic signal is weak and easily affected by background interference. The latter's C–O–C bending absorption mainly occurs between 1050–1150 nm. It is easily affected by the absorption regions of nearby alcohols and carboxylic esters, resulting in unstable peak shapes. LEC-Former enhances the feature modeling of low-intensity regions, effectively improving the model's ability to identify interference in the spectrum and still fully extracting local feature information in the spectrum with low feature resolution.

[0067] Furthermore, functional group absorption features such as acyl halides and aldehydes typically exhibit clear C=O stretching absorption peaks, while nitrogen has a typical symmetric and antisymmetric N=O double peak. These functional group absorption features are relatively isolated, but samples are scarce. This scarcity makes it difficult for traditional models to converge to a clear discrimination boundary on these labels, resulting in limited gradient responses for these labels during training. LEC-Former enhances the feature response to isolated absorption peaks, allowing the model to retain its discriminative ability for these features even in scenarios with small sample sizes.

[0068] Finally, to verify the contribution of each module to the functional group recognition task, two sets of ablation experiments were designed, removing the LSTM and LEC modules respectively, and testing was conducted on the augmented dataset. Figure 4 As shown, the complete LEC-Former achieves the best recognition accuracy on most functional groups.

[0069] Specifically, functional groups such as alkene and ethers exhibit multiple absorption peaks in the infrared spectrum, distributed across several discontinuous spectral bands. For example, the C=C stretching peak of alkene and the CH bending peak connected to the double bond are located at 1600 nm. With 1000 The recognition process relies on the model's ability to model across spectral bands. Removing the LSTM module significantly reduced the accuracy of these categories, indicating that LSTM plays a positive role in capturing the correlation of local absorption bands in the spectrum.

[0070] In contrast, removing the LEC module has a more significant impact on model performance, especially with functional groups such as Alkyl halides, Alcohols, Amines, and Methyl, where accuracy drops dramatically. These categories of infrared peaks often exhibit strong locality, weak signals, or unstable spectral shapes, commonly found in low-to-mid wavenumber regions such as C–X and C–N stretching, or in infrared peaks heavily influenced by hydrogen bonding, such as broad O–H peaks. The LEC module significantly improves the model's response to weak peaks and fine-grained features, more fully capturing low-to-mid intensity, geographically dispersed absorption features, thus significantly improving classification performance in the identification of functional groups dominated by weak signals.

[0071] The ablation experiments in this embodiment demonstrate that LSTM improves the model's ability to model functional groups with continuous but non-concentrated absorption features by modeling the dynamic dependencies between adjacent spectral bands. The LEC module significantly enhances the model's perceptual representation of weak peaks and local features, exhibiting stronger discriminative power in labels dominated by weak or low-frequency absorption. The two modules complement each other in structural modeling and local enhancement, effectively improving the model's overall performance in multi-label spectral recognition tasks.

[0072] In summary, this embodiment used 23,337 FTIR spectral samples provided by the NIST Chemistry Web Book to construct a multi-label functional group identification task. The model was compared with mainstream machine learning models on multiple evaluation metrics. The results show that LEC-Former significantly outperforms existing models in terms of accuracy, recall, and exact matching rate for functional group identification, verifying the model's effective fusion advantage between long-range dependence of absorption peaks and local fine-grained feature extraction, demonstrating good generalization ability and robustness.

[0073] Example 3 The present invention also provides a functional group recognition system, such as Figure 5 As shown, it includes: The infrared spectral preprocessing module 31 is used to acquire the infrared spectrum of the functional group to be identified; divide the infrared spectrum into multiple spectral segments, perform linear mapping on the multiple spectral segments and embed position codes to obtain an embedding vector sequence.

[0074] The fusion feature generation module 32 is used to add category identifiers to the embedded vector sequence and capture the global dependencies between multiple embedded vector sequences based on the self-attention mechanism to obtain global features; perform independent convolution and channel normalization on multiple embedded vector sequences to obtain local peak position change features; and fuse the local peak position change features and global features based on the cross-attention mechanism to obtain fusion features.

[0075] The probability distribution calculation module 33 is used to calculate the functional group probability distribution of the feature vector corresponding to the category identifier in the fused feature to obtain the type of the functional group to be identified.

[0076] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps in an embodiment of a functional group identification method. Specific implementation methods can be found in the method embodiments, and will not be repeated here.

[0077] Furthermore, the present invention also provides a non-transitory computer-readable storage medium containing instructions on which a computer program is stored. For example, a memory containing instructions that can be executed by a processor of a computer device to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc. When the computer program is executed by the processor, it can implement the steps in an embodiment of a functional group identification method. Specific implementation methods can be found in the method embodiments, which will not be repeated here.

[0078] Those skilled in the art will understand that embodiments of the present invention can provide methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0079] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0080] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0081] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1The steps of the function specified in one or more boxes.

[0082] It should be noted that the specific embodiments described above enable those skilled in the art to more fully understand the present invention, but do not limit the present invention in any way. Therefore, although the present invention has been described in detail in this specification and embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the present invention; and all technical solutions and improvements that do not depart from the spirit and scope of the present invention are covered within the protection scope of the present invention patent. No reference numerals in the claims should be construed as limiting the scope of the claims. Any simple variations or equivalent substitutions of technical solutions that can be readily obtained by those skilled in the art within the scope of the technology disclosed in the present invention are within the protection scope of the present invention.

Claims

1. A functional group identification method characterized by, The method comprises the following steps: obtaining an infrared spectrum of a functional group to be identified; dividing the infrared spectrum into multiple spectral segments, linearly mapping and embedding position coding on the multiple spectral segments to obtain an embedded vector sequence; adding a class identifier to the embedded vector sequence, and capturing global dependencies between the multiple embedded vector sequences based on a self-attention mechanism to obtain global features; respectively performing independent convolution and channel normalization processing on the multiple embedded vector sequences to obtain local peak position change features; fusing the local peak position change features and the global features based on a cross-attention mechanism to obtain fused features; performing functional group probability distribution calculation on the feature vector corresponding to the class identifier in the fused features to obtain the type of the functional group to be identified.

2. The functional group identification method of claim 1, wherein, The LEC-Former model is used to process the embedded vector sequence with the added class identifier to obtain the type of the functional group to be identified. The LEC-Former model comprises a global feature modeling module, a local peak position change feature enhancement and modal fusion module, and a sequence modeling module and a classification module connected in sequence; wherein the local peak position change feature enhancement and modal fusion module and the sequence modeling module comprise a deep convolution layer, a channel normalization layer, a point-by-point convolution layer, and a cross-attention fusion module connected in sequence.

3. The functional group identification method of claim 2, wherein, Before capturing the global dependencies between the multiple embedded vector sequences based on the self-attention mechanism to obtain the global features, the method further comprises the following steps: obtaining an international chemical identifier of a compound and a corresponding standard infrared spectrum, and analyzing the international chemical identifier to obtain structure information of the compound; performing substructure matching on the compound through a pre-set identifier list, constructing a multi-label vector according to the substructure matching structure; inputting the standard infrared spectrum of the compound into an untrained LEC-Former model to obtain the functional group type of the compound; performing hyperparameter tuning on the untrained LEC-Former model according to the difference between the functional group type of the compound and the multi-label vector to obtain the LEC-Former model.

4. The functional group identification method of claim 1, wherein, The method comprises the following steps: respectively performing independent convolution and channel normalization processing on the multiple spectral segments to obtain local peak position change features; respectively performing independent convolution processing on the multiple embedded vector sequences to obtain multiple independent local peak position change features; performing channel normalization and nonlinear transformation processing on the multiple independent local peak position change features to obtain normalized local peak position change features; 5. The functional group identification method of claim 4, wherein, point-by-point convolution is performed on the normalized local peak position change features to obtain local peak position change features with fused cross-channel information. The method comprises the following steps: calculating the similarity between the global features and the local peak position change features with fused cross-channel information to obtain an attention weight matrix of the global features to the local peak position change features; performing weighted aggregation on the local peak position change features with fused cross-channel information according to the attention weight matrix to obtain fused features.

6. The functional group identification method of claim 1, wherein, The functional group probability distribution calculation is performed on the feature vector corresponding to the class identifier in the fusion feature, and the type of the to-be-identified functional group is obtained. Local continuous change trend and inter-band long-range dependence features are captured from the fusion feature; The functional group probability distribution calculation is performed on the feature vector corresponding to the class identifier in the local continuous change trend and inter-band long-range dependence features, and the type of the to-be-identified functional group is obtained.

7. The functional group identification method of claim 1, wherein, Before the infrared spectrum is divided into multiple spectrum segments, the method further includes: The wavelength conversion and transmittance conversion are performed on the infrared spectrum to obtain an infrared spectrum with wave number and absorption rate as coordinates; The boundary padding and linear interpolation are performed on the infrared spectrum with wave number and absorption rate as coordinates to obtain the preprocessed infrared spectrum.

8. A functional group recognition system characterized by, The method includes: An infrared spectrum preprocessing module is configured to obtain an infrared spectrum of a to-be-identified functional group; The infrared spectrum is divided into multiple spectrum segments, and linear mapping and position embedding are performed on the multiple spectrum segments to obtain an embedding vector sequence; A fusion feature generation module is configured to add a class identifier to the embedding vector sequence, and capture global dependence relationships between the multiple embedding vector sequences based on a self-attention mechanism to obtain global features; Independent convolution and channel normalization are respectively performed on the multiple embedding vector sequences to obtain local peak position change features; The local peak position change features and the global features are fused based on a cross-attention mechanism to obtain fusion features; A probability distribution calculation module is configured to perform functional group probability distribution calculation on the feature vector corresponding to the class identifier in the fusion feature to obtain the type of the to-be-identified functional group.

9. A computer device comprising a memory, a processor, and a computer program stored on the memory, wherein the computer program comprises instructions that, when executed by the processor, cause the processor to perform the method of any one of claims 1-8. The processor executes the computer program to implement the steps of the functional group identification method in any one of claims 1 to 7.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is loaded by the processor to implement the steps of the functional group identification method in any one of claims 1 to 7.