Method for predicting leakage risk of hot steam conveying pipeline in building
Through machine learning and deep learning technology, the leakage risk prediction model of hot steam conveying pipelines is constructed, which solves the problems of low efficiency and high cost of traditional detection methods, realizes real-time monitoring and prediction of leakage risks, and improves the safety of pipeline systems and operational efficiency.
Patent Information
- Application Number
- CN202411810788.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-02-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The traditional thermal steam conveying pipeline leakage detection method is inefficient and costly, and may affect normal production, making it difficult to effectively predict and prevent leakage events.
Through machine learning and deep learning technology, a prediction model for leakage risk of thermal steam conveying pipelines is built, the operating status of pipelines is monitored in real time, potential risk factors are identified, and data processing and analysis are carried out through intelligent algorithms to generate prediction results.
Real-time monitoring and prediction of leakage risks in thermal steam conveying pipelines is achieved, the sustainability of thermal energy transmission is ensured, the safety of pipeline systems is improved, and energy waste and equipment damage caused by leakage is prevented.
Smart Images

Figure CN119397452A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of leakage risk prediction, and in particular relates to a method for predicting leakage risk of a hot steam transmission pipeline in a building. Background Art
[0002] Hot steam transmission pipelines are an indispensable part of heating, hot water supply and industrial production in modern buildings. Their main function is to transmit hot steam from boilers or heat sources to areas that need heating through pipelines. However, during long-term operation, due to various factors such as corrosion, aging and mechanical damage, pipelines may leak, resulting in energy waste, equipment damage, and even endangering personal safety. Corrosion is caused by the long-term exposure of pipelines to high-temperature and high-pressure steam environments, and the internal and external corrosion of chemicals. Aging is the gradual loss of mechanical properties of pipeline materials under high temperature and high pressure environments, resulting in thinning of the pipe wall and increased cracks. Mechanical damage may occur during construction, maintenance or external forces, resulting in tiny cracks or deformations, which may gradually expand during long-term operation and eventually lead to leakage. In addition, design defects can also cause stress concentration in certain parts of the pipeline, increasing the risk of leakage. Traditional leakage detection methods include manual inspections and pressure tests, but these methods are inefficient, costly, and may affect normal production. Therefore, it is particularly important to establish an effective method for predicting the risk of leakage in hot steam transmission pipelines. Summary of the invention
[0003] The main purpose of the present invention is to provide a method for predicting the risk of leakage of hot steam transmission pipelines in buildings, which aims to predict possible leakage events in advance by comprehensively analyzing equipment operation data and environmental parameters through machine learning and deep learning technology. The method can monitor the operating status of the pipeline in real time, identify potential risk factors, and perform data processing and analysis through intelligent algorithms to generate prediction results. In this way, the continuity of heat energy transmission can be guaranteed, the safety of the pipeline system can be improved, and energy waste and equipment damage caused by leakage can be prevented.
[0004] To achieve the above object, the technical solution of the present invention is: a method for predicting the risk of leakage of hot steam transmission pipelines in buildings, the method comprising: S1. Collect hot steam transmission pipeline data, including normal data and data during leakage. The data types include: real-time monitoring of temperature, pressure, and flow data when the pipeline is running inside, real-time monitoring of temperature and humidity when the pipeline is running outside, physical data of the pipeline: pipe material, thickness, length, interface type, historical leakage event data: leakage time, location, cause, and repair measures data, and divide the data set into training set, validation set, and test set; S2. Process the hot steam pipeline data, including missing value and outlier detection and normalization, to ensure high data quality and consistency; S3, construct a bidirectional recurrent unit module BLUM, which can capture the forward and backward information of sequence data at the same time; S4. Construct a multi-level bidirectional recurrent unit module Multi-BLUM, where the input of each layer is the output of the previous layer to capture more complex temporal features; S5. Construct a sparse attention module SAM to further extract long dependencies and important features in the input features and reduce the computational complexity through the sparse method. S6. Construct a hot steam transmission pipeline leakage risk prediction model, which consists of an input layer, a bidirectional recurrent unit module, a multi-level bidirectional recurrent unit module, a sparse attention module, and an output; S7. Train the hot steam transmission pipeline leakage risk prediction model. During the training process, the model continuously adjusts its weights to gradually improve its accuracy and robustness. S8. Use the hot steam transmission pipeline leakage risk prediction model to make real-time predictions, deploy the trained hot steam transmission pipeline leakage risk prediction model, and use the test set for testing.
[0005] Furthermore, in step S3, for the bidirectional recurrent unit module BLUM, the module is implemented by a gated recurrent unit GRU, and the GRU controls the flow of information by introducing a reset valve and an update valve. The following is an explanation of the unidirectional GRU; Reset the valve to the input x of the current time step t and the hidden state h of the previous time step t-1 , splice and calculate, the formula is as follows: r t =σ(W r ·[h t-1 , x t ]); Where W r is the weight matrix calculated for resetting the valve, σ is the sigmoid activation function; By calculating r t The value of the potential hidden state is then calculated The value is calculated as follows: Where W t The weight matrix calculated for the latent hidden state, r t is the output of resetting the valve, ⊙ is the element-wise multiplication operation; The calculation formula for updating the valve is as follows: z t=σ(W z ·[h t-1 , x t ]); Where W z The weight matrix calculated for updating the valve; Subsequently, by updating the valve output Z t The output with the latent hidden state Calculate the current hidden state h t , the calculation formula is as follows: In the formula, z t To update the valve output, is the output of the potential hidden state; Finally, the output h t is the output result of unidirectional GRU.
[0006] Furthermore, in step S3, the bidirectional recurrent unit module BLUM is composed of two independent GRUs, one of which processes the sequence data from front to back, called the forward GRU, and the other processes from back to front, called the backward GRU, and the final output is the connection of the outputs of the two GRUs; The forward GRU formula is as follows: In the formula, is the output of the previous time step t-1 of the forward GRU, x t is the input of the current time step, GRU is a one-way GRU operation, is the output of the forward GRU at time step t; The backward GRU formula is as follows: In the formula, is the output of the previous time step t+1 of the backward GRU, x t is the input of the current time step, GRU is a one-way GRU operation, is the output of the backward GRU at time step t; Finally, the forward GRU and the backward GRU are concatenated to form the output of the bidirectional GRU. The operation is as follows: In the formula, To connect the outputs of the forward and backward GRUs.
[0007] Furthermore, in step S4, for the multi-level bidirectional recurrent unit module Multi-BLUM, two bidirectional recurrent unit layers are added on the basis of the bidirectional recurrent unit module, the first layer is a primary recurrent unit, the second layer is a secondary recurrent unit, and the input of each layer is the output of the previous layer, so as to capture more complex temporal features; The output of each layer of recurrent unit is concatenated from the output of the forward GRU and the backward GRU. The output formula of the primary recurrent unit is as follows: In the formula, is the output of the first layer bidirectional recurrent unit at time step t-1, GRU 1 This is the calculation process of the first layer of GRU network; The output formula of the secondary recurrent unit is as follows: In the formula, is the output of the first layer bidirectional recurrent unit at time step t, is the output of the second-layer bidirectional recurrent unit at time step t-1, is the output result of the final multi-level bidirectional recurrent unit module, GRU 2 This is the calculation process of the second layer GRU network.
[0008] Furthermore, in step S4, the bidirectional recurrent unit module BLUM has significant advantages in time series data processing and reinforcement learning decision-making, including capturing long-term and short-term dependencies, bidirectional information processing, multi-layer structure, gating mechanism and efficient training performance. This module can extract and utilize rich information in time series data to improve the prediction and decision-making capabilities of the model.
[0009] Furthermore, in step S5, the sparse attention module SAM further extracts long dependencies and important features in the input features, and reduces the computational complexity through the sparse method; after processing in step S4, the feature representation of the time series data is obtained: In the formula, each is the feature representation at time step t; the feature H is mapped to the query Q, key K and value matrix V, and the mapping formula is as follows: Q=HW Q ; K=HW K ; V=HW V ; Where H is the feature representation of time series data obtained by the multi-level bidirectional recurrent unit module, and W Q , W K , W Vare weight matrices for query, key, and value, respectively. The query Q, key K, and value matrix V of the entire sequence are expressed as: Q={Q1,Q2,...,Q T}; K={K1,K2,......,K T}; V={V1,V2,......,V T}; Then, sparse metric calculation is performed to calculate each query Q i and all keys K j The dot product of , the calculation formula of the sparse metric is as follows: Where T is the length of the sequence; calculate each query Q i and all keys K j The dot product of , and select the top u keys with the highest correlation to obtain the sparse key matrix K spa and the corresponding value matrix V spa , is the scaling constant; Attention calculation is performed on the selected sparse key. The formula is as follows: Where SAM is the attention calculation for sparse keys; Finally, multiple heads independently perform the above operations in step S5 and connect the outputs, which is finally expressed as: Multi_SAM(Q,K,V)=Concat(SAM1,SAM2,...,SAM n ); In the formula, SAM p It is the result of attention calculation on the sparse key of the p-th head, and Concat is the concatenation operation.
[0010] Furthermore, in step S5, the sparse attention module SAM reduces computational complexity through sparse selection, improves feature extraction capability through parallel computing, captures long-distance dependencies, and has the advantages of flexibility and efficient training, and performs well in processing time series data.
[0011] Compared with the prior art, the present invention has the following technical effects: The technical solution provided by the present invention aims to solve the problem of leakage risk prediction of hot steam transmission pipelines in buildings. The technical solution captures forward and backward information of sequence data through a bidirectional recurrent unit module. At the same time, multiple layers of bidirectional recurrent unit modules constitute a multi-level bidirectional recurrent unit module, which can capture more complex temporal features. Finally, a sparse attention module is used to further extract long dependencies and important features in the input features. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 The present invention is a flowchart of the steps of a method for predicting the risk of leakage of hot steam transmission pipelines in buildings.
[0013] Figure 2 This is a GRU structure diagram of a bidirectional circulation unit module in a method for predicting the risk of leakage of hot steam transmission pipelines in buildings.
[0014] Figure 3 This is a multi-stage bidirectional circulation unit module structure diagram of a method for predicting the risk of leakage of hot steam transmission pipelines in buildings.
[0015] Figure 4 This is a structural diagram of the sparse attention module of a method for predicting the risk of leakage of hot steam transmission pipelines in buildings.
[0016] Figure 5 The real-time prediction diagram of a method for predicting the risk of leakage of hot steam transmission pipelines in buildings. DETAILED DESCRIPTION
[0017] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0018] See also Figure 1-Figure 5 The present invention provides a technical solution: a method for predicting the risk of leakage of hot steam transmission pipelines in buildings. The method captures the forward and backward information of sequence data through a bidirectional recurrent unit module. At the same time, multiple layers of bidirectional recurrent unit modules constitute a multi-level bidirectional recurrent unit module, which can capture more complex temporal features. Finally, a sparse attention module is used to further extract long dependencies and important features in the input features.
[0019] Please refer to Figure 1As shown, a method for predicting the risk of leakage of a hot steam transmission pipeline in a building in an embodiment of the present application: S1. Collecting hot steam transmission pipeline data, including normal data and data during leakage, the data types include: real-time monitoring of temperature, pressure, and flow data when the pipeline is running inside, real-time monitoring of temperature and humidity when the pipeline is running outside, physical data of the pipeline: pipe material, thickness, length, interface type, historical leakage event data: leakage time, location, cause, and repair measures data, and dividing the data set into a training set, a validation set, and a test set.
[0020] S2. Process the hot steam transmission pipeline data, including missing value, outlier detection and normalization processing, to ensure the high quality and consistency of the data.
[0021] Furthermore, in step S2, the data set is firstly tested for missing values and outliers to identify problematic data. Since a large amount of data is collected, the present invention deletes the problematic data to improve the overall quality of the data. Then, the data set is normalized to map the original data values to a range of 0 to 1. The normalization formula is as follows: Where, X i is the value to be normalized, X min is the minimum value among the normalized attributes, X max is the maximum value among the normalized attributes;
[0022] S3. Construct a bidirectional recurrent unit module BLUM, which can capture the forward and backward information of sequence data at the same time.
[0023] Furthermore, in step S3, for the bidirectional recurrent unit module BLUM, the module is implemented by a gated recurrent unit GRU, and the GRU controls the flow of information by introducing a reset valve and an update valve, such as Figure 2 As shown, the unidirectional GRU is explained below; Reset the valve to the input x of the current time step t and the hidden state h of the previous time step t-1 , splice and calculate, the formula is as follows: rt=σ(W r ·[h t-1 , x t ]); Where W r is the weight matrix calculated for resetting the valve, σ is the sigmoid activation function, x t is the input of the current time step, h t-1 is the hidden state of the previous time step; By calculating rt The value of the potential hidden state is then calculated The value is calculated as follows: Where W t The weight matrix calculated for the latent hidden state, r t is the output of the reset valve, ⊙ is the element-wise multiplication operation, x t is the input of the current time step, h t-1 is the hidden state of the previous time step; The calculation formula for updating the valve is as follows: z t =σ(W z ·[h t-1 , x t ]); Where W z The weight matrix for updating valve calculation, x t is the input of the current time step, h t-1 is the hidden state of the previous time step, σ is the sigmoid activation function; Then, by updating the valve output z t The output with the latent hidden state Calculate the current hidden state h t , the calculation formula is as follows: In the formula, z t To update the valve output, is the output of the potential hidden state, ⊙ is the element-wise multiplication operation; Finally, the output h t is the output result of unidirectional GRU.
[0024] Furthermore, in step S3, the bidirectional recurrent unit module BLUM is composed of two independent GRUs, and the number of hidden layer units of each GRU is set to 64. One processes the sequence data from front to back, called the forward GRU, and the other processes from back to front, called the backward GRU. The final output is the connection of the outputs of the two GRUs. The forward GRU formula is as follows: In the formula, is the output of the previous time step t-1 of the forward GRU, x t is the input of the current time step, GRU is a one-way GRU operation, is the output of the forward GRU at time step t; The backward GRU formula is as follows: In the formula, is the output of the previous time step t+1 of the backward GRU, x t is the input of the current time step, GRU is a one-way GRU operation, is the output of the backward GRU at time step t; Finally, the forward GRU and the backward GRU are concatenated to form the output of the bidirectional GRU. The operation is as follows: In the formula, To connect the outputs of the forward and backward GRUs.
[0025] S4. Construct a multi-level bidirectional recurrent unit module Multi-BLUM, where the input of each layer is the output of the previous layer to capture more complex timing features.
[0026] Furthermore, in step S4, for the multi-level bidirectional recurrent unit module Multi-BLUM, two bidirectional recurrent unit layers are added on the basis of the bidirectional recurrent unit module, such as Figure 3 As shown, the first layer is a primary recurrent unit, the second layer is a secondary recurrent unit, and the input of each layer is the output of the previous layer to capture more complex temporal features; The output of each layer of recurrent unit is concatenated from the output of the forward GRU and the backward GRU. The output formula of the primary recurrent unit is as follows: In the formula, is the output of the first layer bidirectional recurrent unit at time step t-1; The output formula of the secondary recurrent unit is as follows: In the formula, is the output of the first layer bidirectional recurrent unit at time step t, is the output of the second-layer bidirectional recurrent unit at time step t-1, It is the output result of the final multi-level bidirectional cyclic unit module.
[0027] S5. Construct a sparse attention module SAM to further extract long dependencies and important features in the input features and reduce the computational complexity through sparsification methods.
[0028] Furthermore, in step S5, the sparse attention module SAM further extracts long dependencies and important features in the input features, and reduces the computational complexity by using a sparse method, such as Figure 4 As shown; after the processing of step S4, the characteristic representation of the time series data is obtained: In the formula, each is the feature representation at time step t; the feature H is mapped to the query Q, key K and value matrix V, and the mapping formula is as follows: Q=HW Q ; K=HW K ; V=HW V ; Where H is the feature representation of time series data obtained by the multi-level bidirectional recurrent unit module, and W Q , W K , W V are weight matrices for query, key, and value, respectively. The query Q, key K, and value matrix V of the entire sequence are expressed as: Q={Q1,Q2,...,Q T}; K={K1,K2,......,K T}; V={V1,V2,......,V T}; Then, sparse metric calculation is performed to calculate each query Q i and all keys K j The dot product of , the calculation formula of the sparse metric is as follows: Where T is the length of the sequence; calculate each query Q i and all keys K j The dot product of , and select the first two keys with the highest correlation to obtain the sparse key matrix K spa and the corresponding value matrix V spa ; Attention calculation is performed on the selected sparse key. The formula is as follows: Finally, the eight heads independently perform the above operations in step S5 and connect the outputs, which is finally expressed as: Multi_SAM(Q,K,V)=Concat(SAM1,SAM2,...,SAM8); Where SAM1 is the result of attention calculation on the sparse key of the first head, and Concat is the concatenation operation.
[0029] S6. Construct a hot steam transmission pipeline leakage risk prediction model, which consists of an input layer, a bidirectional recurrent unit module, a multi-level bidirectional recurrent unit module, a sparse attention module and an output.
[0030] Furthermore, in step S6, the input layer is the data after the data set is normalized, the bidirectional recurrent unit module captures the forward and backward information of the sequence data through the GRU technology, and the multi-layer bidirectional recurrent unit modules constitute a multi-level bidirectional recurrent unit module, which can capture more complex timing features. Subsequently, the sparse attention module is used to further extract the long dependencies and important features in the input features, and finally a layer of MLP layer is passed to output the final prediction result, and the output result is y.
[0031] S7. Train the hot steam transmission pipeline leakage risk prediction model. During the training process, the model continuously adjusts its weights to gradually improve its accuracy and robustness.
[0032] Furthermore, in step S7, a hot steam transmission pipeline leakage risk prediction model is trained, wherein the loss function is defined as follows: In the formula, N is the total number of samples, y is the true label, is the predicted value of the model; the loss function L measures the performance of the model by calculating the error between the predicted value and the true value. Specifically, the loss function L measures the logarithmic loss between the model's predicted probability and the actual label. When the predicted value is closer to the true value, the smaller the loss value; otherwise, the larger the loss value.
[0033] Furthermore, in step S7, the number of experimental iterations Epoch is set to 1000 times, and the optimizer uses Adam. After repeated experiments, it is finally determined that the learning rate parameter lr is set to 1e-4 and the batch size batch_size is set to 4096.
[0034] S8. Use the hot steam transmission pipeline leakage risk prediction model to make real-time predictions, deploy the trained hot steam transmission pipeline leakage risk prediction model, and use the test set for testing.
[0035] Furthermore, in step S8, the trained hot steam pipeline leakage risk prediction model is used for real-time prediction. The present invention selects a test set that will leak at 60 minutes. Figure 5 As shown, the figure is a model prediction state diagram within 60 minutes. The present invention determines that there is a leakage risk in the hot steam transmission pipeline when the output of the prediction model is greater than 0.8. It can be seen from the figure that the prediction model can accurately predict that there will be a leakage risk.
[0036] The above are only preferred embodiments of the present invention. It should be pointed out that a person skilled in the art can make several modifications and improvements without departing from the inventive concept of the present invention, and these all fall within the protection scope of the present invention.
Claims
1. A method for predicting the risk of leakage of hot steam transmission pipelines in buildings, characterized in that: The following steps are involved: S1. Collect hot steam transmission pipeline data, including normal data and data during leakage. The data types include: real-time monitoring of temperature, pressure, and flow data when the pipeline is running inside, real-time monitoring of temperature and humidity when the pipeline is running outside, physical data of the pipeline: pipe material, thickness, length, interface type, historical leakage event data: leakage time, location, cause, and repair measures data, and divide the data set into training set, validation set, and test set; S2. Process the hot steam pipeline data, including missing value and outlier detection and normalization, to ensure high data quality and consistency; S3, construct a bidirectional recurrent unit module BLUM, which can capture the forward and backward information of sequence data at the same time; S4. Construct a multi-level bidirectional recurrent unit module Multi-BLUM, where the input of each layer is the output of the previous layer to capture more complex temporal features; S5. Construct a sparse attention module SAM to further extract long dependencies and important features in the input features and reduce the computational complexity through the sparse method. S6. Construct a hot steam transmission pipeline leakage risk prediction model, which consists of an input layer, a bidirectional recurrent unit module, a multi-level bidirectional recurrent unit module, a sparse attention module, and an output; S7. Train the hot steam transmission pipeline leakage risk prediction model. During the training process, the model continuously adjusts its weights to gradually improve its accuracy and robustness. S8. Use the hot steam transmission pipeline leakage risk prediction model to make real-time predictions, deploy the trained hot steam transmission pipeline leakage risk prediction model, and use the test set for testing.
2. A method for predicting the risk of leakage of a hot steam transmission pipeline in a building according to claim 1, characterized in that: In step S3, for the bidirectional recurrent unit module BLUM, the module is implemented by a gated recurrent unit GRU. GRU controls the flow of information by introducing a reset valve and an update valve. The implementation process of the unidirectional GRU is as follows: Reset the valve to the input x of the current time step t and the hidden state h of the previous time step t-1 , splice and calculate, the formula is as follows: r t =σ(W r ·[h t-1 ,x t ]); Where W r is the weight matrix calculated for resetting the valve, σ is the sigmoid activation function; By calculating r t The value of the potential hidden state is then calculated The value is calculated as follows: Where W t The weight matrix calculated for the latent hidden state, r t is the output of resetting the valve, ⊙ is the element-wise multiplication operation; The calculation formula for updating the valve is as follows: z t =σ(W z ·[h t-1 ,x t ]); Where W z The weight matrix calculated for updating the valve; Then, by updating the valve output z t The output with the latent hidden state Calculate the current hidden state h t , the calculation formula is as follows: In the formula, z t To update the valve output, is the output of the potential hidden state; Finally, the output h t is the output result of unidirectional GRU.
3. A method for predicting the risk of leakage of a hot steam transmission pipeline in a building according to claim 2, characterized in that: In step S3, the bidirectional recurrent unit module BLUM is composed of two independent GRUs, one processes the sequence data from front to back, called the forward GRU, and the other processes from back to front, called the backward GRU. The final output is the concatenation of the outputs of the two GRUs. The forward GRU formula is as follows: In the formula, is the output of the previous time step t-1 of the forward GRU, x t is the input of the current time step, GRU is a one-way GRU operation, is the output of the forward GRU at time step t; The backward GRU formula is as follows: In the formula, is the output of the previous time step t+1 of the backward GRU, x t is the input of the current time step, GRU is a one-way GRU operation, is the output of the backward GRU at time step t; Finally, the forward GRU and the backward GRU are concatenated to form the output of the bidirectional GRU. The operation is as follows: In the formula, To connect the outputs of the forward and backward GRUs.
4. A method for predicting the risk of leakage of a hot steam transmission pipeline in a building according to claim 3, characterized in that: In step S4, for the multi-level bidirectional recurrent unit module Multi-BLUM, two bidirectional recurrent unit layers are added on the basis of the bidirectional recurrent unit module, the first layer is a primary recurrent unit, the second layer is a secondary recurrent unit, and the input of each layer is the output of the previous layer, so as to capture more complex temporal features; The output of each layer of recurrent unit is concatenated from the output of the forward GRU and the backward GRU. The output formula of the primary recurrent unit is as follows: In the formula, is the output of the first layer bidirectional recurrent unit at time step t-1, GRU 1 This is the calculation process of the first layer of GRU network; The output formula of the secondary recurrent unit is as follows: In the formula, is the output of the first layer bidirectional recurrent unit at time step t, is the output of the second-layer bidirectional recurrent unit at time step t-1, is the output result of the final multi-level bidirectional recurrent unit module, GRU 2 This is the calculation process of the second layer GRU network.
5. A method for predicting the risk of leakage of a hot steam transmission pipeline in a building according to claim 4, characterized in that: In step S5, the sparse attention module SAM further extracts long dependencies and important features in the input features, and reduces the computational complexity through the sparse method; after the processing of step S4, the feature representation of the time series data is obtained: In the formula, each is the feature representation at time step t; Map feature H to query Q, key K and value matrix V. The mapping formula is as follows: Q=HW Q ; K=HW K ; V=HW V ; Where H is the feature representation of time series data obtained by the multi-level bidirectional recurrent unit module, and W Q , W K , W V are weight matrices for query, key, and value, respectively. The query Q, key K, and value matrix V of the entire sequence are expressed as: Q={Q1,Q2,……,Q T }; K={K1,K2,……,K T }; V={V1,V2,......,V T }; Then, sparse metric calculation is performed to calculate each query Q i and all keys K j The dot product of , the calculation formula of the sparse metric is as follows: Where T is the length of the sequence; calculate each query Q i and all keys K j The dot product of , and select the first two keys with the highest correlation to obtain the sparse key matrix K spa and the corresponding value matrix V spa , is the scaling constant; Attention calculation is performed on the selected sparse key. The formula is as follows: Where SAM is the attention calculation for sparse keys; Finally, multiple heads independently perform the above operations in step S5 and connect the outputs, which is finally expressed as: Multi_SAM(Q,K,V)=COncat(SAM1,SAM2,......,SAM n ); Where SAM1 is the result of attention calculation on the sparse key of the first head, and Concat is the concatenation operation.
6. A method for predicting the risk of leakage of a hot steam transmission pipeline in a building according to claim 5, characterized in that: In step S7, a hot steam transmission pipeline leakage risk prediction model is trained, wherein the loss function is defined as follows: In the formula, N is the total number of samples, y is the true label, is the predicted value of the model; the loss function L measures the performance of the model by calculating the error between the predicted value and the true value. Specifically, the loss function L measures the logarithmic loss between the model's predicted probability and the actual label. When the predicted value is closer to the true value, the smaller the loss value; otherwise, the larger the loss value.