Pipeline system fault diagnosis method and system based on hierarchical attention mechanism
Through the fault diagnosis method of pipeline system based on the hierarchical attention mechanism, the characteristics of pipeline data are extracted using the pyramid residual convolution network and the bidirectional long and short-term memory network, and combined with the variational autoencoder to perform data balance, the data in the existing technology is solved. The problem of feature extraction difficulties and category imbalances has achieved efficient and accurate pipeline fault detection.
Patent Information
- Application Number
- CN202411074855.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-08-05
- Filing Date
- 2024-08-06
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-08-06
AI Technical Summary
Existing pipeline fault detection methods are difficult to capture the spatial and temporal characteristics of the data when processing data with high-dimensional and strong spatial and temporal correlations, and the problem of data category imbalance affects the model detection effect, resulting in low detection accuracy and efficiency.
Using the fault diagnosis method of pipeline system based on the hierarchical attention mechanism, multi-level spatial features and bidirectional timing features are extracted through the pyramid residual convolution network and the three-layer bidirectional long and short-term memory network, and the model is optimized through the hierarchical attention network model. Combining the variable autoencoder for data balancing, an end-to-end fault diagnosis system is built.
It significantly improves the accuracy and efficiency of pipeline fault detection, enhances the ability to identify rare fault types, ensures data reliability and model generalization capabilities, and provides scientifically based fault diagnosis results.
Smart Images

Figure CN119004322A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pipeline fault detection, and in particular to a pipeline system fault diagnosis method and system based on a hierarchical attention mechanism. Background Art
[0002] At present, with the rapid development of modern industry, pipeline systems have been widely used in the fields of oil, natural gas, chemical industry, water supply and drainage. However, pipelines face many challenges in operation, such as external environmental changes, internal medium corrosion and human operation errors, which may lead to pipeline corrosion, cracks, leakage and blockage. If these faults are not discovered and handled in time, they will cause serious economic losses, environmental pollution and even threaten human life safety.
[0003] Existing pipeline fault detection methods mainly include traditional detection methods and methods based on deep learning. Traditional detection methods such as ultrasonic detection, magnetic particle detection, X-ray detection and infrared detection are highly dependent on professional equipment and manual operation, and have problems such as low detection efficiency, high cost and high technical requirements. In addition, they are easily disturbed by environmental noise under complex working conditions, making it difficult to ensure the reliability and accuracy of the detection results.
[0004] Although deep learning-based methods represent a new technological trend that can automatically extract high-level features of data, thereby improving detection accuracy and efficiency, they still have shortcomings when processing high-dimensional data with strong spatiotemporal correlation, especially the difficulty in capturing the spatial and temporal characteristics of the data at the same time; in addition, the problem of data category imbalance also seriously affects the detection effect of the model. Summary of the invention
[0005] The present invention aims to solve the technical problem in the prior art that it is difficult to efficiently extract the spatiotemporal features of data, which leads to low pipeline detection accuracy and low efficiency, and provides a pipeline system fault diagnosis method and system based on a hierarchical attention mechanism.
[0006] In view of the above technical problems, an embodiment of the present invention provides a pipeline system fault diagnosis method based on a hierarchical attention mechanism, comprising:
[0007] The original operation data of the pipeline system is obtained in real time, and the original operation data is preprocessed to obtain an enhanced fault data set, which is then divided into a pipeline fault training set, a pipeline fault verification set, and a pipeline fault test set;
[0008] Build a pyramid residual convolutional network PRCN to extract multi-level spatial features of the enhanced fault data set; build a three-layer bidirectional long short-term memory network TBiLSTM to extract bidirectional temporal features of the enhanced fault data set;
[0009] A hierarchical attention network model CBHANet is constructed based on the pyramid residual convolutional network PRCN and the three-layer bidirectional long short-term memory network TBiLSTM, and the model is optimized through the hierarchical attention mechanism;
[0010] The pipeline fault training set is used to train the hierarchical attention network model CBHANet, the validation set is used to test the model accuracy after each iteration of training, the test set is used to predict the pipeline fault type, and the model accuracy is calculated;
[0011] The trained hierarchical attention network model CBHANet is used for pipeline fault diagnosis.
[0012] The present invention also provides a pipeline system fault diagnosis system based on a hierarchical attention mechanism, comprising:
[0013] An acquisition module is used to acquire the original operation data of the pipeline system in real time, preprocess the original operation data to obtain an enhanced fault data set, and divide it into a pipeline fault training set, a pipeline fault verification set, and a pipeline fault test set;
[0014] The feature extraction module is used to build a pyramid residual convolutional network (PRCN) to extract multi-level spatial features of the enhanced fault data set; build a three-layer bidirectional long short-term memory network (TBiLSTM) to extract bidirectional temporal features of the enhanced fault data set;
[0015] Model building module, which is used to build a hierarchical attention network model CBHANet based on the pyramid residual convolutional network PRCN and the three-layer bidirectional long short-term memory network TBiLSTM, and optimize the model through the hierarchical attention mechanism;
[0016] The model training module is used to train the hierarchical attention network model CBHANet using the pipeline fault training set, use the validation set to verify the model accuracy after each iteration of training, use the test set to predict the pipeline fault type, and calculate the model accuracy;
[0017] The fault diagnosis module is used to apply the trained hierarchical attention network model CBHANet to perform pipeline fault diagnosis.
[0018] The present invention has the following beneficial effects:
[0019] (1) In this invention, an efficient and powerful end-to-end solution is constructed. The core is a hierarchical attention network CBHANet based on convolution and bidirectional long short-term memory. The network integrates a variety of advanced technologies and strategies to improve the accuracy and efficiency of fault diagnosis. The noise and outliers in the sensor data are effectively removed by data cleaning technology to ensure the consistency and reliability of the data, providing a high-quality data foundation for model training. In order to solve the problem of insufficient minority fault data in the data set, the variational autoencoder VAE is used to enhance the data, which effectively improves the balance of the data set and enhances the recognition and diagnosis capabilities of rare fault types.
[0020] (2) When processing complex pipeline monitoring images and various sensor data, the present invention uses the pyramid residual convolution network PRCN to gradually extract and refine features through a hierarchical method, uses large convolution kernels to capture macro features, and small convolution kernels to extract fine features, and uses feature fusion technology to comprehensively capture multi-level spatial features, so that PRCN has powerful feature extraction capabilities and robustness when processing complex pipeline monitoring images and sensor data. TBiLSTM combines bidirectional LSTM units and three-layer stacking structures, as well as ReLU activation functions and Dropout operations to achieve deep extraction of temporal features in pipeline monitoring data, so that the model can simultaneously utilize forward and backward information in the data to capture long-term and short-term dependencies, and improve the prediction accuracy and generalization ability of the model through nonlinear transformations and strategies to prevent overfitting. In the HA-PFDM method, TBiLSTM, as an important component of spatiotemporal feature extraction, provides strong support for the final fault diagnosis.
[0021] (3) The present invention utilizes a CBHANet network constructed by a TT and PC parallel structure to ensure that the spatiotemporal features extracted from the TT and PC structures can complement and enhance each other in the fusion process and are input into the multi-layer perceptron MLP to perform complex fault diagnosis tasks. Through the comprehensive evaluation of feature fusion and multi-layer perceptron MLP, it can output fault diagnosis results that accurately reflect the probability distribution of different fault types, providing a scientific basis for subsequent decision-making. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A schematic diagram of a pipeline system fault diagnosis process based on a hierarchical attention mechanism in one embodiment of the present invention;
[0023] Figure 2 1 is a flow chart of step S10 of a pipeline system fault diagnosis method in one embodiment of the present invention;
[0024] Figure 3 1 is a flow chart of step S20 of the pipeline system fault diagnosis method in one embodiment of the present invention;
[0025] Figure 4 is a flow chart of step S20 of a pipeline system fault diagnosis method in another embodiment of the present invention;
[0026] Figure 5 1 is a flow chart of step S30 of a pipeline system fault diagnosis method in one embodiment of the present invention;
[0027] Figure 6 is a schematic diagram of a data balancer DBE in one embodiment of the present invention;
[0028] Figure 7 is a structural diagram of a pyramid residual convolutional network PRCN in one embodiment of the present invention;
[0029] Figure 8 A structural diagram of a bidirectional long short-term memory network BiLSTM in one embodiment of the present invention;
[0030] Fig. 9 A structural diagram of a bidirectional long short-term memory network BiLSTM in another embodiment of the present invention;
[0031] Fig.10 A structural diagram of a temporal attention mechanism TAT in one embodiment of the present invention;
[0032] Fig.11 4 is a structural diagram of a hierarchical attention network CBHANet in one embodiment of the present invention;
[0033] Fig.12 4 is a structural diagram of a convolutional block attention module CBAM in one embodiment of the present invention;
[0034] Fig.13 is a schematic structural diagram of a pipeline system fault diagnosis system in one embodiment of the present invention;
[0035] Fig.14 It is a schematic diagram of the structure of a controller in one embodiment of the present invention. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0037] In one embodiment, if Figure 1As shown, a pipeline system fault diagnosis method based on a hierarchical attention mechanism includes the following steps S10-S50:
[0038] S10. Acquire the original operation data of the pipeline system in real time, preprocess the original operation data to obtain an enhanced fault data set, and divide it into a pipeline fault training set, a pipeline fault verification set, and a pipeline fault test set; understandably, the original operation data is preprocessed to obtain an enhanced fault data set, and the enhanced fault data set can ensure the consistency and reliability of subsequent model input data and reduce the impact on subsequent model training; the reasonable division of the enhanced fault data set provides a basis for subsequent model training and evaluation.
[0039] S20. Build a pyramid residual convolution network PRCN to extract multi-level spatial features of the enhanced fault data set; build a three-layer bidirectional long short-term memory network TBiLSTM to extract bidirectional time series features of the enhanced fault data set; understandably, the built pyramid residual convolution network PRCN can enhance the model's ability to process complex spatial data and improve the accuracy and efficiency of spatial feature extraction. The built three-layer bidirectional long short-term memory network TBiLSTM can enhance the model's ability to process time series data, especially the adaptability and prediction accuracy to dynamic data changes. The multi-scale feature extraction capability of PRCN and the time series data processing capability of TBiLSTM jointly optimize the model's processing efficiency for complex data and the accuracy of fault prediction.
[0040] S30. A hierarchical attention network model CBHANet is constructed based on a pyramid residual convolutional network PRCN and a three-layer bidirectional long short-term memory network TBiLSTM, and the model is optimized through a hierarchical attention mechanism; understandably, the hierarchical attention network model CBHANe can simultaneously extract feature information of the pipeline from both time and space dimensions, and fuse temporal and spatial features. As an end-to-end network structure that integrates analysis modules of multi-level spatial features and bidirectional temporal features, CBHANet can not only optimize computational efficiency, but also improve the accuracy of pipeline fault detection.
[0041] S40. Use the pipeline fault training set to train the hierarchical attention network model CBHANet, use the validation set to test the model accuracy after each iteration of training, use the test set to predict the pipeline fault type, and calculate the model accuracy; understandably, the CBHANet model parameters are continuously optimized through the training process to improve the generalization ability of the CBHANet model. The use of the validation set and the test set ensures the objectivity and accuracy of the CBHANet model evaluation, and the calculation of the CBHANet model accuracy provides a basis for the comparison and optimization of model performance.
[0042] S50, applying the trained hierarchical attention network model CBHANet to pipeline fault diagnosis. Understandably, the trained CBHANet model is applied to actual pipeline fault diagnosis. The CBHANet model receives pipeline operation data collected in real time, and inputs it into the model for fault prediction after preprocessing, so as to realize real-time monitoring and rapid diagnosis of pipeline faults.
[0043] In the present invention, the original operation data of the pipeline is obtained in real time and preprocessed to construct an enhanced fault data set to ensure the consistency and reliability of data input; the pyramid residual convolution network PRCN and the bidirectional long short-term memory network TBiLSTM are used to extract multi-level spatial features and bidirectional temporal features respectively, and the processing ability of complex spatial data and time series data is enhanced; then, based on the pyramid residual convolution network PRCN and the bidirectional long short-term memory network TBiLSTM, a hierarchical attention network model CBHANet is constructed to realize the extraction of pipeline feature information from two dimensions of time and space, and optimize the model's ability to represent features. CBHANet is an end-to-end network structure that can not only optimize computing efficiency, but also significantly improve the accuracy of pipeline fault detection. The above pipeline fault diagnosis method is referred to as a pipeline system fault diagnosis method HA-PFDM based on a hierarchical attention mechanism in the present invention.
[0044] In one embodiment, if Figure 2 As shown, the step S10 includes the following steps S101-S104:
[0045] S101. Use sensors and cameras to collect the original operation data of the pipeline system in real time, and the original operation data includes pipeline pressure changes, flow fluctuations, temperature fluctuations and visual images of the external structure; understandably, use a pressure sensor to obtain the pipeline pressure value in real time, use a flow sensor to obtain the pipeline flow value in real time, and use a temperature sensor to obtain the pipeline temperature value in real time, and use the above sensors to monitor the changes in pipeline pressure, flow and temperature to understand the working status of the pipeline system in real time. Use a camera to capture a visual image of the external structure of the pipeline, and you can intuitively observe the physical conditions of the pipeline and the surrounding environment, such as corrosion, cracks or other visible damage. Combining numerical data and image data, the operation of the pipeline can be analyzed from different angles to improve the comprehensiveness and accuracy of fault detection.
[0046] S102. Use Fourier transform to clean the original operation data, remove noise and outliers, and obtain a fault diagnosis data set; understandably, the original operation data is deeply cleaned by Fourier transform, and the noise and outliers introduced by sensor failure, environmental noise and operating errors are identified and filtered out, thereby ensuring the accuracy of the data entering the analysis process, so as to truly reflect the operating status of the pipeline system, thereby significantly reducing the risk of misdiagnosis.
[0047] S103. Use the data balancer DBE to perform data enhancement on the fault diagnosis data set, especially to process the minority class fault data to add new fault diagnosis data samples and obtain an enhanced fault data set; DBE, as a deep generative model, constructs an exclusive normal distribution for each sample, and then reconstructs it through sampling.
[0048] In one embodiment, the step S103 includes the following steps S1031-S1033:
[0049] S1031. Use the encoder of the data balancer DBE to learn the fault diagnosis data set, extract the features of the fault diagnosis data, and calculate the mean μ and standard deviation σ of the fault diagnosis data; it can be understood that the mean μ and standard deviation σ of the fault diagnosis data describe the central position and dispersion of the fault diagnosis data in the feature space.
[0050] S1032. Randomly sample an ε from the standard normal distribution N(0, 1), and calculate the latent variable Z according to the mean μ and the standard deviation σ through the formula Z=μ+σ*ε; understandably, the latent variable Z will be used as part of the decoder input to reconstruct the original data.
[0051] S1033, input the latent variable Z to the decoder of the data balancer DBE, and the decoder reconstructs a plurality of new fault diagnosis data samples X′ according to the latent variable Z to form an enhanced fault data set. It can be understood that the decoder reconstructs a plurality of new fault diagnosis data samples according to the latent variable Z and the data features X learned by the encoder, and these newly generated data samples will be used to enhance the number of minority class fault data in the original data set.
[0052] It can be understood that in the above steps S1031-S1033, the data balancer DBE is used to enhance the minority class fault data, balance the data set, and enhance the model's ability to identify rare faults.
[0053] S104. Use a labeling tool to label the data in the enhanced fault data set, save it in the same format file, and divide it into a pipeline fault training set, a pipeline fault verification set, and a pipeline fault test set. Understandably, after data enhancement, in order to ensure that the model can accurately perform fault diagnosis, the enhanced data needs to be accurately labeled. You can choose a suitable labeling tool according to the data type and labeling requirements to ensure the efficiency and accuracy of the labeling process. Commonly used labeling tools such as LabelImg, VGG Image Annotator (VIA), Yolo-mark, etc. can also be customized according to specific needs. The labeling platform developed. Clearly define the labeling specifications, which can include clear labels and judgment criteria for various types of faults such as normal operation, abnormal pressure, and abnormal temperature. After the labeling is completed, save the labeling information in a unified format file, such as CSV, JSON, or XML, for subsequent data processing and model training.
[0054] The saved file should contain the sample ID, original path, annotation label and other information, and ensure the correspondence with the original data set is accurate. The annotated enhanced fault data set is divided into pipeline fault training set, pipeline fault verification set and pipeline fault test set. This step is to evaluate the performance of the model during the model training process and prevent overfitting. The division ratio can be adjusted according to specific needs and data set size. Common ratios are 70% training set, 15% verification set and 15% test set.
[0055] In one embodiment, if Figure 3 and Figure 7 As shown, in the step S20, the pyramid residual convolution network PRCN is constructed to extract multi-level spatial features of the enhanced fault data set, including the following steps S201-S203:
[0056] S201. Use the conv1 convolution layer of the pyramid residual convolution network PRCN to perform preliminary feature extraction on the enhanced fault dataset through a 7x7 large convolution kernel. It is understandable that a large convolution kernel helps to capture broader and more macro features in the early stages of the image, laying the foundation for subsequent fine feature extraction. After the Conv1 convolution layer, a preliminary extracted feature map is obtained.
[0057] S202. Further compress the data dimension through a 3x3 maximum pooling layer with a step size of 2 to reduce the size of the feature map and lower the abstraction level of the initially extracted features, while retaining important feature information, thereby reducing the computational burden of subsequent processing; introduce the ReLU activation function to further compress the data dimension and increase the abstraction level of the features, thereby enhancing the network's ability to learn complex patterns.
[0058] S203. Use the Conv2 convolution layer of the pyramid residual convolution network PRCN. The Conv2 convolution layer is configured in a pyramid shape. The features extracted after preliminary extraction are refined through 1x1 and 3x3 small convolution kernels. The convolution layers are connected by a bottleneck structure. The feature fusion technology is used to add and fuse the feature maps of different levels layer by layer, and the multi-level spatial features of the enhanced fault data set are fully captured from fine granularity to coarse granularity. Understandably, in the Conv2 convolution layer, multiple convolution layers are configured in a pyramid shape, and small convolution kernels of 1x1 and 3x3 are used. These small convolution kernels help to extract more refined features based on the preliminary extracted features. The convolution layers are connected by a bottleneck structure. The bottleneck structure usually includes one or more 1x1 convolution layers, which are used to reduce the dimension of the feature map, thereby reducing the amount of calculation and avoiding overfitting. The feature fusion technology is used to add and fuse the feature maps of different levels in Conv2 layer by layer. In this way, the multi-level spatial features of the enhanced fault data set can be fully captured from fine-grained to coarse-grained, thereby improving the processing capability of complex data and the accuracy of fault diagnosis.
[0059] In this embodiment, when processing complex pipeline monitoring images and various sensor data, the pyramid residual convolutional network PRCN gradually extracts and refines features through a hierarchical method, uses large convolution kernels to capture macro features, and small convolution kernels to perform fine feature extraction, and comprehensively captures multi-level spatial features through feature fusion technology, so that PRCN has powerful feature extraction capabilities and robustness when processing complex pipeline monitoring images and sensor data.
[0060] In another embodiment, if Figure 4 As shown, in the step S20, the three-layer bidirectional long short-term memory network TBiLSTM is constructed to extract the bidirectional time series features of the enhanced fault data set, and the following steps P201-P204 are also included:
[0061] P201, such as Figure 8 and Fig. 9As shown, the first direction LSTM of the three-layer bidirectional long short-term memory network TBiLSTM is used to learn and process the time series in the first direction to obtain the forward information of the time series; the second direction LSTM is used to learn and process the time series in the second direction to obtain the backward information of the time series; the directions of the first direction and the second direction are opposite; understandably, TBiLSTM combines forward and backward LSTM units, and the LSTM units in each direction process data independently, but the final output combines information from both directions. The forward LSTM processes data from left to right to obtain the forward information of the time series; the backward LSTM processes data from right to left to obtain the backward information of the time series. This bidirectional processing mechanism enables TBiLSTM to use past and future information at the same time, improving the ability to predict future and past states.
[0062] P202, the three-layer bidirectional long short-term memory network TBiLSTM stacks three layers of BiLSTM, and the output of each layer is used as the input of the next layer to learn deep time series features; understandably, in order to improve the network's modeling ability for complex time series, TBiLSTM stacks three layers of BiLSTM. Among them:
[0063] The first layer of BiLSTM first receives the pipeline monitoring data that has been preprocessed (such as data cleaning and enhancement) and preliminarily extracts the basic timing features in the time series.
[0064] The second layer of BiLSTM receives the output of the first layer of BiLSTM and further learns deeper and more abstract temporal features. This layer can capture more complex temporal dependencies.
[0065] The third layer of BiLSTM continues to receive the output of the second layer of BiLSTM and performs higher-level feature extraction. Through multi-level feature extraction, TBiLSTM can capture the long-term and short-term dependencies in the data, thereby more accurately reflecting the dynamic changes of the pipeline system.
[0066] P203. Add ReLU activation function after three layers of BiLSTM to improve the ability to recognize nonlinear patterns in time series. Understandably, after each BiLSTM layer, the ReLU activation function is used to perform nonlinear transformation on the output. The ReLU activation function can effectively improve the model's ability to recognize nonlinear patterns in time series, allowing the model to process more complex time series data.
[0067] P204, add Dropout operation to prevent overfitting and obtain bidirectional time series features at different levels. Understandably, in order to prevent the model from overfitting and improve the generalization ability of the model, the Dropout operation is added after each BiLSTM layer. The Dropout operation will randomly discard the output of a part of the neurons, so that the model will not be too dependent on specific input features during the training process, thereby enhancing the robustness of the model.
[0068] In this embodiment, TBiLSTM realizes deep extraction of time series features in pipeline monitoring data by combining bidirectional LSTM units and three-layer stacking structure, as well as ReLU activation function and Dropout operation. It can simultaneously utilize forward and backward information in the data to capture long-term and short-term dependencies, and improves prediction accuracy and generalization ability through nonlinear transformation and strategies to prevent overfitting. In the HA-PFDM method, TBiLSTM, as an important component of spatiotemporal feature extraction, provides strong support for the final fault diagnosis.
[0069] In one embodiment, if Figure 5 As shown, the step S230 includes the following steps S301-S303:
[0070] S301, such as Fig.10 As shown, a time feature extraction module TT is constructed. The time feature extraction module TT is composed of TBiLSTM and a time attention mechanism TAT. The time attention mechanism TAT is used to weight the bidirectional time series features of the enhanced fault data set extracted by TBiLSTM to obtain attention weights, identify and emphasize the key information of the time series features, and enhance the representation ability of the time series features. The calculation expression of the time attention mechanism TAT is:
[0071]
[0072] Where Q represents the query vector matrix, K is the key vector matrix, and d k is the dimension of the key vector, and V is the value vector matrix. First, the dot product of Q and K is calculated, then scaled, and then the result is normalized using the Softmax operation, and finally multiplied by the matrix V to get the attention weight.
[0073] Understandably, TBiLSTM is used to extract bidirectional time series features of the enhanced fault data set, that is, to capture the forward and backward information of the time series at the same time. By capturing the bidirectional information of the time series, the model's understanding of the time series data is improved.
[0074] Subsequently, the temporal attention mechanism TAT is used to weight the timing features extracted by TBiLSTM. Through weighted processing, the key information in the timing features is emphasized, and the sensitivity and response speed of the model to the fault moment are optimized.
[0075] S302, constructing a convolutional block attention module PC, using the convolutional attention mechanism CA to dynamically adjust the feature map output by the convolutional layer of PRCN, and enhancing the representation ability of spatial features through attention weighting in two dimensions: channel and space;
[0076] In one embodiment, the step S302 includes the following steps S3021-S3023:
[0077] S3021, construct a convolutional block attention module PC including PRCN and CBAM modules, such as Fig.12 As shown in the figure, the CBAM module includes a channel attention module CAB and a spatial attention module SAM; understandably, the channel attention module CAB can identify and enhance important channel features to help the model understand which feature channels are critical. The spatial attention module SAM can identify and enhance important spatial position features to help the model locate the specific location where the fault occurs.
[0078] S3022. Use the channel attention module CAB to identify and enhance important channel features, obtain channel attention weights through adaptive pooling and neural network processing, and obtain weighted feature maps: It can be understood that the channel attention module CAB is used for feature enhancement, and channel attention weights are obtained through adaptive pooling and neural network processing, and the original feature map is weighted to highlight the features of important channels.
[0079] S3023. Use the spatial attention module SAM to identify and enhance important spatial position features, and obtain spatial attention weights through adaptive pooling, convolution and Sigmoid activation, and finally weighted feature maps. Understandably, the spatial feature enhancement is performed using the spatial attention module SAM. Through adaptive pooling, convolution and Sigmoid activation, the spatial attention weights are obtained, and the feature maps are weighted to highlight the features of key spatial positions.
[0080] S303, such as Fig.11As shown in the figure, the double-layer TT and double-layer PC are parallelized to form a hierarchical attention network model CBHANet, and the spatiotemporal features extracted by the module TT and the module PC are spliced through the concat operation and input into the multi-layer perceptron MLP. The MLP is composed of a multi-layer fully connected network and is used to comprehensively evaluate the features of time series and spatial analysis; the MLP uses Soffmax or activation function for fault diagnosis and outputs the probability distribution of different fault types. It can be understood that the spatiotemporal features extracted by the TT and PC modules are spliced and effectively fused to provide more comprehensive feature information for subsequent classification, and the spliced features are comprehensively evaluated. The probability distribution of different fault types is output through Softmax or activation function, providing a scientific basis for fault diagnosis.
[0081] In the above implementation, the CBHANet network constructed by the parallel structure of TT and PC ensures that the spatiotemporal features extracted from the TT and PC structures can complement and enhance each other in the fusion process, and are input into the multi-layer perceptron MLP for complex fault diagnosis tasks. Through the comprehensive evaluation of feature fusion and multi-layer perceptron MLP, the model can output fault diagnosis results that accurately reflect the probability distribution of different fault types, providing a scientific basis for subsequent decision-making.
[0082] In one embodiment, the step S40 includes the following steps S401-S402:
[0083] S401, when the pipeline fault training set is used to train the hierarchical attention network model CBHANet, the EIoU Loss loss function is used to quantify the difference between the model prediction and the true boundary, and the optimization of the model parameters is guided by minimizing the difference. The calculation expression of the EIoU Loss loss function is:
[0084]
[0085] Among them, IoU represents the intersection over union ratio, L EIoU represents the expected intersection-over-union loss, L IoU represents the intersection-over-union loss, L dis Represents the distance loss, L asp represents the aspect ratio loss, ρ represents the weight used to adjust the distance loss and aspect ratio loss, b represents the prediction box, b gt represents the real box, w represents the width of the predicted box b, and w gt Represents the true box b gt The width of the prediction box, h represents the height of the prediction box, h gt Represents the true box b gt The height of , c is the scale parameter used to scale the distance loss, c w is a scale parameter used to scale the width loss.
[0086] Understandably, the introduction of the EIoU Loss loss function can more accurately evaluate the difference between the bounding box predicted by the model and the true bounding box. EIoULoss not only considers the loss of the intersection over union (IoU), but also introduces distance loss and aspect ratio loss, making the loss function more comprehensive and detailed. The EIoULoss loss function can better handle errors in the position, size, and shape of the bounding box, thereby improving the accuracy of the model prediction.
[0087] S402, use the validation set to check the model accuracy after each iterative training, set the number of iterative training epochs, and use the gradient descent algorithm to reduce the model loss value during each iterative training, optimize and update the connection weights between layers in the neural network, so as to improve the prediction performance and accuracy of the model. Understandably, by observing indicators such as the loss value and accuracy on the validation set, it can be determined whether the model has begun to converge or whether the training parameters need to be adjusted. In the process of each iterative training, the gradient descent algorithm is used to reduce the model loss value, that is, by calculating the gradient of the loss function with respect to the model parameters, and updating the model parameters in the opposite direction of the gradient. The gradient descent algorithm is used to optimize and update the connection weights between layers in the neural network, so that the model can better fit the training data and generalize to new data.
[0088] In one embodiment, the step S50 includes the following steps S501-S502:
[0089] S501, input the test data set into the trained hierarchical attention network model CBHANet to obtain the pipeline fault identification result;
[0090] S502: Perform multi-dimensional accuracy evaluation on the discrimination result, wherein the multi-dimensional accuracy evaluation includes the following aspects:
[0091] Confusion matrix: It is used to show the relationship between model predictions and actual labels, and intuitively demonstrate the performance of the model on different categories. The confusion matrix can intuitively show the prediction performance of the model on each fault category, including the number of correct identifications, the types of incorrect identifications, and the number of unidentified faults.
[0092] Precision: It is used to measure the ratio of the number of correctly identified fault types to the number of predicted fault types. The higher the precision, the more accurate the model is in identifying this type of fault and the lower the false alarm rate.
[0093] Recall rate: It is used to reflect the ratio of the number of correctly identified fault types to the number of real fault types. The higher the recall rate, the less the model misses this type of fault and the stronger its recognition ability.
[0094] F1-score: It is the harmonic mean of precision and recall, and is used to comprehensively evaluate the recognition performance of the hierarchical attention network model CBHANet. The higher the F1 score, the better the model performs in both precision and recall, and the stronger the overall recognition ability.
[0095] Through the above evaluation indicators, the performance of the hierarchical attention network model CBHANet in pipeline fault identification tasks can be comprehensively and objectively evaluated, providing a strong basis for subsequent applications and improvements.
[0096] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0097] In one embodiment, the present invention provides a pipeline system fault diagnosis system based on a hierarchical attention mechanism, and the pipeline system fault diagnosis system based on a hierarchical attention mechanism corresponds one-to-one to the pipeline system fault diagnosis method based on a hierarchical attention mechanism in the above embodiment. Fig.13 As shown, the pipeline system fault diagnosis system based on the hierarchical attention mechanism includes:
[0098] An acquisition module is used to acquire the original operation data of the pipeline system in real time, preprocess the original operation data to obtain an enhanced fault data set, and divide it into a pipeline fault training set, a pipeline fault verification set, and a pipeline fault test set;
[0099] The feature extraction module is used to build a pyramid residual convolutional network (PRCN) to extract multi-level spatial features of the enhanced fault data set; build a three-layer bidirectional long short-term memory network (TBiLSTM) to extract bidirectional temporal features of the enhanced fault data set;
[0100] Model building module, which is used to build a hierarchical attention network model CBHANet based on the pyramid residual convolutional network PRCN and the three-layer bidirectional long short-term memory network TBiLSTM, and optimize the model through the hierarchical attention mechanism;
[0101] The model training module is used to train the hierarchical attention network model CBHANet using the pipeline fault training set, use the validation set to verify the model accuracy after each iteration of training, use the test set to predict the pipeline fault type, and calculate the model accuracy;
[0102] The fault diagnosis module is used to apply the trained hierarchical attention network model CBHANet to perform pipeline fault diagnosis.
[0103] In the pipeline system fault diagnosis system based on the hierarchical attention mechanism of the above embodiment of the present invention, an enhanced fault data set is constructed by acquiring the original operation data of the pipeline in real time and preprocessing it, so as to ensure the consistency and reliability of data input; the pyramid residual convolution network PRCN and the bidirectional long short-term memory network TBiLSTM are used to extract multi-level spatial features and bidirectional temporal features respectively, so as to enhance the processing capability of complex spatial data and time series data; then, based on the pyramid residual convolution network PRCN and the bidirectional long short-term memory network TBiLSTM, a hierarchical attention network model CBHANet is constructed, so as to realize the extraction of pipeline feature information from two dimensions of time and space, and optimize the model's representation capability of features. CBHANet is an end-to-end network structure, which can not only optimize the computational efficiency, but also significantly improve the accuracy of pipeline fault detection.
[0104] For the specific limitations of pipeline system fault diagnosis based on the hierarchical attention mechanism, please refer to the limitations of the pipeline system fault diagnosis method based on the hierarchical attention mechanism above, which will not be repeated here. Each module in the above-mentioned pipeline system fault diagnosis system based on the hierarchical attention mechanism can be implemented in whole or in part through software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0105] In one embodiment, a controller is provided, comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the pipeline system fault diagnosis method based on the hierarchical attention mechanism when executing the computer-readable instructions. Fig.14 As shown, the controller includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the controller is used to provide computing and control capabilities. The memory includes a readable storage medium and an internal memory. The readable storage medium stores an operating system, computer-readable instructions and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. When the computer-readable instructions are executed by the processor, a suspension height adjustment method is implemented. The readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
[0106] In one embodiment, a computer-readable storage medium is provided, which stores computer-readable instructions. When the computer-readable instructions are executed by a processor, the pipeline system fault diagnosis method based on the hierarchical attention mechanism in the above embodiment is implemented. To avoid repetition, it is not repeated here. The computer-readable storage medium can be non-volatile or volatile.
[0107] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through computer-readable instructions, and the computer-readable instructions can be stored in a non-volatile readable storage medium or a volatile readable storage medium. When the computer-readable instructions are executed, they may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0108] The above is only an embodiment of the pipeline system fault diagnosis method and system based on the hierarchical attention mechanism of the present invention, and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A pipeline system fault diagnosis method based on a hierarchical attention mechanism, characterized in that: include: S10, acquiring original operation data of the pipeline system in real time, preprocessing the original operation data to obtain an enhanced fault data set, and dividing the enhanced fault data set into a pipeline fault training set, a pipeline fault verification set, and a pipeline fault test set; S20. Build a pyramid residual convolutional network PRCN to extract multi-level spatial features of the enhanced fault dataset; Build a three-layer bidirectional long short-term memory network TBiLSTM to extract bidirectional time series features of the enhanced fault data set; S30. Construct a hierarchical attention network model CBHANet based on the pyramid residual convolutional network PRCN and the three-layer bidirectional long short-term memory network TBiLSTM, and optimize the model through the hierarchical attention mechanism; S40, using the pipeline fault training set to train the hierarchical attention network model CBHANet, using the validation set to test the model accuracy after each iteration of training, using the test set to predict the pipeline fault type, and calculating the model accuracy; S50. Use the trained hierarchical attention network model CBHANet to perform pipeline fault diagnosis.
2. The pipeline system fault diagnosis method based on the hierarchical attention mechanism according to claim 1 is characterized in that: The step S10 comprises: S101, using sensors and cameras to collect original operation data of the pipeline system in real time, wherein the original operation data includes pipeline pressure changes, flow fluctuations, temperature fluctuations, and visual images of external structures; S102, using Fourier transform to clean the original operation data, remove noise and outliers, and obtain a fault diagnosis data set; S103, using a data balancer DBE to perform data enhancement on the fault diagnosis data set, adding new fault diagnosis data samples, and obtaining an enhanced fault data set; S104. Use a labeling tool to label the data in the enhanced fault data set, save it in the same format file, and divide it into a pipeline fault training set, a pipeline fault verification set, and a pipeline fault test set.
3. The pipeline system fault diagnosis method based on the hierarchical attention mechanism according to claim 2 is characterized in that: The step S103 includes: S1031, using the encoder of the data balancer DBE to learn the fault diagnosis data set, extract the features of the fault diagnosis data, and calculate the mean μ and standard deviation σ of the fault diagnosis data; S1032. Randomly sample an ε from the standard normal distribution N(0,1), and calculate the latent variable Z according to the mean μ and the standard deviation σ by the formula Z=μ+σ*ε; S1033. Input the latent variable Z to the decoder of the data balancer DBE. The decoder reconstructs a plurality of new fault diagnosis data samples according to the latent variable Z to form an enhanced fault data set.
4. The pipeline system fault diagnosis method based on hierarchical attention mechanism according to claim 1 is characterized in that: In step S20, building a pyramid residual convolutional network PRCN to extract multi-level spatial features of the enhanced fault data set includes the following steps: S201, using the conv1 convolution layer of the pyramid residual convolutional network PRCN, the enhanced fault dataset is initially extracted with a 7x7 large convolution kernel; S202, further compressing the data dimension through a 3x3 maximum pooling layer with a step size of 2 to reduce the size of the feature map and reduce the abstract level of the initially extracted features; introducing a ReLU activation function to further compress the data dimension and improve the abstract level of the features; S203. Use the Conv2 convolution layer of the pyramid residual convolution network PRCN. The Conv2 convolution layer is configured in a pyramid shape. The features after preliminary extraction are refined through 1x1 and 3x3 small convolution kernels. The convolution layers are connected by a bottleneck structure. The feature fusion technology is used to add and fuse the feature maps of different levels layer by layer, and the multi-level spatial features of the enhanced fault data set are fully captured from fine granularity to coarse granularity.
5. The pipeline system fault diagnosis method based on hierarchical attention mechanism according to claim 1 is characterized in that: In step S20, the three-layer bidirectional long short-term memory network TBiLSTM is constructed to extract the bidirectional time series features of the enhanced fault data set, including the following steps: P201, use the first direction LSTM learning of the three-layer bidirectional long short-term memory network TBiLSTM to process the time series in the first direction to obtain the forward information of the time series; use the second direction LSTM learning to process the time series in the second direction to obtain the backward information of the time series; the directions of the first direction and the second direction are opposite; P202, three-layer bidirectional long short-term memory network TBiLSTM stacks three layers of BiLSTM, and the output of each layer is used as the input of the next layer to learn deep temporal features; P203, add ReLU activation function after three layers of BiLSTM to improve the recognition ability of nonlinear patterns in time series; P204. Add Dropout operation to prevent overfitting and obtain bidirectional time series features at different levels.
6. The pipeline system fault diagnosis method based on hierarchical attention mechanism according to claim 1 is characterized in that: The step S30 comprises: S301, construct a time feature extraction module TT, which is composed of TBiLSTM and time attention mechanism TAT. The time attention mechanism TAT is used to weight the bidirectional time series features of the enhanced fault data set extracted by TBiLSTM to obtain attention weights, identify and emphasize the key information of the time series features, and enhance the representation ability of the time series features. The calculation expression of the time attention mechanism TAT is: Where Q represents the query vector matrix, K is the key vector matrix, and d k is the dimension of the key vector and V is the value vector matrix. S302, constructing a convolutional block attention module PC, using the convolutional attention mechanism CA to dynamically adjust the feature map output by the convolutional layer of PRCN, and enhancing the representation ability of spatial features through attention weighting in two dimensions: channel and space; S303, the double-layer TT and the double-layer PC are parallelized to form a hierarchical attention network model CBHANet, and the spatiotemporal features extracted by the module TT and the module PC are spliced through the concat operation and input into the multi-layer perceptron MLP. The MLP is composed of a multi-layer fully connected network and is used to comprehensively evaluate the features of time series and spatial analysis; the MLP uses Softmax or activation function for fault diagnosis and outputs the probability distribution of different fault types.
7. The pipeline system fault diagnosis method based on hierarchical attention mechanism according to claim 6 is characterized in that: The step S302 further includes the following steps: S3021, construct a convolutional block attention module PC including PRCN and CBAM modules, the CBAM module includes a channel attention module CAB and a spatial attention module SAM; S3022. Use the channel attention module CAB to identify and enhance important channel features, obtain channel attention weights through adaptive pooling and neural network processing, and obtain a weighted feature map: S3023. Use the spatial attention module SAM to identify and enhance important spatial position features, and obtain the spatial attention weights through adaptive pooling, convolution and Sigmoid activation, and finally the weighted feature map.
8. The pipeline system fault diagnosis method based on hierarchical attention mechanism according to claim 1 is characterized in that: The step S40 comprises: S401, when the pipeline fault training set is used to train the hierarchical attention network model CBHANet, the EIoULoss loss function is used to quantify the difference between the model prediction and the true boundary, and the optimization of the model parameters is guided by minimizing the difference. The calculation expression of the EIoU Loss loss function is: Among them, IoU represents the intersection over union ratio, L EIoU represents the expected intersection-over-union loss, L IoU represents the intersection-over-union loss, L dis Represents the distance loss, L asp represents the aspect ratio loss, ρ represents the weight used to adjust the distance loss and aspect ratio loss, b represents the prediction box, b gt represents the real box, w represents the width of the predicted box b, and w gt Represents the true box b gt The width of the prediction box, h represents the height of the prediction box, h gt Represents the true box b gt The height of , c is the scale parameter used to scale the distance loss, c w is a scale parameter used to scale the width loss. S402. Use the validation set to test the model accuracy after each iterative training, set the number of iterative training epochs, and use the gradient descent algorithm to reduce the model loss value during each iterative training process, optimize and update the connection weights between layers in the neural network, so as to improve the prediction performance and accuracy of the model.
9. The pipeline system fault diagnosis method based on hierarchical attention mechanism according to claim 1 is characterized in that: The step S50 comprises: S501, input the test data set into the trained hierarchical attention network model CBHANet to obtain the pipeline fault identification result; S502: Perform multi-dimensional accuracy evaluation on the discrimination result, wherein the multi-dimensional accuracy evaluation includes the following aspects: Confusion matrix: used to show the relationship between model predictions and actual labels, and intuitively demonstrate the performance of the model on different categories; Precision: used to measure the ratio of the number of correctly identified fault types to the number of predicted fault types; Recall rate: used to reflect the ratio of the number of correctly identified fault types to the number of real fault types; F1-score: It is the harmonic mean of precision and recall, and is used to comprehensively evaluate the recognition performance of the hierarchical attention network model CBHANet.
10. A pipeline system fault diagnosis system based on a hierarchical attention mechanism, characterized in that: include: An acquisition module is used to acquire the original operation data of the pipeline system in real time, preprocess the original operation data to obtain an enhanced fault data set, and divide it into a pipeline fault training set, a pipeline fault verification set, and a pipeline fault test set; Feature extraction module, used to build a pyramid residual convolutional network (PRCN) to extract multi-level spatial features of enhanced fault data sets; Build a three-layer bidirectional long short-term memory network TBiLSTM to extract bidirectional time series features of the enhanced fault data set; Model building module, which is used to build a hierarchical attention network model CBHANet based on the pyramid residual convolutional network PRCN and the three-layer bidirectional long short-term memory network TBiLSTM, and optimize the model through the hierarchical attention mechanism; The model training module is used to train the hierarchical attention network model CBHANet using the pipeline fault training set, use the validation set to verify the model accuracy after each iteration of training, use the test set to predict the pipeline fault type, and calculate the model accuracy; The fault diagnosis module is used to apply the trained hierarchical attention network model CBHANet to perform pipeline fault diagnosis.
Citation Information
Patent Citations
Bidirectional LSTM micro-expression depression recognition method based on feature pyramid network
CN110472564A
Pipeline detection system and method based on deep learning and unmanned aerial vehicle
CN111339893A
Pipeline defect detection method based on multi-scale features of convolutional neural network
CN113052834A
Fault diagnosis method and system for electromechanical equipment
CN116340750A
Bearing fault diagnosis method based on wavelet transform and depth residual attention mechanism
CN116718377A
Cited By
Method and system for estimating SOC (State of Charge) of full-life-cycle lithium ion battery, terminal and medium
CN119471398A
Low-voltage switch cabinet fault diagnosis method and system
CN119720048A
Modeling method based on double attention mechanisms
CN119720785A
Fault monitoring method and device for breathing heating pipeline
CN119770817A
A fault monitoring method and device for a respiratory warming tube
CN119770817B
