Rule-guided lstm-svdd anomaly detection method and system

By employing a rule-guided LSTM-SVDD anomaly detection method, which combines a bidirectional LSTM network and a rule template engine, the noise sensitivity and label dependency issues of traditional acoustic emission detection methods are resolved. This enables unsupervised and accurate anomaly detection, thereby improving the safety monitoring capabilities of industrial equipment.

CN121234025BActive Publication Date: 2026-02-17INSPUR ENTERPRISE CLOUD TECHNOLOGY (SHANDONG) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511769300.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-28
Publication Date
2026-02-17
Estimated Expiration
2045-11-28

AI Technical Summary

Technical Problem

Traditional acoustic emission anomaly detection methods are sensitive to noise samples, rely excessively on labeled anomaly data, and are difficult to effectively incorporate expert experience and knowledge. Furthermore, they face challenges in industrial equipment due to large data scale, unbalanced categories, and relative judgment criteria.

Method used

We adopt a rule-guided LSTM-SVDD anomaly detection method, which combines a bidirectional LSTM network and a rule template engine. We perform feature extraction and rule detection through a feature projection fusion layer, construct an SVDD loss function, and introduce quantile method and rule penalty term to achieve unsupervised anomaly detection.

Benefits of technology

It enables precise anomaly detection of acoustic emission signals, reduces reliance on manually labeled data, dynamically adjusts detection strategies, improves detection accuracy and interpretability, and provides reliable technical support for industrial equipment safety monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121234025B_ABST
    Figure CN121234025B_ABST
Patent Text Reader

Abstract

The application discloses an LSTM-SVDD anomaly detection method and system based on rule guidance, belongs to the technical field of industrial nondestructive quality inspection, and aims to solve the technical problems of noise sample sensitivity, excessive dependence on labeled abnormal data, and the technical vacancy of being unable to effectively introduce expert experience knowledge. A feature extraction model is constructed based on a bidirectional LSTM network, a rule template engine and a feature projection fusion layer. A subquantile method is used to calculate a hypersphere radius, an SVDD loss function is constructed as a basic loss function, a rule penalty term is introduced to construct a rule loss function, a weighted sum of the basic loss function and the rule loss function is constructed to form a total loss function, and the trained feature extraction model and the optimized hypersphere radius are obtained by minimizing the total loss function. The to-be-detected sample is input into the trained feature extraction model, and the Euclidean distance between the fusion feature vector and the hypersphere center is compared with a dynamic detection threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial non-destructive testing technology, specifically to a rule-guided LSTM-SVDD anomaly detection method and system. Background Technology

[0002] Acoustic emission (AE) testing, as an important non-destructive testing method, assesses structural integrity by monitoring the elastic wave signals generated by materials under stress, and has wide applications in the field of industrial equipment safety monitoring. Traditional AE anomaly detection methods mainly rely on signal processing techniques and statistical analysis methods, but these methods are often sensitive to noise interference and have difficulty capturing complex temporal anomaly patterns.

[0003] In real-world industrial acoustic emission testing scenarios, tens of thousands of signal data points can be generated daily. These data exhibit three significant characteristics:

[0004] 1. The data is massive and lacks effective annotation, making it difficult to manually identify anomalous samples for model training;

[0005] 2. The proportion of outlier data in the total is usually less than 1%, which indicates a serious class imbalance problem and further exacerbates the difficulty of manual classification;

[0006] 3. The criteria for judging normal and abnormal are relative. Since the abnormal evolution of mechanical equipment is a gradual process, it is difficult to establish a clear absolute standard. In practice, the relative description of "identifying a few outliers that are significantly different from the mainstream data characteristics" is often used as the basis for defining abnormality.

[0007] These characteristics pose a serious challenge to traditional supervised learning-based detection methods, necessitating the development of novel detection schemes that do not rely on large amounts of labeled data.

[0008] Traditional acoustic emission anomaly detection methods suffer from technical gaps in practical applications, such as sensitivity to noise samples, over-reliance on labeled anomaly data, and inability to effectively incorporate expert experience and knowledge. These are technical problems that need to be addressed. Summary of the Invention

[0009] The technical objective of this invention is to address the above-mentioned shortcomings by providing a rule-guided LSTM-SVDD anomaly detection method and system, thereby solving the technical problems of traditional acoustic emission anomaly detection methods in practical applications, such as sensitivity to noise samples, over-reliance on labeled anomaly data, and inability to effectively incorporate expert experience and knowledge.

[0010] In a first aspect, the present invention provides a rule-guided LSTM-SVDD anomaly detection method, comprising the following steps:

[0011] Sample acquisition: The acquired multi-channel historical acoustic emission data is preprocessed to obtain standardized time-series data, and the standardized time-series data is used as samples to construct a sample set;

[0012] Model Construction: A feature extraction model is constructed based on a bidirectional LSTM network, a rule template engine, and a feature projection fusion layer. The bidirectional LSTM network is used to extract multimodal features from the input data and output a temporal feature vector. The rule template engine is used to perform rule detection on the input data and output a rule score vector. The feature projection fusion layer is used to learn the weights assigned to the temporal feature vector and the rule score vector and fuse them to obtain a fused feature vector.

[0013] Model training: Quantiles are constructed based on the proportion of abnormal samples in the sample set. The hypersphere radius is calculated using the quantile method. The SVDD loss function is constructed as the basic loss function based on the Euclidean distance from the fused feature vector to the center of the hypersphere and the hypersphere radius. A regular penalty term is introduced to construct a regular loss function. The weighted sum of the basic loss function and the regular loss function is used to construct the total loss function. The trained feature extraction model and the optimized hypersphere radius are obtained by minimizing the total loss function. The optimized hypersphere radius is used as the dynamic detection threshold.

[0014] Inference and prediction: The collected multi-channel acoustic emission data to be tested is preprocessed to obtain standardized time-series data as test samples. The test samples are input into the trained feature extraction model to obtain fused feature vectors. The Euclidean distance between the fused feature vectors and the center of the hypersphere is calculated as the feature distance. The feature distance is compared with the dynamic detection threshold. If the feature distance exceeds the dynamic detection threshold, it is judged as an anomaly, and the feature distance, rule score and relative threshold exceedance are output.

[0015] Preferably, the collected multi-channel historical acoustic emission data is stored in CSV format. The acoustic emission data includes metadata and acoustic emission characteristic parameters. The metadata includes timestamp, channel number and pressure stage. The acoustic emission characteristic parameters include rise time, calculation, energy, duration, amplitude and frequency parameters.

[0016] When preprocessing the collected multi-channel historical acoustic emission data, channel alignment, Z-score standardization, missing value mean imputation, and sequence length unification are performed to generate standardized time-series data.

[0017] Correspondingly, when preprocessing the collected multi-channel acoustic emission data, channel alignment, Z-score standardization, missing value mean filling, and sequence length unification operations are performed to generate standardized time-series data.

[0018] Preferably, the bidirectional LSTM network performs multi-scale feature acquisition and outputs a hidden state matrix through multiple bidirectional LSTM layers. Using the hidden state matrix as input, it learns the abnormal signals at key time points through an attention mechanism layer and outputs a context vector. The output layer performs linear mapping and Tanh activation on the context vector to output a fixed-dimensional temporal feature vector.

[0019] Preferably, the rule template engine includes a rule configuration module, a rule factory, and a rule implementation module;

[0020] The rule configuration module is used to read external configuration files and store the rule configuration information in the configuration files in a dictionary structure. The rule configuration information includes rule name, rule description, detection threshold, sensitivity coefficient and rule detection calculation function.

[0021] The rule factory is configured with a global registry, which records the mapping between rule names and corresponding rule detection calculation functions. This registry is used to instantiate the corresponding rule detection calculation function object at runtime using the rule name as input and the factory pattern, and output a callable rule instance.

[0022] The rule implementation module takes acoustic emission data as input, calls rule instances to execute the rule detection process, obtains standardized abnormal rule scores, and forms a rule score vector by weighted averaging of the abnormal scores output by all rule instances. When executing the rule detection process, target features related to the rule are selected to calculate feature statistics. The generated feature statistics are compared with the detection threshold. Anomaly determination is made based on the comparison results. If the feature statistics exceed the detection threshold, it is determined to be abnormal and the excess degree is calculated. The excess degree is smoothed by the Sigmoid function to obtain a standardized abnormal standard score.

[0023] During model training, the rule template engine is frozen and does not participate in parameter optimization.

[0024] Preferably, the feature projection fusion layer takes the temporal feature vector and the regular anomaly score vector as input, and is used to concatenate the temporal feature vector and the regular anomaly score vector into a joint feature vector through the feature concatenation layer. Taking the joint feature vector as input, the layer learns the weight allocation of the temporal feature vector and the regular anomaly score vector through the first layer linear transformation and RuLU activation, and outputs high-dimensional weighted features. The layer performs low-dimensional projection on the high-dimensional weighted features through the second layer linear transformation, and outputs compressed features. The compressed features are normalized through the Tanh function, and the fused features are output.

[0025] Correspondingly, the parameters of the two linear transformations are jointly optimized through backpropagation during the model training phase.

[0026] Preferably, the total loss function is constructed during model training using the following steps:

[0027] Sample data Corresponding fused feature vector To the center of the supersphere Euclidean distance square Represented as:

[0028] ,

[0029] For all After sorting, based on the proportion of abnormal samples in the sample set Constructing quantiles Based on quantiles Construct a formula for calculating the radius of a hypersphere, and the square of the hypersphere radius. The calculation formula is expressed as follows:

[0030] ,

[0031] Based on the squared Euclidean distance from the fused characteristic vector to the center of the hypersphere and the square of the hypersphere radius Constructing the SVDD loss function , is represented as:

[0032] ,

[0033] A rule-based penalty term is introduced to guide the feature extraction model in applying penalties to samples deemed abnormal, thus constructing a rule-based loss function. Represented as:

[0034] ,

[0035] in, This indicates the total number of rules. Indicates the first One rule for sample data The score of the abnormal rules, Representing sample data The average rule anomaly score, This represents the Euclidean distance from the merged feature to the center of the hypersphere;

[0036] The total loss function is constructed by weighted summing of the basic loss and the rule loss. Represented as:

[0037] ,

[0038] in, The weight representing the rule loss.

[0039] As a preferred method, when constructing quantiles based on the proportion of abnormal samples in the sample set, the proportion of abnormal samples in the current sample set is calculated according to the proportion of abnormal samples in the historical sample base, or the proportion of abnormal samples is calculated by sampling from the sample set.

[0040] In a second aspect, the present invention provides a rule-guided LSTM-SVDD anomaly detection system for anomaly detection using a rule-guided LSTM-SVDD anomaly detection method as described in any of the first aspects, the system comprising a sample module, a model building module, a model training module, and an inference and prediction module.

[0041] The sample acquisition module is used to perform the following: preprocess the acquired multi-channel historical acoustic emission data to obtain standardized time-series data, and use the standardized time-series data as samples to construct a sample set;

[0042] The model building module is used to perform the following: build a feature extraction model based on a bidirectional LSTM network, a rule template engine, and a feature projection fusion layer. The bidirectional LSTM network is used to extract multimodal features from the input data and output a temporal feature vector. The rule template engine is used to perform rule detection on the input data and output a rule score vector. The feature projection fusion layer is used to learn the weights assigned to the temporal feature vector and the rule score vector and fuse them to obtain a fused feature vector.

[0043] The model training module is used to perform the following: construct quantiles based on the proportion of abnormal samples in the sample set, calculate the hypersphere radius using the quantile method, construct the SVDD loss function as the basic loss function based on the Euclidean distance from the fused feature vector to the center of the hypersphere and the hypersphere radius, introduce a rule penalty term to construct a rule loss function, construct the total loss function by weighted summation of the basic loss function and the rule loss function, obtain the trained feature extraction model and the optimized hypersphere radius by minimizing the total loss function, and use the optimized hypersphere radius as the dynamic detection threshold;

[0044] The inference and prediction module is used to perform the following: preprocess the collected multi-channel acoustic emission data to obtain standardized time-series data as test samples, input the test samples into the trained feature extraction model to obtain fused feature vectors, calculate the Euclidean distance between the fused feature vectors and the center of the hypersphere as the feature distance, compare the feature distance with the dynamic detection threshold, if the feature distance exceeds the dynamic detection threshold, it is judged as an anomaly, and the feature distance and rule score are output.

[0045] The rule-guided LSTM-SVDD anomaly detection method and system of the present invention have the following advantages: accurate anomaly detection of acoustic emission signals can be achieved through unsupervised learning. When detecting acoustic emission data during gas cylinder pressure testing, it can simultaneously utilize data-driven deep temporal features and expert knowledge-guided rule features, dynamically adjusting the detection strategy according to different detection scenarios. This effectively solves the technical problems of traditional methods being sensitive to noise, relying on labeled data, and having difficulty in incorporating expert experience, improving the accuracy and interpretability of anomaly detection, while reducing reliance on manually labeled data, providing reliable technical support for industrial equipment safety monitoring. Attached Figure Description

[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0047] The invention will be further described below with reference to the accompanying drawings.

[0048] Figure 1 Here is a flowchart of a rule-guided LSTM-SVDD anomaly detection method according to Example 1;

[0049] Figure 2 This is a schematic diagram of the architecture of a custom rule template in a rule-guided LSTM-SVDD anomaly detection method according to Example 1;

[0050] Figure 3 This is a performance comparison chart of anomaly detection with and without business rules in a rule-guided LSTM-SVDD anomaly detection method according to Example 1. Detailed Implementation

[0051] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0052] This invention provides a rule-guided LSTM-SVDD anomaly detection method and system to address the technical problems.

[0053] Example 1: The present invention provides a rule-guided LSTM-SVDD anomaly detection method, which includes four steps: sample collection, model construction, model training, and inference prediction.

[0054] Step S100 Sample Acquisition: The acquired multi-channel historical acoustic emission data is preprocessed to obtain standardized time-series data, and the standardized time-series data is used as samples to construct a sample set.

[0055] In this embodiment, the collected multi-channel historical acoustic emission data is stored in CSV format. The acoustic emission data includes metadata and acoustic emission characteristic parameters. The metadata includes timestamp, channel number and pressure stage. The acoustic emission characteristic parameters include rise time, calculation, energy, duration, amplitude and frequency parameters.

[0056] When preprocessing the collected multi-channel historical acoustic emission data, channel alignment, Z-score standardization, missing value mean imputation, and sequence length unification are performed to generate standardized time-series data.

[0057] Step S200 Model Construction: A feature extraction model is constructed based on a bidirectional LSTM network, a rule template engine, and a feature projection fusion layer. The bidirectional LSTM network is used to extract multimodal features from the input data and output a temporal feature vector. The rule template engine is used to perform rule detection on the input data and output a rule score vector. The feature projection fusion layer is used to learn the weights assigned to the temporal feature vector and the rule score vector and fuse them to obtain a fused feature vector.

[0058] As a specific implementation of the bidirectional LSTM network, this network structure performs multi-scale feature acquisition and outputs a hidden state matrix through multiple bidirectional LSTM layers. The hidden state matrix is ​​used as input, and an attention mechanism layer is used to learn the abnormal signals at key time points to output a context vector. The output layer performs linear mapping and Tanh activation on the context vector to output a fixed-dimensional temporal feature vector.

[0059] The rule template engine includes a rule configuration module, a rule factory, and a rule implementation module.

[0060] The rule configuration module reads external configuration files and stores the rule configuration information in a dictionary structure. This information includes the rule name, rule description, detection threshold, sensitivity coefficient, and rule detection calculation function. The rule factory has a global registry that records the mapping between rule names and corresponding rule detection calculation functions. This registry is used to instantiate the corresponding rule detection calculation function object at runtime using the rule name as input, outputting a callable rule instance. The rule implementation module takes acoustic emission data as input, calls the rule instance to execute the rule detection process, obtains standardized abnormal rule scores, and then performs a weighted average of the abnormal scores output by all rule instances to form a rule score vector. During the rule detection process, target features related to the rule are selected for feature statistics calculation. The generated feature statistics are compared with the detection threshold, and anomaly determination is made based on the comparison results. If the feature statistics exceed the detection threshold, it is determined to be an anomaly, and the excess degree is calculated. The excess degree is smoothed using the Sigmoid function to obtain a standardized anomaly standard score. During model training, the rule template engine is frozen and does not participate in parameter optimization.

[0061] As a specific implementation of the feature projection fusion layer, it takes the temporal feature vector and the regular anomaly score vector as input. It is used to concatenate the temporal feature vector and the regular anomaly score vector into a joint feature vector through the feature concatenation layer. Taking the joint feature vector as input, it learns the weight allocation of the temporal feature vector and the regular anomaly score vector through the first layer of linear transformation and RuLU activation, and outputs high-dimensional weighted features. The high-dimensional weighted features are then projected into low dimension through the second layer of linear transformation, and compressed features are output. The compressed features are normalized through the Tanh function, and the fused features are output. Correspondingly, the parameters of the two linear transformation layers are jointly optimized through backpropagation during the model training phase.

[0062] This embodiment designs a dual-channel feature fusion mechanism. For LSTM temporal feature extraction, a bidirectional LSTM network architecture is adopted, capturing acoustic emission signal features at different time scales through multiple hidden states. An attention mechanism is integrated to focus on anomalous signals at key time points. The rule template engine implements various professional rule detection methods. Each rule uses a sigmoid function to smooth the anomaly score, forming standardized rule features between 0 and 1. Specifically, all rules follow a unified computational framework of "feature extraction → anomaly degree quantification → score smoothing," as follows: Let the single-file data be the dataset. The rule corresponds to the target feature as The rule threshold is Then the rule score The calculation is as follows:

[0063] (1) Feature quantification: Calculate the target feature statistics (Such as calculation, proportion, extreme value, variance, etc., different rules correspond to different statistical definitions, and these statistics come from the actual business rules of different generation scenarios.)

[0064] (2) Anomaly detection: If Exceeding the normal range (including "greater than the threshold") "or less than the threshold" (Based on the rule type), calculate the excess amount. ;

[0065] (3) Score smoothing: The excess score is smoothed by using the sigmoid function. Mapped to The interval, the formula is:

[0066] ,

[0067] in, The sensitivity parameter (the rate of change of the control score with the degree of abnormality) is illustrated below using two actual business indicators. The calculation logic is as follows. This indicator is only used to intuitively illustrate the calculation approach for the degree of excess and can be flexibly replaced according to actual business needs. The content of the rule templates in the rule template engine is shown in Table 1.

[0068] Table 1. Rule Template Content

[0069]

[0070] The feature projection fusion layer concatenates the temporal feature vector and the rule-based score vector through an adaptive weight allocation mechanism. The network first concatenates the high-level temporal feature vector output from the LSTM with the rule-based score vector. Then, it learns the combined weights of the two types of features through a first-layer linear transformation. After ReLU nonlinear activation, a second-layer linear transformation projects the vector onto a unified low-dimensional feature space, and finally, the output is normalized using the Tanh function. This series of transformations enables the model to automatically learn the optimal weight allocation between temporal and rule-based features when constructing sample representations, generating a unified feature representation that integrates data-driven and knowledge-guided approaches. This ensures that the model can fully utilize the temporal characteristics of acoustic emission signals and expert experience.

[0071] This embodiment constructs a highly scalable custom rule template architecture through a rule template engine. This architecture adopts a modular design, supporting dynamic configuration and weight adjustment of any type of professional detection rule. Each rule contains complete configuration parameters: rule name, description, detection threshold, weight coefficient, and corresponding detection function. The rule templates are implemented using the factory pattern, supporting hot-swappable rule extensions. Users can customize new detection rules according to specific application scenarios without modifying the core algorithm architecture. A rule template example is as follows:

[0072] # Rule configuration dictionary structure

[0073] rule_config = {

[0074] 'rule_name': {

[0075] 'name': 'Rule Name',

[0076] 'description': 'Rule description information',

[0077] 'threshold': Detection threshold, # Rule trigger threshold

[0078] 'weight': Weighting factor, # The importance weight of the rule

[0079] 'function': rule_function # Rule detection calculation function

[0080] }

[0081] }

[0082] The rule template must meet the following requirements:

[0083] (1) Modular design: Each rule is independent, which facilitates maintenance and testing;

[0084] (2) Hot-swappable extension: Adding new rules does not require modifying the core code;

[0085] (3) Unified interface: All rules output 0-1 standardized anomaly scores;

[0086] (4) Configuration-driven: externalize rule parameters and adjust them flexibly.

[0087] Step S300 Model Training: Construct quantiles based on the proportion of abnormal samples in the sample set, calculate the hypersphere radius using the quantile method, construct the SVDD loss function as the basic loss function based on the Euclidean distance from the fused feature vector to the center of the hypersphere and the hypersphere radius, introduce a rule penalty term to construct a rule loss function, construct the total loss function by weighted summation of the basic loss function and the rule loss function, obtain the trained feature extraction model and the optimized hypersphere radius by minimizing the total loss function, and use the optimized hypersphere radius as the dynamic detection threshold.

[0088] To address the core issues of traditional SVDD in anomaly detection—sensitivity to noisy samples and neglect of domain expert experience—and to adapt to the strong temporal sequence and complex anomaly patterns of acoustic emission data, an improved robust SVDD loss function integrating "quantile radius calculation" and "rule-based penalty term" is designed. This function constructs the boundary of normal samples by optimizing the hypersphere center and radius parameters, achieving collaborative anomaly detection driven by data and guided by knowledge. Traditional SVDD relies on support vectors to determine the hypersphere radius, making it susceptible to extreme noise interference in acoustic emission data. This scheme uses a quantile method to calculate the radius, improving robustness to outliers. The basic SVDD loss, through the combination of radius and relaxation term, ensures that the vast majority of normal samples are enclosed by the hypersphere. As a specific implementation of model training, this step constructs the total loss function through the following operations:

[0089] (1) Sample data Corresponding fused feature vector To the center of the supersphere Euclidean distance square Represented as:

[0090] ,

[0091] (2) For all After sorting, based on the proportion of abnormal samples in the sample set Constructing quantiles Based on quantiles Construct a formula for calculating the radius of a hypersphere, and the square of the hypersphere radius. The calculation formula is expressed as follows:

[0092] ,

[0093] (3) Based on the squared Euclidean distance from the fused characteristic vector to the center of the hypersphere and the square of the hypersphere radius Constructing the SVDD loss function , is represented as:

[0094] ,

[0095] (4) Introduce a rule-based penalty term to guide the feature extraction model to apply penalties to samples deemed abnormal, and construct a rule-based loss function. Represented as:

[0096] ,

[0097] in, This represents the total number of rules and can be expanded using rule templates, such as rules for stress extremes or missing data ratios. Indicates the first One rule for sample data The score of the abnormal rules, Representing sample data The average rule anomaly score, ranging from A higher score indicates that the sample is more likely to be abnormal. This represents the Euclidean distance from the merged feature to the center of the hypersphere;

[0098] Core logic: Samples with high rule scores need to be farther away from the cluster center. By using the product term of "rule score × distance", the model actively pushes up the risk samples during training, thereby strengthening the anomaly detection capability.

[0099] (5) Construct the total loss function by weighted summation of the basic loss and rule loss. The total loss function is... Represented as:

[0100] ,

[0101] in, The weights representing the rule loss It can adaptively adjust the degree of influence of expert knowledge.

[0102] Model training employs the Adam optimizer combined with the ReduceLROnPlateau learning rate scheduling strategy, with an early stopping mechanism to prevent overfitting. Gradient norms are monitored in real-time during training, and gradient clipping is used to ensure training stability. Model weights are initialized uniformly using Xavier, the LSTM forget gate bias is set to 1, and the projection layer uses the Tanh activation function. The design is optimized specifically for the characteristics of acoustic emission data.

[0103] like Figure 3 As shown, the method in this embodiment introduces basic loss and rule loss to construct a loss function, significantly improving the accuracy and reliability of industrial equipment safety monitoring. Training Loss Comparison: The model with rules (orange line) has a higher initial training loss, but eventually converges to a similar level to the model without rules (blue line). This indicates that the introduction of rules increases the optimization difficulty in the early stages of training, but the model can learn to adapt to this hybrid loss (SVDD loss + rule loss) and eventually achieve a stable training effect.

[0104] Validation Loss Comparison: The validation loss of the unregulated model (blue line) decreases faster and eventually becomes lower, while the model with rules (orange line) shows less fluctuation in loss in the later stages. This demonstrates that while the unregulated model has a stronger ability to fit the validation set, the model with rules has better generalization stability and reduces the risk of overfitting by adapting to the business logic.

[0105] The rule loss (red line) continues to decrease with each training round, converging from close to 0.020 to below 0.010. The model effectively learned the anomaly discrimination logic of the "business rules" during training, and the optimization objective of the rule loss term was fully converged.

[0106] Distance Distribution: The distance distribution of the unregulated model is concentrated in the range of 0.125 to 0.175, while the distance distribution of the model with rules shifts to the right to the range of 0.300 to 0.325. This indicates that after introducing rules, the model can more significantly characterize the distance of "abnormal samples" (the larger the distance, the more likely it is to be abnormal). The addition of rules successfully allows the model to more clearly distinguish the feature distribution of "normal" and "abnormal" samples.

[0107] Step S400 Inference Prediction: The collected multi-channel acoustic emission data to be tested is preprocessed to obtain standardized time-series data as test samples. The test samples are input into the trained feature extraction model to obtain fused feature vectors. The Euclidean distance between the fused feature vectors and the center of the hypersphere is calculated as the feature distance. The feature distance is compared with the dynamic detection threshold. If the feature distance exceeds the dynamic detection threshold, it is judged as an anomaly, and the feature distance, rule score and relative threshold exceedance are output.

[0108] As a specific implementation of inference and prediction, the following steps are performed:

[0109] (1) Feature extraction and distance calculation: Input the acoustic emission data sample to be detected into the trained model, obtain its fused feature representation through feature extraction, and calculate the distance from the feature to the hypersphere center determined by the model. Euclidean distance ;

[0110] (2) Fixed threshold comparison: compare with The comparison is performed against the fixed anomaly threshold R that was finally determined and saved during the training phase.

[0111] (3) Anomaly detection: If If the condition is normal, the sample is considered abnormal; otherwise, it is considered normal.

[0112] During the model training phase, the algorithm is based on a preset upper limit parameter for the anomaly ratio. (e.g., 1%), in all training samples to the center In the distance distribution, calculate and lock the first The quantile (e.g., the 99th quantile) is used as the final detection threshold R. This threshold is a constant after training and is used for inference tasks. During model inference, the model simultaneously outputs the rule score details, feature distance value, and relative threshold exceedance for each anomalous sample.

[0113] Correspondingly, when preprocessing the collected multi-channel acoustic emission data, channel alignment, Z-score standardization, missing value mean filling, and sequence length unification operations are performed to generate standardized time-series data.

[0114] Long Short-Term Memory (LSTM) networks are a special type of recurrent neural network (RNN) architecture. Compared to traditional RNNs, LSTM effectively solves the vanishing and exploding gradient problems by introducing gating mechanisms (including input gates, forget gates, and output gates), enabling it to better capture long-term dependencies in time series. The core of LSTM lies in its cellular state mechanism, which allows information to be selectively retained or discarded during sequence processing, thus achieving the memorization of important temporal features and the forgetting of irrelevant information. Due to these characteristics, LSTM has been widely used in natural language processing, speech recognition, and time series prediction, becoming one of the preferred deep learning models for processing sequential data.

[0115] Support Vector Data Description (SVDD), proposed by Tax and Duin, is a single-classification algorithm that extends the application of Support Vector Machines (SVM) in anomaly detection. The basic idea of ​​SVDD is to find a minimal hypersphere in the feature space that contains the vast majority of normal data, classifying samples outside the hypersphere as anomalies. The core optimization objective of this algorithm is to simultaneously minimize the hypersphere radius and the amount of data it contains. Through kernel function tricks, it can handle complex, non-linearly separable data distributions. Compared to traditional density- or distance-based anomaly detection methods, SVDD has a solid foundation in statistical learning theory, is highly adaptable to high-dimensional data, and does not require anomaly samples for training. Therefore, it exhibits good performance in fields such as industrial anomaly detection, fault diagnosis, and cybersecurity.

[0116] This embodiment's method constructs a dual-channel architecture combining bidirectional LSTM temporal feature extraction and an expert rule engine. It designs an improved SVDD loss function that integrates quantile radius calculation and rule penalty terms, establishes a scalable custom rule template system, and employs a quantile partitioning mechanism to achieve unsupervised anomaly detection. This scheme can automatically learn the normal pattern boundaries of acoustic emission data without pre-labeling normal and abnormal samples, while effectively integrating expert experience and knowledge. This enables accurate detection and interpretable analysis of acoustic emission anomalies during gas cylinder pressure testing, significantly improving the accuracy and reliability of industrial equipment safety monitoring.

[0117] Example 2: The present invention provides a rule-guided LSTM-SVDD anomaly detection system, which includes a sample module, a model building module, a model training module, and an inference prediction module.

[0118] The sample acquisition module is used to perform the following: preprocess the acquired multi-channel historical acoustic emission data to obtain standardized time-series data, and use the standardized time-series data as samples to construct a sample set.

[0119] The model building module is used to perform the following: build a feature extraction model based on a bidirectional LSTM network, a rule template engine, and a feature projection fusion layer. The bidirectional LSTM network is used to extract multimodal features from the input data and output a temporal feature vector. The rule template engine is used to perform rule detection on the input data and output a rule score vector. The feature projection fusion layer is used to learn the weights assigned to the temporal feature vector and the rule score vector and fuse them to obtain a fused feature vector.

[0120] The model training module performs the following steps: quantiles are constructed based on the proportion of abnormal samples in the sample set; the hypersphere radius is calculated using the quantile method; an SVDD loss function is constructed as the basic loss function based on the Euclidean distance from the fused feature vector to the center of the hypersphere and the hypersphere radius; a regular penalty term is introduced to construct a regular loss function; the weighted sum of the basic loss function and the regular loss function is used to construct the total loss function; the trained feature extraction model and the optimized hypersphere radius are obtained by minimizing the total loss function; and the optimized hypersphere radius is used as the dynamic detection threshold.

[0121] The inference and prediction module is used to perform the following: preprocess the collected multi-channel acoustic emission data to obtain standardized time-series data as test samples, input the test samples into the trained feature extraction model to obtain fused feature vectors, calculate the Euclidean distance between the fused feature vectors and the center of the hypersphere as the feature distance, compare the feature distance with the dynamic detection threshold, if the feature distance exceeds the dynamic detection threshold, it is judged as an anomaly, and the feature distance and rule score are output.

[0122] The system in this embodiment can execute the method disclosed in Embodiment 1 to achieve anomaly detection, wherein the sample acquisition module corresponds to the sample acquisition operation, the model building module corresponds to the model building operation, the model training module corresponds to the model training operation, and the inference prediction module corresponds to the inference prediction operation.

[0123] The rule-guided LSTM-SVDD anomaly detection method and system provided by this invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A rule-guided LSTM-SVDD anomaly detection method, characterized in that, Includes the following steps: Sample acquisition: The acquired multi-channel historical acoustic emission data is preprocessed to obtain standardized time-series data, and the standardized time-series data is used as samples to construct a sample set; Model Construction: A feature extraction model is constructed based on a bidirectional LSTM network, a rule template engine, and a feature projection fusion layer. The bidirectional LSTM network is used to extract multimodal features from the input data and output a temporal feature vector. The rule template engine is used to perform rule detection on the input data and output a rule score vector. The feature projection fusion layer is used to learn the weights assigned to the temporal feature vector and the rule score vector and fuse them to obtain a fused feature vector. Model training: Quantiles are constructed based on the proportion of abnormal samples in the sample set. The hypersphere radius is calculated using the quantile method. The SVDD loss function is constructed as the basic loss function based on the Euclidean distance from the fused feature vector to the center of the hypersphere and the hypersphere radius. A regular penalty term is introduced to construct a regular loss function. The weighted sum of the basic loss function and the regular loss function is used to construct the total loss function. The trained feature extraction model and the optimized hypersphere radius are obtained by minimizing the total loss function. The optimized hypersphere radius is used as the dynamic detection threshold. Inference and prediction: The collected multi-channel acoustic emission data to be tested is preprocessed to obtain standardized time-series data as test samples. The test samples are input into the trained feature extraction model to obtain fused feature vectors. The Euclidean distance between the fused feature vectors and the center of the hypersphere is calculated as the feature distance. The feature distance is compared with the dynamic detection threshold. If the feature distance exceeds the dynamic detection threshold, it is judged as an anomaly, and the feature distance, rule score and relative threshold exceedance are output. 2.The rule-based LSTM-SVDD anomaly detection method of claim 1, wherein, The acquired multi-channel historical acoustic emission data is stored in CSV format. The acoustic emission data includes metadata and acoustic emission characteristic parameters. The metadata includes timestamp, channel number and pressure stage. The acoustic emission characteristic parameters include rise time, calculation, energy, duration, amplitude and frequency parameters. When preprocessing the collected multi-channel historical acoustic emission data, channel alignment, Z-score standardization, missing value mean imputation, and sequence length unification are performed to generate standardized time-series data. Correspondingly, when preprocessing the collected multi-channel acoustic emission data, channel alignment, Z-score standardization, missing value mean filling, and sequence length unification operations are performed to generate standardized time-series data. 3.The rule-based LSTM-SVDD anomaly detection method of claim 1, wherein, The bidirectional LSTM network performs multi-scale feature acquisition and outputs a hidden state matrix through multiple bidirectional LSTM layers. Using the hidden state matrix as input, it learns anomalous signals at key time points through an attention mechanism layer and outputs a context vector. The output layer performs linear mapping and Tanh activation on the context vector to output a fixed-dimensional temporal feature vector. 4.The rule-based LSTM-SVDD anomaly detection method of claim 1, wherein, The rule template engine includes a rule configuration module, a rule factory, and a rule implementation module; The rule configuration module is used to read external configuration files and store the rule configuration information in the configuration files in a dictionary structure. The rule configuration information includes rule name, rule description, detection threshold, sensitivity coefficient and rule detection calculation function. The rule factory is configured with a global registry, which records the mapping between rule names and corresponding rule detection calculation functions. This registry is used to instantiate the corresponding rule detection calculation function object at runtime using the rule name as input and the factory pattern, and output a callable rule instance. The rule implementation module takes acoustic emission data as input, calls rule instances to execute the rule detection process, obtains standardized abnormal rule scores, and forms a rule score vector by weighted averaging of the abnormal scores output by all rule instances. When executing the rule detection process, target features related to the rule are selected to calculate feature statistics. The generated feature statistics are compared with the detection threshold. Anomaly determination is made based on the comparison results. If the feature statistics exceed the detection threshold, it is determined to be abnormal and the excess degree is calculated. The excess degree is smoothed by the Sigmoid function to obtain a standardized abnormal standard score. During model training, the rule template engine is frozen and does not participate in parameter optimization. 5.The rule-based LSTM-SVDD anomaly detection method of claim 1, wherein, The feature projection fusion layer takes the temporal feature vector and the regular anomaly score vector as input. It is used to concatenate the temporal feature vector and the regular anomaly score vector into a joint feature vector through the feature concatenation layer. Taking the joint feature vector as input, the weight allocation of the temporal feature vector and the regular anomaly score vector is learned through the first layer linear transformation and RuLU activation, and a high-dimensional weighted feature is output. The high-dimensional weighted feature is then projected into a low dimension through the second layer linear transformation to output a compressed feature. The compressed feature is then normalized through the Tanh function to output the fused feature. Correspondingly, the parameters of the two linear transformations are jointly optimized through backpropagation during the model training phase. 6.The rule-based LSTM-SVDD anomaly detection method of claim 1, wherein, During model training, the total loss function is constructed using the following steps: Sample data Corresponding fused feature vector Euclidean distance square to hypersphere center Euclidean distance square to hypersphere center is expressed as: , For all After sorting, based on the proportion of abnormal samples in the sample set Construct quantile , based on the quantile Construct the formula for calculating the hypersphere radius, the square of the hypersphere radius The formula is represented as: , Based on the Euclidean distance square of the fusion characteristic vector to the hypersphere center and the hypersphere radius square Construct the SVDD loss function , expressed as: , The rule penalty term is introduced to guide the feature extraction model to impose a penalty on the abnormal sample, and a rule loss function is constructed is represented as: , in, This indicates the total number of rules. Indicates the first One rule for sample data The score of the abnormal rules, Representing sample data The average rule anomaly score, This represents the Euclidean distance from the merged feature to the center of the hypersphere; The total loss function is constructed by weighted summing of the basic loss and the rule loss. Represented as: , in, The weight representing the rule loss.

7. The rule-guided LSTM-SVDD anomaly detection method according to claim 1, characterized in that, When constructing quantiles based on the proportion of abnormal samples in a sample set, the proportion of abnormal samples in the current sample set is calculated based on the proportion of abnormal samples in the historical sample base, or the proportion of abnormal samples is calculated by sampling from the sample set.

8. A rule-guided LSTM-SVDD anomaly detection system, characterized in that, The system is used for anomaly detection using a rule-guided LSTM-SVDD anomaly detection method as described in any one of claims 1-7, the system comprising a sample module, a model building module, a model training module, and an inference prediction module; The sample acquisition module is used to perform the following: preprocess the acquired multi-channel historical acoustic emission data to obtain standardized time-series data, and use the standardized time-series data as samples to construct a sample set; The model building module is used to perform the following: build a feature extraction model based on a bidirectional LSTM network, a rule template engine, and a feature projection fusion layer. The bidirectional LSTM network is used to extract multimodal features from the input data and output a temporal feature vector. The rule template engine is used to perform rule detection on the input data and output a rule score vector. The feature projection fusion layer is used to learn the weights assigned to the temporal feature vector and the rule score vector and fuse them to obtain a fused feature vector. The model training module is used to perform the following: construct quantiles based on the proportion of abnormal samples in the sample set, calculate the hypersphere radius using the quantile method, construct the SVDD loss function as the basic loss function based on the Euclidean distance from the fused feature vector to the center of the hypersphere and the hypersphere radius, introduce a rule penalty term to construct a rule loss function, construct the total loss function by weighted summation of the basic loss function and the rule loss function, obtain the trained feature extraction model and the optimized hypersphere radius by minimizing the total loss function, and use the optimized hypersphere radius as the dynamic detection threshold; The inference and prediction module is used to perform the following: preprocess the collected multi-channel acoustic emission data to obtain standardized time-series data as test samples, input the test samples into the trained feature extraction model to obtain fused feature vectors, calculate the Euclidean distance between the fused feature vectors and the center of the hypersphere as the feature distance, compare the feature distance with the dynamic detection threshold, if the feature distance exceeds the dynamic detection threshold, it is judged as an anomaly, and the feature distance and rule score are output.

Citation Information

Patent Citations

  • Water treatment time sequence data anomaly detection method based on LSTM

    CN112765896A

  • Intelligent detection method for abnormal data of multidimensional signals of electromechanical servo system based on TimeGAN

    CN117574205A