Rotating machinery anomaly detection method and system based on spatio-temporal cross attention network
Patent Information
- Application Number
- CN202610793234.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-03
- Publication Date
- 2026-08-28
AI Technical Summary
[0006]本发明的目的在于提供一种基于时空交叉注意力网络的旋转机械异常检测方法及系统,它解决了现有技术中时空特征分离建模导致早期弱异常检测精度低、模型难以边缘端实时部署的问题,同时实现了时空融合精准检测、高鲁棒轻量化边缘部署
1、本发明通过双向交叉注意力机制实现空间特征与时序特征的深度交互融合,有效克服了传统方法时空分离建模的局限,能够精准捕捉“空间关联变化与时间趋势偏移相互耦合”的早期微弱故障信号,显著提升了早期弱异常的检测灵敏度和准确率。
Smart Images

Figure CN122654899A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent anomaly monitoring technology for industrial equipment, specifically a method and system for detecting anomalies in rotating machinery based on a spatiotemporal cross-attention network. Background Technology
[0002] Early detection of weak anomalies in rotating machinery (such as wind turbines, pump sets, and motors) is crucial to avoiding unplanned downtime. Existing technical solutions mainly fall into two categories: one uses graph attention networks (GAT) to model the spatial correlation of multi-sensor data, neglecting the fault evolution trend of monitoring data along the time dimension; the other uses Transformer to model temporal dependencies, but fails to capture the spatial topological correlation between sensors.
[0003] This spatiotemporal feature separation modeling approach makes it difficult to effectively extract the weak features of early faults (such as bearing microcracks) exhibiting "coupled spatial correlation changes and temporal trend shifts" in multi-sensor data, especially in noisy environments where these features are easily masked. Furthermore, real-world industrial sites present complex conditions such as variable loads and strong electromagnetic interference; the aforementioned separate model, lacking robust representation of spatiotemporal coupling features, exhibits significant performance fluctuations. Meanwhile, existing deep learning models typically have a large number of parameters and high inference latency, making them difficult to deploy directly on resource-constrained devices such as edge gateways and industrial control computers, thus failing to meet the demands of real-time, reliable online monitoring in industrial settings.
[0004] The above situation indicates that existing technologies face the dilemma of being unable to simultaneously achieve high accuracy in spatiotemporal fusion detection, robustness under complex operating conditions, and lightweight edge deployment.
[0005] Therefore, there is an urgent need for a method and system for detecting anomalies in rotating machinery based on spatiotemporal cross-attention networks to solve the above problems. Summary of the Invention
[0006] The purpose of this invention is to provide a rotating machinery anomaly detection method and system based on spatiotemporal cross-attention network. It solves the problems of low accuracy in early weak anomaly detection and difficulty in real-time deployment of models at the edge in the existing technology due to spatiotemporal feature separation modeling. At the same time, it realizes accurate detection through spatiotemporal fusion and highly robust and lightweight edge deployment.
[0007] To achieve the above objectives, the present invention employs the following technical solution: On one hand, this invention provides a method for detecting anomalies in rotating machinery based on a spatiotemporal cross-attention network, comprising the following steps: Step S1: Acquire multi-dimensional time-series data collected by several sensors deployed on the rotating machinery to form an input matrix. ,in For the number of sensors and , For time step, For feature dimensions; Step S2: Perform Z-score normalization on the input matrix, and divide the data after table transformation into input sequences according to a fixed window length and a preset overlap rate; Step S3: Input the input sequence obtained in step S2 into the spatial attention module. The spatial attention module constructs an association graph with the sensor as a node and extracts the spatial feature matrix of the sensor using a multi-head attention mechanism. , For spatial feature dimensions; Step S4: Input the input sequence obtained in step S2 into the temporal attention module, which extracts the temporal feature matrix through a Transformer encoder that includes positional encoding and multi-head self-attention mechanism. , For time-series features; Step S5: Convert the spatial feature matrix and time series feature matrix The input spatiotemporal cross-fusion module calculates the influence of spatial features on temporal features and the influence of temporal features on spatial features through a bidirectional cross-attention mechanism, and then obtains the fused features through gating fusion. ; Step S6: Analyze the fusion features Global pooling is performed to obtain a global feature vector, and the anomaly probability of the current window is calculated through mapping by a fully connected layer and the Sigmoid activation function. When the abnormal probability If the value is greater than or equal to a preset threshold and this condition is met in two consecutive windows, the rotating machinery is determined to be abnormal.
[0008] Preferably, in step S2, the fixed window length is 200 time steps, and the overlap rate between adjacent windows is 50%.
[0009] Preferably, in step S3, the spatial attention module performs the following steps: Using each sensor as a node, an adjacency matrix is constructed based on the distance inside the room and the signal transmission relationship. Adjacency weight Indicates the first The sensor and the first The correlation strength of each sensor; For each node The updated feature representation is calculated using a multi-head graph attention mechanism: ; in, For nodes Input features, The weight matrix is a learnable matrix. Represents a node The set of neighboring nodes, These are the attention coefficients obtained through Softmax normalization. The activation function is nonlinear; the features of all sensor nodes are combined along the time dimension to obtain the spatial feature matrix. .
[0010] Preferably, in step S4, the temporal attention module is implemented through a 6-layer Transformer encoder, each layer containing a multi-head self-attention sublayer and a feedforward neural network sublayer. After injecting positional encoding into the input sequence, a multi-head self-attention sublayer learns the dependencies between different time steps and outputs a temporal feature matrix. .
[0011] Preferably, in step S5, the spatiotemporal cross-fusion module obtains the fusion features in the following manner. : Step S51: Perform spatial-to-temporal cross-attention based on temporal features. As a query Based on spatial features For key Sum The influence of spatial correlation temporal trends is calculated to obtain the first cross feature. : ; in, , , The learnable parameter matrix for spatial-temporal cross-attention. This is the scaling factor; Step S52: Perform temporal-to-spatial cross-attention based on spatial features. As a query Using time sequence characteristics as For key Sum The impact of temporal trends on spatial associations is calculated to obtain the second cross feature. : ; in, , , The learnable parameter matrix for spatial-temporal cross-attention; Step S53: The first cross feature With the second cross feature The layers are spliced together, and the gating coefficients are calculated using a fully connected layer and a sigmoid function. : ; in, and For learnable parameters of gating fusion, For the Sigmoid function, Indicates feature concatenation operation; Step S54: Use gating coefficients to perform weighted fusion of the two cross features to obtain preliminary fused features. : ; in, Represents element-wise product; Step S55: Initially fuse features Dimensionality reduction to a uniform dimension using 1×1 convolution. Then, the final fused features are obtained by sequentially performing layer normalization and Dropout with a ratio of 0.1. .
[0012] Preferably, step S6 specifically includes: Fusion features Perform global average pooling to obtain global feature vectors. ; Anomaly probability is calculated by mapping through a fully connected layer and using the Sigmoid activation function. : ; in, and These are the weight matrix and bias terms of the fully connected layer; When the abnormal probability If the anomaly probability of two consecutive input windows both meet this condition, the rotating machinery is determined to have malfunctioned. Preferably, the anomaly detection network composed of the spatial attention module, the temporal attention module, and the spatiotemporal cross-fusion module is a lightweight network, wherein the lightweight processing includes: Structured pruning removes redundant attention heads from the Transformer encoder, keeping 60% of the original number of attention heads, and removes redundant neurons from fully connected layers, keeping 50% of the original number of neurons. The total number of network parameters after pruning does not exceed 1.5 million. INT8 quantization converts network weights from 32-bit floating-point quantization to 8-bit integers. Knowledge distillation uses the unpruned original STCAT model as the teacher model and the lightweight network as the student model, and trains it by minimizing the distillation loss.
[0013] On the other hand, the present invention also provides a rotating machinery anomaly detection system based on a spatiotemporal cross-attention network, for implementing the rotating machinery anomaly detection method based on a spatiotemporal cross-attention network as described above, comprising: The data acquisition module is used to acquire multi-dimensional time-series data collected by N sensors deployed on the rotating machinery; The preprocessing module is used to perform Z-score normalization and fixed window segmentation on the time series data to obtain the input sequence; The spatial attention module is used to construct an association graph with sensors as nodes and extract spatial feature matrices through a multi-head graph attention mechanism. The temporal attention module is used to extract the temporal feature matrix through a Transformer encoder that includes positional encoding and multi-head self-attention mechanism; The spatiotemporal cross-fusion module is used to perform bidirectional cross-attention fusion and gated fusion on spatial feature matrices and temporal feature matrices to obtain fused features. The anomaly detection module is used to calculate the anomaly probability by performing global pooling and fully connected mapping on the fused features, and to determine anomalies based on preset thresholds and continuous window conditions.
[0014] Preferably, the spatiotemporal cross-fusion module includes: The bidirectional cross-attention unit is configured to use spatial features or temporal features as query execution space-to-temporal and temporal-to-space cross-attention, respectively, to obtain the first cross-feature and the second cross-feature; The gated fusion unit is used to concatenate the first cross feature and the second cross feature, calculate the gate coefficient through a fully connected layer and a Sigmoid function, and use the gate coefficient to perform weighted fusion of the first cross feature and the second cross feature; A 1×1 convolutional dimensionality reduction unit is used to reduce the dimensionality of the gated fused features to a uniform dimension. The layer normalization unit and the Dropout unit perform layer normalization and dropout processing on the dimensionality-reduced features in sequence, and output the final fused features.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention achieves deep interactive fusion of spatial features and temporal features through a bidirectional cross-attention mechanism, effectively overcoming the limitations of traditional spatiotemporal separation modeling. It can accurately capture early weak fault signals that are "coupled with spatial correlation changes and temporal trend shifts", significantly improving the detection sensitivity and accuracy of early weak anomalies.
[0016] 2. This invention adopts a gating fusion mechanism to adaptively adjust the fusion weights of spatial features and temporal features, which enhances the model's resistance to industrial field interference such as variable load, strong electromagnetic interference, and forging impact. It can maintain stable detection performance even under wide range of operating condition fluctuations and strong noise environments, effectively reducing the performance fluctuation range.
[0017] 3. This invention significantly reduces the number of model parameters and inference latency through a combination of structured pruning, INT8 quantization, and knowledge distillation lightweight optimization strategies. This enables the model to achieve low-power, low-latency online inference on resource-constrained devices such as Raspberry Pi and edge gateways, meeting the deployment requirements for real-time anomaly early warning in industrial sites.
[0018] 4. This invention realizes a rapid end-to-end anomaly detection process, which can issue early warnings in the early stages of a fault, providing reliable technical support for predictive maintenance of rotating machinery and avoidance of unplanned downtime. Attached Figure Description
[0019] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a flowchart of the spatiotemporal cross-fusion module of the present invention obtaining fusion features; Figure 3 This is a schematic diagram of the system structure of the present invention. Detailed Implementation
[0020] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined in this application.
[0021] In this invention, terms such as "upper," "lower," "left," "right," "front," "back," "vertical," "horizontal," "side," and "bottom" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are used only to facilitate the description of the structural relationships of the various components or elements of this invention and do not specifically refer to any component or element in this invention. They should not be construed as limiting the invention.
[0022] Example: This embodiment takes the gearboxes of 10 1.5MW doubly-fed wind turbines in a wind farm as the monitoring object, and describes in detail the specific implementation process of the present invention. The wind farm is located in a complex terrain area, and the turbines are subjected to complex operating conditions such as wind speed fluctuations, grid interference and mechanical shocks all year round. As the core transmission component, the early detection of weak anomalies in the bearings, gears and other key components of the gearbox is of great significance for avoiding unplanned downtime and reducing operation and maintenance costs.
[0023] Vibration sensors are deployed at three key locations in the gearbox of each wind turbine, with the specific arrangement as follows: A first triaxial vibration sensor is deployed at the input shaft bearing housing of the gearbox, a second triaxial vibration sensor is deployed at the intermediate shaft bearing housing of the gearbox, and a third triaxial vibration sensor is deployed at the output shaft bearing housing of the gearbox. The sensor model selected is the DH-DF301 industrial-grade triaxial vibration sensor, with a sampling frequency uniformly set to 10kHz. Each channel simultaneously acquires vibration acceleration and velocity signals in the X, Y, and Z directions. A single sensor can provide 6 feature dimensions (3 acceleration channels and 3 velocity channels). Therefore, the number of sensors in this embodiment is... Feature dimensions of a single time step (3 sensors × 6 channels).
[0024] The data acquisition process is divided into two parts: the normal operation phase and the fault simulation phase. During normal operation, 100 hours of operating data were continuously collected under stable operating conditions near the rated power of each unit, covering different wind speed conditions (cut-in wind speed 3m / s to rated wind speed 12m / s), different load levels (load rate 50% to 100%), and different speed ranges (generator speed 800rpm to 1200rpm). All of this data was marked as normal samples. During the fault simulation phase, preset damage was machined on the same type of gearbox bearing under test bench conditions. This included microcracks with a width of 0.15 mm in the inner ring of the bearing due to electrical discharge machining, pitting with a width of 0.2 mm in the outer ring of the bearing, and spalling damage with a diameter of 0.1 mm on the surface of the rolling elements. 50 hours of running data were collected for each type of fault, and this part of the data was marked as abnormal samples. All data is uploaded to the data server after being precisely timestamped by an edge data collector.
[0025] The final dataset contains 100 hours of normal samples and 150 hours of abnormal samples. It is divided into training set, validation set and test set in chronological order at a ratio of 70%, 15% and 15%, respectively. This ensures that the training set contains only normal samples, while the validation set and test set contain both normal samples and various abnormal samples, so as to fully verify the model's generalization ability in unsupervised or semi-supervised scenarios.
[0026] The acquired raw multi-sensor time-series data is preprocessed, and the overall process is as follows: Figure 1 As shown, it includes: Step S1: Acquire multi-dimensional time-series data collected by several sensors deployed on the rotating machinery to form an input matrix; Step S2: Perform Z-score normalization on the input matrix, and divide the data after table transformation into input sequences according to a fixed window length and a preset overlap rate; Step S3: Input the input sequence obtained in step S2 into the spatial attention module. The spatial attention module constructs an association graph with the sensor as the node and uses a multi-head attention mechanism to extract the spatial feature matrix of the sensor. Step S4: Input the input sequence obtained in step S2 into the temporal attention module. The temporal attention module extracts the temporal feature matrix through a Transformer encoder that includes position encoding and multi-head self-attention mechanism. Step S5: Input the spatial feature matrix and temporal feature matrix into the spatiotemporal cross-fusion module, calculate the influence of spatial features on temporal features and the influence of temporal features on spatial features through a bidirectional cross-attention mechanism, and then obtain the fused features through gating fusion. Step S6: Global pooling is performed on the fused features to obtain a global feature vector. The abnormal probability of the current window is calculated by mapping through a fully connected layer and using the Sigmoid activation function. When the abnormal probability is greater than or equal to a preset threshold and the condition is met in two consecutive windows, it is determined that the rotating machinery has an abnormality.
[0027] Specifically, steps S1-S2 are as follows: First, the input data matrix is Z-score normalized: Organize the original data into an input matrix In the form of, For the number of sensors, The total time step (for 100 hours of data at a 10kHz sampling frequency, the original total step size is approximately...) step), For each feature dimension at a single time step, its mean is calculated independently. and standard deviation Then, perform a standardization transformation on each data point: This ensures that each feature dimension follows a standard normal distribution with a mean of 0 and a standard deviation of 1, eliminating the influence of different physical dimensions (acceleration and velocity) and differences in sensor sensitivity on model training; Secondly, the standardized data is windowed: Use fixed window length A sliding window strategy with 200 consecutive sampling points per window and a 50% overlap between adjacent windows is employed. Each window contains 200 consecutive sampling points, and the starting positions of adjacent windows differ by 100 time steps. For a sampling frequency of 10kHz, 200 time steps correspond to a physical duration of 20ms. This window length captures both the local features and transient impacts of the vibration signal while maintaining sufficient computational efficiency. The 50% overlap ensures the continuity of the fault evolution trend between windows, preventing the loss of weak fault signals due to window boundary cutting. The tensor dimension of each segmented input sequence is (3, 200, 18). One sensor, Each time step Each feature dimension.
[0028] Step S3 is as follows: The preprocessed input sequence is fed into the spatial attention module to extract spatial topological association features between multiple sensors: First, a sensor association graph is constructed, using the three vibration sensors on the gearbox as graph nodes. Adjacency relationships are determined based on the physical installation distances between the sensors and the mechanical transmission path of the vibration signal. Since there is gear meshing and transmission between the input shaft, intermediate shaft, and output shaft of the gearbox, and the vibration signal propagates from front to back along the transmission chain, there is a certain physical association between any two sensor nodes. A fully connected adjacency matrix is then constructed. Adjacency weight Indicates the first The sensor and the first In this embodiment, the correlation strength between the sensors is initialized based on the reciprocal of the sensor installation distance and further optimized through model training. For example, the initial adjacency weight of the input shaft sensor and the intermediate shaft sensor is relatively high because they are close to each other and have a direct meshing relationship. However, the initial weight of the input shaft sensor and the output shaft sensor is relatively low because they are connected through two stages of meshing. Then, a multi-head graph attention mechanism (GAT) is used to calculate the updated feature representation for each sensor node. The number of attention heads is set to four, and each attention head independently learns a set of attention coefficients. The outputs of the four heads are concatenated to obtain the final spatial features for each sensor node. It updates its own representation by aggregating the feature information of its neighboring nodes: ; in, For neighboring nodes The input feature vector, For learnable shared weight matrices, Represents a node The set of neighboring nodes (in this embodiment, the fully connected graph includes all other nodes and the node itself). The attention coefficients, normalized by Softmax, reflect the node's... For nodes The importance of By employing the ELU nonlinear activation function and the multi-head graph attention mechanism, the model can learn the complex interaction relationships between sensors from multiple representation subspaces. For example, when the vibration transmission characteristics of a sensor change due to loose installation, its corresponding attention weight will be adaptively adjusted. The updated features from all sensor nodes are stacked and combined along the time dimension to output a spatial feature matrix. Among them, spatial feature dimension Set to 64, this feature matrix encodes the spatial correlation patterns of each sensor at the same time, providing spatial context information for subsequent spatiotemporal fusion.
[0029] Step S4 is as follows: The temporal attention module in this step works in parallel with the spatial attention module in step S3. The same input sequence is fed into the temporal attention module to extract the evolution trend of fault features along the time dimension. The temporal attention module adopts an improved Transformer encoder architecture, stacking 6 encoder layers. Each layer contains a multi-head self-attention sub-layer and a feedforward neural network sub-layer. Each sub-layer uses residual connections and layer normalization to alleviate the gradient vanishing problem of deep networks and accelerate convergence. The number of multi-head self-attention heads is set to 8, the dimension of each attention head is 64, and the dimension of the hidden layer of the feedforward neural network is 256. Before performing time-series modeling on the input sequence, positional encoding is first injected. Since the Transformer's self-attention mechanism itself does not have the ability to perceive the sequence order, this embodiment uses a sine-cosine positional encoding method to encode each time step in the input sequence. Generate a unique encoded vector: , ; in, For time step index, For the index of the feature dimension, The temporal feature dimension is set to 128. The positional encoding is added element by element to the input sequence and then fed into the first encoder layer. In each multi-head self-attention sublayer of the encoder, the input sequence is mapped to a query ( ),key( ),value( Three sets of matrices, calculated and The model learns the dependency weights between different time steps by using dot product similarity, and then updates the feature representation of each time step by weighted aggregation. The six-layer stacking enables the model to capture multi-scale temporal dependencies from short-term transient impacts to long-term trend drifts, such as the regular distribution of periodic impact pulse sequences caused by bearing inner ring failure on the time axis, or the slow upward trend of vibration energy over several hours due to gear wear. Finally, the temporal attention module outputs a temporal feature matrix. ,in This feature matrix encodes the temporal evolution pattern exhibited by each sensor on its sampling sequence, providing temporal context information for subsequent spatiotemporal fusion.
[0030] Step S5 is as follows: The spatial feature matrix output by the spatial attention module The temporal feature matrix output by the temporal attention module Simultaneously, it is fed into the spatiotemporal cross-fusion module, which realizes deep interaction between the two modalities of space and time through a bidirectional cross-attention mechanism; like Figure 2 As shown, the implementation of spatiotemporal cross-fusion includes the following steps: 1. Perform spatial-temporal cross-attention based on temporal features. As a query Based on spatial characteristics As a key Sum The impact of spatial correlation patterns on temporal evolution trends is calculated using the following formula: ; in , , For the learnable parameter matrix, scaling factor The value is set to 8 to prevent the softmax gradient from vanishing due to an excessively large dot product result. 2. Perform temporal to spatial cross-attention, based on spatial features. As a query Based on time sequence characteristics As a key Sum The impact of temporal evolution trends on spatial correlation patterns is calculated using the following formula: ; in, , , The learnable parameter matrix for spatial-temporal cross-attention allows spatial and temporal features to serve as contexts for each other and enhance each other, accurately capturing two complementary spatiotemporal coupling information: "how spatial correlation patterns change over time" and "how temporal evolution trends affect the relationships between sensors." 3. A gating fusion mechanism is used to adaptively fuse the cross features of the two directions, and the first cross feature is then fused. Second cross features The concatenation is performed along the feature dimension, and the gating coefficients are calculated using a fully connected layer and a sigmoid activation function. : ; in, and For learnable parameters of gating fusion, Indicates feature concatenation operation, gating coefficient The gating coefficient is a value between 0 and 1, calculated independently at each feature location. It is used to dynamically adjust the contribution ratio of the intersecting features in two directions. When changes in operating conditions lead to a more significant spatial correlation pattern, the gating coefficient tends to move towards... Tilting; and when the fault evolution trend is more prominent in time sequence, the gating coefficient tends to tilt. Tilting, thereby achieving adaptive fusion; 4. Use gating coefficients to perform weighted fusion of the two cross-features to obtain preliminary fused features. : ; in, Represents element-wise product; 5. Perform dimensionality reduction and regularization on the initial fused features. Use a 1×1 convolution operation to reduce the dimensionality of the fused features from the current dimension to a unified dimension. The 1×1 convolution not only integrates information across channels but also further compresses redundant features. Subsequently, layer normalization is applied to stabilize the feature distribution, and dropout operation (with a dropout probability set to 0.1) is performed to prevent overfitting, resulting in the final fused features. .
[0031] Step S6 is as follows: First, regarding fusion features Perform global average pooling operations on both the time and sensor dimensions to compress the three-dimensional features into a one-dimensional global feature vector. , Global average pooling can significantly reduce the number of parameters while preserving the main feature information, thus reducing the computational burden on subsequent fully connected layers. Then, the global feature vector is processed through a fully connected network. The value is mapped to a scalar, and then the sigmoid activation function is used to output the anomaly probability of the current window. : ; in This is the weight matrix. As a bias term, the Sigmoid function compresses the output value to the (0,1) interval, which can be interpreted as the probability that the input window belongs to an anomalous class; The anomaly detection strategy combines thresholds with persistence conditions: Preset threshold When the anomaly probability of a single window If an alarm is not triggered immediately, the judgment results of subsequent consecutive windows will be checked; an alarm will only be triggered if the anomaly probabilities of two consecutive input windows both meet the condition. Only when certain conditions are met is an abnormality of the rotating machinery determined. This dual-window confirmation mechanism effectively avoids false alarms caused by momentary interference or accidental vibration and impact, and significantly reduces the false alarm rate in practical industrial applications.
[0032] To meet the real-time inference requirements of resource-constrained edge environments, a combined lightweight optimization is implemented on the original anomaly detection network that has been trained as described above: 1. First, structured pruning is performed. For the multi-head self-attention part of the 6-layer Transformer encoder in the temporal attention module, the contribution of each attention head to the model output is evaluated layer by layer. After sorting by contribution, the 40% of attention heads with the lowest contribution are removed, that is, 60% of the number of attention heads are retained (reduced from 8 heads to about 5 heads). At the same time, for the fully connected layer of the feedforward neural network in the encoder, the weight norm of each neuron is calculated layer by layer, and the 50% of neurons with the smallest weight norm are removed. After pruning, the total number of model parameters is reduced from about 8.6 million to about 1.5 million, with a compression ratio of about 5.7 times. 2. Next, INT8 quantization is performed to map all 32-bit floating-point weight parameters in the pruned model to 8-bit integer format. Specifically, a symmetric linear quantization scheme is adopted. The quantization parameters (scaling factor and zero point) are determined by statistically analyzing the activation value range on the calibration dataset (5% of samples randomly selected from the training set). INT8 quantization reduces the model's storage space and memory usage to about one-quarter of the original size. At the same time, integer operations are much more efficient than floating-point operations on edge computing chips. 3. Finally, knowledge distillation fine-tuning is performed. The unpruned original model is used as the teacher model, and the pruned and quantized lightweight model is used as the student model. A soft-label distillation strategy is adopted, with the teacher model and student model outputting anomaly probabilities for the same input. The distillation loss function consists of two weighted parts: (1) KL divergence between student model output and teacher model output (distillation temperature) ); (2) Binary cross-entropy loss between student model output and real label; The weight ratio of the two parts was set to 0.7:0.3. By performing an additional 20 rounds of distillation training on the training set, the lightweight student model fully inherited the detection capabilities of the teacher model without losing more than 1.5% of its accuracy. 4. Export the lightweight model in ONNX (Open Neural Network Exchange) format and deploy it on the edge computing gateway of the wind farm (such as industrial control equipment equipped with Rockchip RK3588 chip). The gateway simultaneously connects to the data acquisition channels of 3 vibration sensors, continuously receives vibration sequence data in a sliding window manner, and calls the lightweight model to complete all inference calculations locally without uploading the original data to the cloud.
[0033] In this embodiment, the system deployment is as follows: Figure 3 As shown, the data acquisition module, preprocessing module, spatial attention module, temporal attention module, spatiotemporal cross-fusion module, and anomaly detection module are connected sequentially to form a complete detection system. The edge gateway reads multi-dimensional time-series data from three vibration sensors in real time. The preprocessing module performs Z-score normalization on the raw data and continuously generates the input sequence using a sliding window with a window length of 200 and an overlap rate of 50%. The spatial attention module and the temporal attention module extract spatial features and temporal features from the input sequence, respectively. The spatiotemporal cross-fusion module performs bidirectional cross-attention fusion and gated fusion on the two types of features to generate fused features; The anomaly detection module calculates the anomaly probability of the current window and makes an anomaly detection based on the threshold and the dual-window condition.
[0034] In the scenario of detecting microcracks (crack width 0.15mm) in the inner ring of a bearing, the model outputs an abnormal probability of more than 0.6 in the 12th window after the fault occurs, and triggers an early warning after confirmation in the 13th window. The actual delay from fault injection to issuing an early warning is about 3.2 seconds, which is about 1.8 seconds earlier than the traditional Transformer model (which takes about 5 seconds to trigger an early warning). In the variable load test (the unit load rate jumps from 50% to 100% within 10 minutes), this method maintains stable detection throughout the load change process, with performance index fluctuation within 3%. In contrast, the traditional GAT plus Transformer separate model fluctuates by more than 11% under the same test conditions and has multiple false alarms when accompanied by drastic load changes. In actual edge gateway deployment tests, the single inference latency of the lightweight model is stable at around 18 milliseconds. With the time for data preprocessing and window stitching, the end-to-end detection latency is about 22 milliseconds, which is far lower than the industrial real-time requirement of 50 milliseconds. The average daily power consumption of a single edge gateway device is only 0.3 kWh, which fully meets the low power consumption requirements of wind farms for long-term unattended operation; In the robustness test under varying operating conditions, a strong noise environment with a signal-to-noise ratio of 10dB was set for verification. The F1 score for anomaly detection remained above 0.85, demonstrating good resistance to electromagnetic interference and mechanical vibration coupled noise in industrial environments. In the identification tasks of various fault types (inner ring cracks, outer ring pitting, and rolling element spalling), the model does not need to be structurally adjusted or retrained for different fault types. It can output high-confidence anomaly probabilities simply through a unified spatiotemporal cross-attention network, demonstrating good versatility and transferability.
[0035] The above is a detailed description of the preferred embodiments of the present invention, but the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.
Claims
1. A method for detecting anomalies in rotating machinery based on a spatiotemporal cross-attention network, characterized in that, Includes the following steps: Step S1: Acquire multi-dimensional time-series data collected by several sensors deployed on the rotating machinery to form an input matrix. ,in For the number of sensors and , For time step, For feature dimensions; Step S2: Perform Z-score normalization on the input matrix, and divide the data after table transformation into input sequences according to a fixed window length and a preset overlap rate; Step S3: Input the input sequence obtained in step S2 into the spatial attention module. The spatial attention module constructs an association graph with the sensor as a node and extracts the spatial feature matrix of the sensor using a multi-head attention mechanism. , For spatial feature dimensions; Step S4: Input the input sequence obtained in step S2 into the temporal attention module, which extracts the temporal feature matrix through a Transformer encoder that includes positional encoding and multi-head self-attention mechanism. , For time-series features; Step S5: Convert the spatial feature matrix and time series feature matrix The input spatiotemporal cross-fusion module calculates the influence of spatial features on temporal features and the influence of temporal features on spatial features through a bidirectional cross-attention mechanism, and then obtains the fused features through gating fusion. ; Step S6: Analyze the fusion features Global pooling is performed to obtain a global feature vector, and the anomaly probability of the current window is calculated through mapping by a fully connected layer and the Sigmoid activation function. When the abnormal probability If the value is greater than or equal to a preset threshold and this condition is met in two consecutive windows, the rotating machinery is determined to be abnormal.
2. The rotating machinery anomaly detection method based on spatiotemporal cross-attention network according to claim 1, characterized in that, In step S2, the fixed window length is 200 time steps, and the overlap rate between adjacent windows is 50%.
3. The rotating machinery anomaly detection method based on spatiotemporal cross-attention network according to claim 1, characterized in that, In step S3, the spatial attention module performs the following steps: Using each sensor as a node, an adjacency matrix is constructed based on the distance inside the room and the signal transmission relationship. Adjacency weight Indicates the first The sensor and the first The correlation strength of each sensor; For each node The updated feature representation is calculated using a multi-head graph attention mechanism: ; in, For nodes Input features, The weight matrix is a learnable matrix. Represents a node The set of neighboring nodes, These are the attention coefficients obtained through Softmax normalization. The activation function is nonlinear; the features of all sensor nodes are combined along the time dimension to obtain the spatial feature matrix. .
4. The rotating machinery anomaly detection method based on spatiotemporal cross-attention network according to claim 1, characterized in that, In step S4, the temporal attention module is implemented through a 6-layer Transformer encoder, each layer containing a multi-head self-attention sub-layer and a feedforward neural network sub-layer. After injecting positional encoding into the input sequence, a multi-head self-attention sublayer learns the dependencies between different time steps and outputs a temporal feature matrix. .
5. The rotating machinery anomaly detection method based on spatiotemporal cross-attention network according to claim 1, characterized in that, In step S5, the spatiotemporal cross-fusion module obtains the fusion features in the following manner. : Step S51: Perform spatial-to-temporal cross-attention based on temporal features. As a query Based on spatial features For key Sum The influence of spatial correlation temporal trends is calculated to obtain the first cross feature. : ; in, , , The learnable parameter matrix for spatial-temporal cross-attention. This is the scaling factor; Step S52: Perform temporal-to-spatial cross-attention based on spatial features. As a query Using time sequence characteristics as For key Sum The impact of temporal trends on spatial associations is calculated to obtain the second cross feature. : ; in, , , The learnable parameter matrix for spatial-temporal cross-attention; Step S53: The first cross feature With the second cross feature The layers are spliced together, and the gating coefficients are calculated using a fully connected layer and a sigmoid function. : ; in, and For learnable parameters of gating fusion, For the Sigmoid function, Indicates feature concatenation operation; Step S54: Use gating coefficients to perform weighted fusion of the two cross features to obtain preliminary fused features. : ; in, Represents element-wise product; Step S55: Initially fuse features Dimensionality reduction to a uniform dimension using 1×1 convolution. Then, the final fused features are obtained by sequentially performing layer normalization and Dropout with a ratio of 0.
1. .
6. The rotating machinery anomaly detection method based on spatiotemporal cross-attention network according to claim 1, characterized in that, Step S6 is as follows: Fusion features Perform global average pooling to obtain global feature vectors. ; Anomaly probability is calculated by mapping through a fully connected layer and using the Sigmoid activation function. : ; in, and These are the weight matrix and bias terms of the fully connected layer; When the abnormal probability If the abnormal probability of two consecutive input windows both meet this condition, it is determined that the rotating machinery has malfunctioned.
7. The rotating machinery anomaly detection method based on spatiotemporal cross-attention network according to claim 1, characterized in that, The anomaly detection network composed of the spatial attention module, temporal attention module, and spatiotemporal cross-fusion module is a lightweight network, which includes: Structured pruning removes redundant attention heads from the Transformer encoder, keeping 60% of the original number of attention heads, and removes redundant neurons from fully connected layers, keeping 50% of the original number of neurons. The total number of network parameters after pruning does not exceed 1.5 million. INT8 quantization converts network weights from 32-bit floating-point quantization to 8-bit integers. Knowledge distillation uses the unpruned original STCAT model as the teacher model and the lightweight network as the student model, and trains it by minimizing the distillation loss.
8. A rotating machinery anomaly detection system based on a spatiotemporal cross-attention network, used to implement the rotating machinery anomaly detection method based on a spatiotemporal cross-attention network as described in any one of claims 1-7, characterized in that, include: The data acquisition module is used to acquire multi-dimensional time-series data collected by N sensors deployed on the rotating machinery; The preprocessing module is used to perform Z-score normalization and fixed window segmentation on the time series data to obtain the input sequence; The spatial attention module is used to construct an association graph with sensors as nodes and extract spatial feature matrices through a multi-head graph attention mechanism. The temporal attention module is used to extract the temporal feature matrix through a Transformer encoder that includes positional encoding and multi-head self-attention mechanism; The spatiotemporal cross-fusion module is used to perform bidirectional cross-attention fusion and gated fusion on spatial feature matrices and temporal feature matrices to obtain fused features. The anomaly detection module is used to calculate the anomaly probability by performing global pooling and fully connected mapping on the fused features, and to determine anomalies based on preset thresholds and continuous window conditions.
9. The rotating machinery anomaly detection system based on spatiotemporal cross-attention network as described in claim 8, characterized in that, The spatiotemporal cross-fusion module includes: The bidirectional cross-attention unit is configured to use spatial features or temporal features as query execution space-to-temporal and temporal-to-space cross-attention, respectively, to obtain the first cross-feature and the second cross-feature; The gated fusion unit is used to concatenate the first cross feature and the second cross feature, calculate the gate coefficient through a fully connected layer and a Sigmoid function, and use the gate coefficient to perform weighted fusion of the first cross feature and the second cross feature; A 1×1 convolutional dimensionality reduction unit is used to reduce the dimensionality of the gated fused features to a uniform dimension. The layer normalization unit and the Dropout unit perform layer normalization and dropout processing on the dimensionality-reduced features in sequence, and output the final fused features.