A rainwater pipe overflow prediction method, electronic device and storage medium

By using technical means such as recurrent neural networks and deep learning interpolation methods in the overflow prediction of stormwater pipelines, the problems of large data demand, high calculation cost and poor timeliness in the existing technology are solved, and efficient and accurate stormwater pipelines are achieved. Overflow forecast.

CN118917354BActive Publication Date: 2025-02-25HARBIN AEROSPACE STAR DATA SYST TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411056665.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2025-02-25
Estimated Expiration
2044-08-02

AI Technical Summary

Technical Problem

The prior art has problems such as large data demand, high calculation cost, poor timeliness and low prediction accuracy in the forecasting of stormwater pipeline overflow.

Method used

Recurrent neural network (LSTM) is used to combine deep learning interpolation method and Kalman filtering method for data preprocessing, and genetic algorithms are used to optimize model parameters to build a stormwater pipeline overflow prediction model.

Benefits of technology

It improves the efficiency and accuracy of overflow prediction of stormwater pipelines, can respond to emergency prediction scenarios in a timely manner, and enhances model training effect and data quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118917354B_ABST
    Figure CN118917354B_ABST
Patent Text Reader

Abstract

A method, electronic device and storage medium for predicting rainwater pipe overflow, belonging to the field of water monitoring technology. In order to accurately predict the overflow of rainwater pipes, the present invention includes collecting rainwater pipe overflow data, including flow, liquid level, rainfall, pipe diameter and slope, and then forming a rainwater pipe time series data set; performing data preprocessing on the data, including missing value processing, outlier processing, noise processing and standardization processing, to obtain a data set for rainwater pipe overflow prediction; constructing a rainwater pipe overflow prediction model; using the data set for rainwater pipe overflow prediction, combined with a genetic algorithm, to train the constructed rainwater pipe overflow prediction model, to obtain a trained rainwater pipe overflow prediction model; using the trained rainwater pipe overflow prediction model to predict rainwater pipe overflow events. The present invention improves the model training effect, thereby increasing the prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of water monitoring, and in particular relates to a rainwater pipe overflow prediction method, electronic equipment and storage medium. Background Art

[0002] As the urbanization process accelerates, the construction and development of urban drainage systems are also advancing. In the past period of time, the length of urban drainage pipes has continued to increase, and the length of rainwater pipes has also shown an upward trend. Rainwater pipes can effectively collect rainwater generated on buildings such as roofs, platforms, and roads, avoid excessive accumulation of rainwater, and reduce the risk of floods. Rainwater pipes discharge rainwater accumulated on the ground to sewers, rivers or other suitable outlets to avoid rainwater retention and scouring, ensuring the normal operation of the city and the normal life of residents. An effective and healthy rainwater pipe system can reduce the risk of urban waterlogging and protect the lives and property of residents.

[0003] In summary, ensuring the normal use of rainwater pipes is to ensure the safety of people's lives and property. However, unexpected situations always occur in reality, such as pipe overflow. Once the pipe overflows on rainy days, especially on heavy rainy days, it may cause waterlogging and disrupt the normal operation of the city. Therefore, an effective means to timely judge the occurrence of overflow events is crucial. However, in China and even in the world, the overflow monitoring methods for urban rainwater pipe network operation are very limited. The occurrence and solution of rainwater pipe network overflow often rely mainly on personnel inspection, detection of the overflowing places of the rainwater pipe network, and then taking measures.

[0004] The currently proposed methods of simulating urban rainwater pipe networks through the SWMM water service model and predicting overflow events through mathematical modeling still have many limitations. For the SWMM model method, this method requires a large amount of data for each simulation, and the actual existing data often cannot meet the specific requirements of the SWMM model, which greatly reduces the modeling efficiency and prediction accuracy. For the mathematical modeling method, this method requires a lot of calculations, has a high time cost, and the accuracy is highly correlated with the calculation method. Both methods require a lot of labor costs and have poor timeliness. They often cannot give warnings in time, leaving insufficient time for the arrangement of preventive measures. Summary of the invention

[0005] The problem to be solved by the present invention is to accurately predict the overflow of a rainwater pipe, and a rainwater pipe overflow prediction method, electronic equipment and storage medium are proposed.

[0006] To achieve the above object, the present invention is implemented through the following technical solutions:

[0007] A method for predicting overflow of a rainwater pipe comprises the following steps:

[0008] S1. Collect the overflow data of rainwater pipes, including flow, liquid level, rainfall, pipe diameter and slope, and then form a time series data set of rainwater pipes;

[0009] S2. Perform data preprocessing on the data in the rainwater pipe time series data set obtained in step S1, including missing value processing, outlier processing, noise processing and standardization processing, to obtain a data set for rainwater pipe overflow prediction, for standby use;

[0010] S3. Construct a stormwater pipe overflow prediction model;

[0011] S4. Using the data set for rainwater pipe overflow prediction obtained in step S2, combined with a genetic algorithm, the rainwater pipe overflow prediction model constructed in step S3 is trained to obtain a trained rainwater pipe overflow prediction model;

[0012] S5. Use the stormwater pipe overflow prediction model trained in step S4 to predict stormwater pipe overflow events.

[0013] Furthermore, the specific implementation method of step S2 includes the following steps:

[0014] S2.1. Use the deep learning interpolation method BRITS to fill the missing values ​​of flow, liquid level and rainfall for the stormwater pipe overflow data collected in step S1;

[0015] S2.2. Use the Kalman filter method to process the outliers and noise of the time series data related to the stormwater pipe overflow prediction after the missing value processing in step S2.1;

[0016] S2.3: Standardize the data processed in step S2.2. The expression is:

[0017]

[0018] Among them, min(x) is the minimum value of x, and max(x( is the maximum value of x.

[0019] Furthermore, the specific implementation method of step S3 includes the following steps:

[0020] S3.1. Construct a rainwater pipe overflow prediction model, including an input layer, a BiLSTM layer, an attention layer, a fully connected layer, and an output layer. The preprocessed rainwater pipe time series data passes through the input layer, first through the BiLSTM layer to extract context information and fuse it, and then through the attention layer to calculate the attention value of the feature state of the data at different times to the predicted value, and obtain the correlation between each data in the time series and the predicted value. Finally, the fully connected layer calculates the output of the attention layer to obtain the predicted value of the output layer;

[0021] S3.2. Set the BiLSTM layer to randomly initialize the network parameters of the forward LSTM and reverse LSTM of the BiLSTM using normal distribution. Input the rainwater pipe data at time t into the LSTM unit. The input gate inside the LSTM will first extract the information of the rainwater pipe sequence data. The expression is:

[0022] i t =σ(W i ·[h t-1 ,X t ]+b i )

[0023]

[0024] Among them, h t-1 is the rainwater pipe data sequence state at time t-1, X t is the input at time t, σ is the sigmoid activation function, i t To update the value of the network, is the candidate information of the rainwater pipe data input at the current moment, W i 、b i , W c 、b c is the weight matrix of the input gate;

[0025] In order to filter and classify irrelevant data information, X t Input to the forget gate for feature filtering, the calculation formula is:

[0026] f t =σ(W f ·[h t-1 ,X t ]+b f )

[0027] Among them, W f With b f is the weight matrix of the forget gate;

[0028] Combine the forget gate with the input gate to get new sequence information C t , the calculation formula is:

[0029]

[0030] Finally, the final output of LSTM is obtained through the output gate, and the forward and reverse LSTM outputs of BiLSTM are merged to obtain the output of BiLSTM network. The calculation formula is:

[0031] o t =σ(W o ·[h t-1 ,Xt ]+b o )

[0032]

[0033]

[0034] Among them, W o With b o is the output gate weight, is the output sequence vector obtained by the forward LSTM and the reverse LSTM, is the forward LSTM output, is the reverse LSTM output, ρ t It is the result of forward and reverse LSTM merging;

[0035] Then the output of BiLSTM passes through the attention layer to calculate the attention value of the feature state of the data at different times to the predicted value. The specific calculation formula is:

[0036]

[0037] Among them, Q, K, and V are query matrix, index matrix, and content matrix respectively, and their calculation formula is:

[0038] Q=W Q X

[0039] K=W K X

[0040] V=W V X

[0041] Among them, W Q , W k , W V is the weight matrix, and the final output of the attention layer is calculated through the fully connected layer to obtain the final output of the prediction model.

[0042] Furthermore, the specific implementation method of step S4 is to set the training process in combination with the genetic algorithm to optimize the two network parameters of the number of network layers and the number of nodes per layer, and the remaining parameters are manually adjusted by observation. The genetic algorithm process is as follows:

[0043] S4.1. Set the parameter range of the number of BiLSTM network layers and the number of network nodes, and then initialize the genetic algorithm population, that is, randomly generate population individuals, and then train the model according to each individual, and then calculate the fitness of the individuals in the population, and take the inverse of the absolute error between the predicted value and the true value output by the network as the individual fitness value fitness. The specific formula is as follows:

[0044]

[0045] Among them, y and Represent the true value and the predicted value respectively, and N is the number of predicted values;

[0046] S4.2. After determining the fitness value of each individual, use the roulette wheel selection algorithm to perform the selection operation. According to the fitness size, the proportion of the fitness values ​​of all individuals to the total fitness value is used as the probability distribution. Then, a random number between 0 and 1 is randomly generated. The individual corresponding to the first point on the probability distribution function that is greater than or equal to the random number is found. The calculation formula for the individual selection probability is:

[0047]

[0048] Among them, fitness i and fitness j is the fitness of the i-th and j-th individuals in the population, p(i) is the probability of the individual ranked i being selected, and J is the total number of individuals in the population;

[0049] S4.3. Perform crossover and mutation operations. For the crossover operation, two parent individuals are randomly selected, a crossover position is randomly selected, and some genes between them are exchanged. After the crossover operation is completed, a mutation operation is performed. For a certain individual, a gene position is randomly selected and a number is randomly generated. If this number is greater than the mutation rate, it is mutated, that is, it is randomly transformed into another number within the set parameter range;

[0050] S4.4. Based on the method of steps S4.1-S4.3, training is performed, and the number of network layers and the number of nodes in each layer are optimized by genetic algorithms. First, the parameter range of the number of network layers and the number of nodes in each layer of BiLSTM is set, and then the genetic algorithm population is initialized, and the fitness value of BiLSTM is calculated. Then, roulette selection operation, single-point crossover operation and mutation operation are performed respectively, and then it is determined whether the number of network layers and the number of nodes in each layer meet the termination conditions. If they meet the conditions, the optimal calibrated BiLSTM is obtained, that is, the optimal number of network layers and the number of nodes in each layer are obtained. After obtaining the optimal number of network layers and the number of nodes in each layer, the model is trained to the optimal or expected effect by continuously adjusting the time step, training batch size, number of iterations, and learning rate, and can be used to predict stormwater pipe overflow events.

[0051] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a rainwater pipe overflow prediction method when executing the computer program.

[0052] A computer-readable storage medium stores a computer program, which implements a rainwater pipe overflow prediction method when executed by a processor.

[0053] Beneficial effects of the present invention:

[0054] The method for predicting overflow of a rainwater pipe described in the present invention is based on a recurrent neural network and uses a deep learning method to perform predictions, thereby achieving long-term use after one-time training, improving prediction efficiency, and being able to cope with emergency prediction scenarios. At the same time, the present invention combines a deep learning interpolation method with a Kalman filter method to preprocess time series data, remove missing values, outliers, and noise in the time series data, enhance the data, improve data quality, and enhance the model training effect, thereby increasing prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A flow chart of a method for predicting overflow of a rainwater pipe according to the present invention;

[0056] Figure 2 It is a data preprocessing flow chart of the present invention;

[0057] Figure 3 It is a structural diagram of the prediction model of the present invention;

[0058] Figure 4 It is the genetic algorithm flow chart of the present invention;

[0059] Figure 5 This is a flow chart of model training of the present invention. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solution and advantages of the present invention more clear, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention, that is, the specific embodiments described are only part of the embodiments of the present invention, rather than all of the specific embodiments. The components of the specific embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations, and the present invention can also have other embodiments.

[0061] Therefore, the following detailed description of the specific embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected specific embodiments of the present invention. Based on the specific embodiments of the present invention, all other specific embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0062] In order to further understand the content, features and effects of the present invention, the following specific implementation methods are given as examples, and the attached Figure 1 -Attached Figure 5 The detailed instructions are as follows:

[0063] Embodiment 1:

[0064] A method for predicting overflow of a rainwater pipe comprises the following steps:

[0065] S1. Collect the overflow data of rainwater pipes, including flow, liquid level, rainfall, pipe diameter and slope, and then form a time series data set of rainwater pipes;

[0066] S2. Perform data preprocessing on the data in the rainwater pipe time series data set obtained in step S1, including missing value processing, outlier processing, noise processing and standardization processing, to obtain a data set for rainwater pipe overflow prediction, for standby use;

[0067] Furthermore, the specific implementation method of step S2 includes the following steps:

[0068] S2.1. Use the deep learning interpolation method BRITS to fill the missing values ​​of flow, liquid level and rainfall for the stormwater pipe overflow data collected in step S1;

[0069] The specific method is to first set the flow, liquid level and rainfall time series data as X = {x 1 ,x 2 ,x 3}, where X represents the three time series data of total flow, liquid level and rainfall, x 1 represents the flow rate, x 2 represents the liquid level, x 3 represents rainfall, and each time series includes values ​​collected at T time points, so there is as well as Among them For example, representing the time series x 1 The values ​​collected at the Tth time point, and there are missing values ​​in these three time series;

[0070] Let the label vector be M = {m 1 ,m 2 ,m 3},m 1 、m 2 and m 3 Represent the label vectors of three time series data: flow, liquid level and rainfall. The dimension of M is the same as X, and there is as well as Among them For example, it represents the label vector m 1 The value of at the Tth time point, the expression for the assignment of each value of M is:

[0071]

[0072] in, Represents m d The value of the t-th time point, the value of the superscript d is 1, 2, and 3, Represents x d The value of the time series at the tth time point;

[0073] Based on the continuous loss of flow, liquid level and rainfall data, define G = {δ 1 ,δ 2 ,δ 3} represents the time interval from the last non-missing value to the current timestamp. The dimension of G is the same as that of X, and there is as well as Among them For example, it represents the label vector δ 1 The value of G at the Tth time point, the assignment expression of each value of G is:

[0074]

[0075] in, Represents δ d The value at the tth time point, s t is the actual moment of the t-th time point, that is The actual collection time;

[0076] After determining X, M and G, use X, M and G as parameters of the BRITS method and use the BRITS method to fill in missing values;

[0077] S2.2. Use the Kalman filter method to process the outliers and noise of the time series data related to the stormwater pipe overflow prediction after the missing value processing in step S2.1;

[0078] Time series data include flow, liquid level and rainfall. Kalman filtering fuses the output value of the mathematical model and the actual measurement value (measurement value of the Internet of Things device) according to the uncertainty information contained in each variable of the three time series data: flow, liquid level and rainfall (the degree of this uncertainty information is determined by the defined covariance), so as to output a more convincing value, thereby smoothing the data and removing noise and outliers in the data.

[0079] S2.3: Standardize the data processed in step S2.2. The expression is:

[0080]

[0081] Among them, min(x) is the minimum value of x, and max(x) is the maximum value of x.

[0082] S3. Construct a stormwater pipe overflow prediction model;

[0083] Furthermore, the specific implementation method of step S3 includes the following steps:

[0084] S3.1. Construct a rainwater pipe overflow prediction model, including an input layer, a BiLSTM layer, an attention layer, a fully connected layer, and an output layer. The preprocessed rainwater pipe time series data passes through the input layer, first through the BiLSTM layer to extract context information and fuse it, and then through the attention layer to calculate the attention value of the feature state of the data at different times to the predicted value, and obtain the correlation between each data in the time series and the predicted value. Finally, the fully connected layer calculates the output of the attention layer to obtain the predicted value of the output layer;

[0085] The role of the attention layer is to enable the model to better focus on important information. The role of the BiLSTM layer is to memorize the information in the time series. The role of the fully connected layer is to convert the output data of the attention layer into the final output data, that is, whether the rainwater pipe will overflow. The preprocessed input layer rainwater pipe time series data first passes through the BiLSTM layer to extract context information and fuse it, and then passes through the attention layer to calculate the attention value of the feature state of the data at different times to the predicted value, and obtains the correlation between each data in the time series and the predicted value. Finally, the fully connected layer performs output calculation on the data output by the attention layer to obtain the predicted value of the output layer.

[0086] S3.2. Set the BiLSTM layer to randomly initialize the network parameters of the forward LSTM and reverse LSTM of the BiLSTM using normal distribution. Input the rainwater pipe data at time t into the LSTM unit. The input gate inside the LSTM will first extract the information of the rainwater pipe sequence data. The expression is:

[0087] i t =σ(W i ·[h t-1 ,X t ]+b i )

[0088]

[0089] Among them, h t-1 is the rainwater pipe data sequence state at time t-1, X t is the input at time t, σ is the sigmoid activation function, i t To update the value of the network, is the candidate information of the rainwater pipe data input at the current moment, W i 、b i , W c 、b c is the weight matrix of the input gate;

[0090] In order to filter and classify irrelevant data information, X t Input to the forget gate for feature filtering, the calculation formula is:

[0091] f t =σ(W f ·[h t-1 ,X t ]+b f )

[0092] Among them, W f With b f is the weight matrix of the forget gate;

[0093] Combine the forget gate with the input gate to get new sequence information C t , the calculation formula is:

[0094]

[0095] Finally, the final output of LSTM is obtained through the output gate, and the forward and reverse LSTM outputs of BiLSTM are merged to obtain the output of BiLSTM network. The calculation formula is:

[0096] o t =σ(W o ·[h t-1 ,X t ]+b o )

[0097]

[0098]

[0099] Among them, W o With b o is the output gate weight, is the output sequence vector obtained by the forward LSTM and the reverse LSTM, is the forward LSTM output, is the reverse LSTM output, ρ t It is the result of forward and reverse LSTM merging;

[0100] Then the output of BiLSTM passes through the attention layer to calculate the attention value of the feature state of the data at different times to the predicted value. The specific calculation formula is:

[0101]

[0102] Among them, Q, K, and V are query matrix, index matrix, and content matrix respectively, and their calculation formula is:

[0103] Q=WQ X

[0104] K=W K X

[0105] V=W V X

[0106] Among them, W Q , W K , W V is the weight matrix, and the final output of the attention layer is calculated through the fully connected layer to obtain the final output of the prediction model.

[0107] S4. Using the data set for rainwater pipe overflow prediction obtained in step S2, combined with a genetic algorithm, the rainwater pipe overflow prediction model constructed in step S3 is trained to obtain a trained rainwater pipe overflow prediction model;

[0108] Because the training parameters involved mainly include time step, training batch size, number of iterations, learning rate and network size, among which the settings of time step, training batch size, number of iterations and learning rate have rules to follow, but the parameters involved in network size design, the number of network layers and the number of nodes in each layer are highly random and there are no specific rules to follow, so genetic algorithms are used for optimization.

[0109] Furthermore, the specific implementation method of step S4 is to set the training process in combination with the genetic algorithm to optimize the two network parameters of the number of network layers and the number of nodes per layer, and the remaining parameters are manually adjusted by observation. The genetic algorithm process is as follows:

[0110] S4.1. Set the parameter range of the number of BiLSTM network layers and the number of network nodes, and then initialize the genetic algorithm population, that is, randomly generate population individuals, and then train the model according to each individual, and then calculate the fitness of the individuals in the population, and take the inverse of the absolute error between the predicted value and the true value output by the network as the individual fitness value fitness. The specific formula is as follows:

[0111]

[0112] Among them, y and Represent the true value and the predicted value respectively, and N is the number of predicted values;

[0113] For example, when the number of network layers is 2 and the number of nodes in each layer is 128, the individual form is [2,128]. Then the model is trained based on each individual, and then the fitness of the individuals in the population is calculated. The inverse of the absolute error between the predicted value and the true value output by the network is used as the fitness value of the individual.

[0114] S4.2. After determining the fitness value of each individual, use the roulette wheel selection algorithm to perform the selection operation. According to the fitness size, the proportion of the fitness values ​​of all individuals to the total fitness value is used as the probability distribution. Then, a random number between 0 and 1 is randomly generated. The individual corresponding to the first point on the probability distribution function that is greater than or equal to the random number is found. The calculation formula for the individual selection probability is:

[0115]

[0116] Among them, fitness i and fitness j is the fitness of the i-th and j-th individuals in the population, p(i) is the probability of the individual ranked i being selected, and J is the total number of individuals in the population;

[0117] S4.3. Perform crossover and mutation operations. For the crossover operation, two parent individuals are randomly selected, a crossover position is randomly selected, and some genes between them are exchanged. After the crossover operation is completed, a mutation operation is performed. For a certain individual, a gene position is randomly selected and a number is randomly generated. If this number is greater than the mutation rate, it is mutated, that is, it is randomly transformed into another number within the set parameter range;

[0118] For example, suppose there are two parent individuals [2,128] and [1,64]. Suppose the crossover position of these two individuals is the number of network layers, then the crossover results are [1,128] and [2,64]. After the crossover operation is completed, the mutation operation is performed. This operation refers to randomly selecting a gene position for a certain individual and randomly generating a number. If this number is greater than the mutation rate, it is mutated, that is, it is randomly transformed into another number within the set parameter range. For example, for the individual [2,128], a random number is generated according to each gene position. If the random number meets the mutation requirement, the gene position is mutated. Suppose the position where the mutation occurs is the number of nodes per layer, and suppose the parameter variation range is selected from [32,64,128,256]. The mutation operation is to randomly select a parameter from these four parameters for variation. Suppose the variation is 256, then the mutation result of this individual is [2,256].

[0119] S4.4. Based on the method of steps S4.1-S4.3, training is performed, and the number of network layers and the number of nodes in each layer are optimized by genetic algorithms. First, the parameter range of the number of network layers and the number of nodes in each layer of BiLSTM is set, and then the genetic algorithm population is initialized, and the fitness value of BiLSTM is calculated. Then, roulette selection operation, single-point crossover operation and mutation operation are performed respectively, and then it is determined whether the number of network layers and the number of nodes in each layer meet the termination conditions. If they meet the conditions, the optimal calibrated BiLSTM is obtained, that is, the optimal number of network layers and the number of nodes in each layer are obtained. After obtaining the optimal number of network layers and the number of nodes in each layer, the model is trained to the optimal or expected effect by continuously adjusting the time step, training batch size, number of iterations, and learning rate, and can be used to predict stormwater pipe overflow events.

[0120] S5. Use the stormwater pipe overflow prediction model trained in step S4 to predict stormwater pipe overflow events.

[0121] Embodiment 2:

[0122] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a rainwater pipe overflow prediction method described in Example 1 when executing the computer program.

[0123] The computer device of the present invention may be a device including a processor and a memory, such as a single chip microcomputer including a central processing unit, etc. Moreover, the processor is used to implement the steps of the above-mentioned rainwater pipe overflow prediction method when executing the computer program stored in the memory.

[0124] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0125] The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0126] Embodiment 3:

[0127] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements a rainwater pipe overflow prediction method as described in Example 1.

[0128] The computer-readable storage medium of the present invention can be any form of storage medium that can be read by a processor of a computer device, including but not limited to non-volatile memory, volatile memory, ferroelectric memory, etc. A computer program is stored on the computer-readable storage medium. When the processor of the computer device reads and executes the computer program stored in the memory, the steps of the above-mentioned rainwater pipe overflow prediction method can be implemented.

[0129] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer readable media do not include electric carrier signals and telecommunication signals.

[0130] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0131] Although the present application has been described above with reference to specific embodiments, various modifications may be made thereto and parts thereof may be replaced with equivalents without departing from the scope of the present application. In particular, as long as there is no structural conflict, the various features in the specific embodiments disclosed in the present application may be used in combination with each other in any manner, and the fact that these combinations are not exhaustively described in this specification is only for the sake of omitting space and saving resources. Therefore, the present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.

Claims

1. A method for predicting overflow of a rainwater pipe, characterized in that: The steps include: S1. Collect the overflow data of rainwater pipes, including flow, liquid level, rainfall, pipe diameter and slope, and then form a time series data set of rainwater pipes; S2. Perform data preprocessing on the data in the rainwater pipe time series data set obtained in step S1, including missing value processing, outlier processing, noise processing and standardization processing, to obtain a data set for rainwater pipe overflow prediction, for standby use; The specific implementation method of step S2 includes the following steps: S2.

1. Use the deep learning interpolation method BRITS to fill the missing values ​​of flow, liquid level and rainfall for the stormwater pipe overflow data collected in step S1; The specific method is to first set the flow, liquid level and rainfall time series data as X = {x 1 ,x 2 ,x 3 }, where X represents the three time series data of total flow, liquid level and rainfall, x 1 represents the flow rate, x 2 represents the liquid level, x 3 represents rainfall, and each time series includes values ​​collected at T time points, so there is as well as Among them For example, representing the time series x 1 The values ​​collected at the Tth time point, and there are missing values ​​in these three time series; Let the label vector be M = {m 1 ,m 2 ,m 3 },m 1 、m 2 and m 3 Represent the label vectors of three time series data: flow, liquid level and rainfall. The dimension of M is the same as X, and there is as well as Among them For example, it represents the label vector m 1 The value of at the Tth time point, the expression for the assignment of each value of M is: in, Represents m d The value of the t-th time point, the value of the superscript d is 1, 2, and 3, Represents x d The value of the time series at the tth time point; Based on the continuous loss of flow, liquid level and rainfall data, define G = {δ 1 ,δ 2 ,δ 3 } represents the time interval from the last non-missing value to the current timestamp. The dimension of G is the same as that of X, and there is as well as Among them For example, it represents the label vector δ 1 The value of G at the Tth time point, the assignment expression of each value of G is: in, Represents δ d The value at the tth time point, s t is the actual moment of the t-th time point, that is The actual collection time; After determining X, M and G, use X, M and G as parameters of the BRITS method and use the BRITS method to fill in missing values; S2.

2. Use the Kalman filter method to process the outliers and noise of the time series data related to the stormwater pipe overflow prediction after the missing value processing in step S2.1; S2.3: Standardize the data processed in step S2.

2. The expression is: Among them, min(x) is the minimum value of x, and max(x) is the maximum value of x; S3. Construct a stormwater pipe overflow prediction model; The specific implementation method of step S3 includes the following steps: S3.

1. Construct a rainwater pipe overflow prediction model, including an input layer, a BiLSTM layer, an attention layer, a fully connected layer, and an output layer. The preprocessed rainwater pipe time series data passes through the input layer, first through the BiLSTM layer to extract context information and fuse it, and then through the attention layer to calculate the attention value of the feature state of the data at different times to the predicted value, and obtain the correlation between each data in the time series and the predicted value. Finally, the fully connected layer calculates the output of the attention layer to obtain the predicted value of the output layer; S3.

2. Set the BiLSTM layer to randomly initialize the network parameters of the forward LSTM and reverse LSTM of the BiLSTM using normal distribution. Input the rainwater pipe data at time t into the LSTM unit. The input gate inside the LSTM will first extract the information of the rainwater pipe sequence data. The expression is: i t =σ(W i ·[h t-1 ,X t ]+b i ) Among them, h t-1 is the rainwater pipe data sequence state at time t-1, X t is the input at time t, σ is the sigmoid activation function, i t To update the value of the network, is the candidate information of the rainwater pipe data input at the current moment, W i , b i , W c , b c is the weight matrix of the input gate; In order to filter and classify irrelevant data information, X t Input to the forget gate for feature filtering, the calculation formula is: f t =σ(W f ·[h t-1 ,X t ]+b f ) Among them, W f With b f is the weight matrix of the forget gate; Combine the forget gate with the input gate to get new sequence information C t , the calculation formula is: Finally, the final output of LSTM is obtained through the output gate, and the forward and reverse LSTM outputs of BiLSTM are merged to obtain the output of BiLSTM network. The calculation formula is: the t =σ(W o ·[h t-1 ,X t ]+b o ) Among them, W o With b o is the output gate weight, is the output sequence vector obtained by the forward LSTM and the reverse LSTM, is the forward LSTM output, is the reverse LSTM output, ρ t It is the result of forward and reverse LSTM merging; Then the output of BiLSTM passes through the attention layer to calculate the attention value of the feature state of the data at different times to the predicted value. The specific calculation formula is: Among them, Q, K, and V are query matrix, index matrix, and content matrix respectively, and their calculation formula is: Q=W Q X K=W K X β=W V X Among them, W Q , W K , W V is the weight matrix, and the final output of the attention layer is calculated through the fully connected layer to obtain the final output of the prediction model; S4. Using the data set for rainwater pipe overflow prediction obtained in step S2, combined with a genetic algorithm, the rainwater pipe overflow prediction model constructed in step S3 is trained to obtain a trained rainwater pipe overflow prediction model; S5. Use the stormwater pipe overflow prediction model trained in step S4 to predict stormwater pipe overflow events.

2. A method for predicting overflow of a rainwater pipe according to claim 1, characterized in that: The specific implementation method of step S4 is to set the training process to optimize the two network parameters of the number of network layers and the number of nodes per layer in combination with the genetic algorithm optimization, and the remaining parameters are manually adjusted by observation. The genetic algorithm process is as follows: S4.

1. Set the parameter range of the number of BiLSTM network layers and the number of network nodes, and then initialize the genetic algorithm population, that is, randomly generate population individuals, and then train the model according to each individual, and then calculate the fitness of the individuals in the population, and take the inverse of the absolute error between the predicted value and the true value output by the network as the individual fitness value fitness. The specific formula is as follows: Among them, y and Represent the true value and the predicted value respectively, and N is the number of predicted values; S4.

2. After determining the fitness value of each individual, use the roulette wheel selection algorithm to perform the selection operation. According to the fitness size, the proportion of the fitness values ​​of all individuals to the total fitness value is used as the probability distribution. Then, a random number between 0 and 1 is randomly generated. The individual corresponding to the first point on the probability distribution function that is greater than or equal to the random number is found. The calculation formula for the individual selection probability is: Among them, fitness i and fitness j is the fitness of the i-th and j-th individuals in the population, p(i) is the probability of the individual ranked i being selected, and J is the total number of individuals in the population; S4.

3. Perform crossover and mutation operations. For the crossover operation, two parent individuals are randomly selected, a crossover position is randomly selected, and some genes between them are exchanged. After the crossover operation is completed, a mutation operation is performed. For a certain individual, a gene position is randomly selected and a number is randomly generated. If this number is greater than the mutation rate, it is mutated, that is, it is randomly transformed into another number within the set parameter range; S4.

4. Based on the method of steps S4.1-S4.3, training is performed, and the number of network layers and the number of nodes in each layer are optimized by genetic algorithms. First, the parameter range of the number of network layers and the number of nodes in each layer of BiLSTM is set, and then the genetic algorithm population is initialized, and the fitness value of BiLSTM is calculated. Then, roulette selection operation, single-point crossover operation and mutation operation are performed respectively, and then it is determined whether the number of network layers and the number of nodes in each layer meet the termination conditions. If they meet the conditions, the optimal calibrated BiLSTM is obtained, that is, the optimal number of network layers and the number of nodes in each layer are obtained. After obtaining the optimal number of network layers and the number of nodes in each layer, the model is trained to the optimal or expected effect by continuously adjusting the time step, training batch size, number of iterations, and learning rate, and can be used to predict stormwater pipe overflow events.

3. An electronic device, characterized in that: It comprises a memory and a processor, the memory stores a computer program, and the processor implements the steps of a rainwater pipe overflow prediction method as described in any one of claims 1-2 when executing the computer program.

4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, a method for predicting rainwater pipe overflow according to any one of claims 1 to 2 is implemented.

Citation Information

Patent Citations

  • Water quality prediction method based on attention neural network

    CN110428082A

  • Method for intelligent analysis of overflow early warning of drainage pipe network

    CN113902161A