Ultrasonic water meter data restoration method based on bidirectional LSTM
By adopting a data repair method based on bidirectional LSTM, the problems of insufficient repair accuracy and real-time performance of ultrasonic water meter data under fluctuating and complex operating conditions are solved, and efficient and accurate data repair is achieved.
Patent Information
- Application Number
- CN202511274907.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2026-01-23
AI Technical Summary
Existing ultrasonic water meter data repair methods are not accurate enough when data fluctuates or trends change. Traditional machine learning algorithms are difficult to capture long-term dependencies and have low computational efficiency, which cannot meet the needs of real-time water management.
A bidirectional LSTM-based data restoration method is adopted. Outliers are filtered by dynamic thresholding, a bidirectional LSTM model is constructed and its parameters are optimized, and the Adam algorithm is used for training to achieve high-precision data restoration.
It improved the accuracy of data repair and its ability to adapt to complex working conditions, shortened the training time, met the real-time requirements, and ensured the integrity and real-time performance of the data.
Smart Images

Figure CN121388515A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of ultrasonic water meters, in particular to an ultrasonic water meter data repairing method based on a bidirectional LSTM. BACKGROUND
[0002] In modern water management systems, ultrasonic water meters are widely used in urban water supply, industrial water monitoring and other fields due to their high precision, non-contact measurement, low pressure loss and other advantages. Accurate water meter data is crucial for the rational allocation of water resources, cost accounting and pipe network operation monitoring. With the development of Internet of Things technology, a large number of ultrasonic water meters upload data in real time through the network, forming a large time series data set. However, in actual application environment, affected by factors such as electromagnetic interference, unstable water flow in the pipeline, equipment aging and other factors, the data collected by the ultrasonic water meter often has abnormal values or missing values, which seriously affects the integrity and accuracy of the data, and further interferes with the scientificity of water management decisions.
[0003] Currently, for the problem of ultrasonic water meter data abnormality or missing, some existing technologies use simple data interpolation methods, such as linear interpolation, polynomial interpolation, etc. These methods fill in abnormal or missing values by mathematical formula calculation according to the values of adjacent data points. In addition, there are also methods based on statistical models, such as moving average method, which corrects abnormal data by calculating the average value of data within a certain time window. In some more advanced applications, traditional machine learning algorithms such as support vector machine (SVM) are also introduced, which constructs a classification model to identify and process abnormal data by learning known normal data.
[0004] Simple data interpolation methods such as linear interpolation and polynomial interpolation only consider the local continuity of data. When the data segment where the abnormal value or missing value is located has a large fluctuation or trend change, the interpolation result deviates greatly from the true value, and cannot accurately reflect the true situation of the data. Statistical model-based methods, such as the moving average method, have poor adaptability to dynamic changes in data and are difficult to cope with complex and variable water flow conditions. When the water flow suddenly accelerates, decelerates or is subjected to instantaneous pressure impact, the corrected value obtained by the moving average method will deviate seriously from the actual value. Traditional machine learning algorithms such as support vector machine (SVM) can handle data abnormality to some extent, but their ability to extract data features is limited, and it is difficult to learn complex patterns and long-term dependencies in ultrasonic water meter time series data. Moreover, these traditional methods have low computational efficiency when dealing with large-scale data, and cannot meet the real-time requirements of water management scenarios. SUMMARY
[0005] To overcome the defects of the prior art, the application provides an ultrasonic water meter data repairing method based on a bidirectional LSTM, which solves the problem of obvious defects of the prior art ultrasonic water meter data repairing method. The simple interpolation method only considers local continuity, and has large deviation when data fluctuates or trends change; the moving average method has poor adaptability to dynamic changes and is difficult to deal with complex working conditions such as water flow mutation; the traditional machine learning algorithm such as SVM has limited feature extraction capability, is difficult to capture long-term dependence, and has low calculation efficiency when dealing with large-scale data, and cannot meet the real-time water management requirements.
[0006] To achieve the above object, the application is implemented by the following technical scheme: an ultrasonic water meter data repairing method based on a bidirectional LSTM, comprising the following steps: Step 1, calculating the ultrasonic time-of-flight difference by an ultrasonic water meter time chip to obtain the original data of the ultrasonic water meter time series , wherein , represents the total number of time series data sets measured by the ultrasonic water meter during the test period, and a dynamic threshold method is used to screen the abnormal values of the ultrasonic water meter time series data set; Step 2, implementing ultrasonic water meter time series data preprocessing to remove abnormal values in the data set, and configuring the training set and test set according to the LSTM model features; Step 3, using the adaptive moment estimation method to set the optimization parameters of the forward and reverse LSTM networks in the bidirectional LSTM, and the specific process is as follows: Step 3.1, combining the ultrasonic water meter time series data, using the Adam algorithm to set the optimization parameters of the forward LSTM network; Step 3.2, combining the ultrasonic water meter time series data, using the Adam algorithm to set the optimization parameters of the reverse LSTM network; Step 4, constructing a bidirectional LSTM model, combining the ultrasonic water meter time series data, and training the bidirectional LSTM model; Step 5, importing the test set of the ultrasonic water meter time series into the trained bidirectional LSTM model, and outputting the predicted value of ; Step 6, quality evaluation is performed on the repaired data, and the evaluation indexes include but are not limited to the error rate of the repaired data and the true data, the stability of the repaired data, if the error rate exceeds the preset threshold or the stability does not meet the requirements, the bidirectional LSTM model parameters are adjusted again, and the model is retrained in step 4.
[0007] Preferably, the processing procedure of step 1 is as follows: Step 1.1, using a weighted moving average method to calculate the dynamic average value of the ultrasonic water meter time series data, and the calculation formula is as follows: wherein, denotes the dynamic average value at the point; 2M+1 is the selected data segment period for the weighted moving average value calculation; denotes the weight of each item, ; the value of and the weight of each item are set according to the amount and characteristics of the ultrasonic water meter time series data; Step 1.2, define the average weight of the selected data segment as the average weight at the point, denoted as , the dynamic standard deviation of the ultrasonic water meter time series data is calculated by using the weighted standard deviation method, and the calculation formula is as follows: Step 1.3, combining the above dynamic average value and dynamic standard deviation, the dynamic threshold of the ultrasonic water meter time series data is set by using criterion, and is defined as: wherein, denotes the upper boundary of the dynamic threshold range at the point, denotes the lower boundary of the dynamic threshold range at the point; Step 1.4, combining the above dynamic threshold, if , then it is determined as normal data and does not need to be repaired; if or , then it is determined as abnormal data and needs to be repaired.
[0008] Preferably, the processing procedure of step 2 is as follows: Step 2.1, remove the abnormal values in the ultrasonic water meter time series data set, and the determination method is based on the results of step 1.4; Step 2.2, select a data set with a suitable time length as a training set according to the data characteristics of the ultrasonic water meter time series data set and the basic requirements of the LSTM model for the training set, and according to the above abnormal data determination results, the first p items before the abnormal value to the q items after the abnormal value in the test set are selected as the test set, and the data in the test set is denoted as , wherein .
[0009] Preferably, in step 3.1, combining the ultrasonic water meter time series data, the process of setting the optimization parameters of the forward LSTM network by using the Adam algorithm is as follows: Step 3.1.1, initialize the parameters , the first moment estimation Second-order moment estimation Calculate the gradient Update the first-order moment estimate Second-order moment estimation The formula is as follows: ; in, express Time gradient; This represents the first-order moment estimate of the decay exponent; This represents the second moment estimate of the decay exponent; Step 3.1.2: Calculate the first-moment estimate with bias correction. and bias-corrected second-moment estimation The formula is as follows: ; Step 3.1.3: Update model parameters The formula is as follows: ; in, For learning rate, To prevent extremely small constants with a denominator of zero.
[0010] Preferably, in step 3.2, the process of setting the optimization parameters of the reverse LSTM network by combining the ultrasonic water meter time series data and using the Adam algorithm is the same as in step 3.1, except that the relevant parameter identifiers are replaced with the parameter identifiers of the reverse LSTM network.
[0011] Preferably, the process of constructing the bidirectional LSTM model in step 4 is as follows: Step 4.1: Construct a forward LSTM network, the process is as follows: Step 4.1.1: Create a neural network and set the number of nodes in the input layer. Number of output layer nodes Number of hidden layer nodes The relationship between the three satisfies the following empirical formula: ; Step 4.1.2: Set the input gate for the forward LSTM network Forgotten Gate and output gate Input and output functions to set the current state of the Cell unit. The output function is shown in the following formula: ; in, for Activation function For element-wise multiplication, This is the weight matrix. For bias vectors, for Input at any time, for Output at all times for Cell state at any given time; Step 4.2: Construct a reverse LSTM network. The construction process is similar to that of the forward LSTM network, but the data flow is reversed. Step 4.3: Set the input and output functions for the output layer of the bidirectional LSTM model: ; in, Indicates the input of the output layer; This represents the weights from the forward cell to the output layer; This represents the weights from the reverse Cell unit to the output layer; This represents the output activation function of the output layer; Indicates time The predicted value output by the bidirectional LSTM model; Step 4.4: Combining the above optimized parameter settings and the initial bidirectional LSTM model, import the ultrasonic water meter time series training dataset and train the bidirectional LSTM model. Step 4.4.1: Calculate the loss function for the forward LSTM network: in, Indicates time True ultrasonic value; Step 4.4.2: Adjust and optimize the weights based on the backpropagation error of the bidirectional LSTM model, defining: Step 4.4.3: Adjust and optimize the weights according to the backpropagation error of the forward LSTM network, and make corresponding adjustments to the weights of the input gate, forget gate, output gate and cell unit.
[0012] An ultrasonic water meter data repair system based on bidirectional LSTM includes: The data acquisition unit is used to acquire the ultrasonic time-of-flight difference through the ultrasonic water meter time chip to obtain the raw time series data of the ultrasonic water meter. An outlier filtering unit, connected to the data acquisition unit, is used to filter outliers in the time series dataset of ultrasonic water meters using a dynamic threshold method. The data preprocessing unit, connected to the outlier filtering unit, is used to remove outlier values from the dataset and configure the training and test sets according to the features of the LSTM model. The parameter optimization unit, connected to the data preprocessing unit, is used to optimize the parameter settings of the forward and inverse LSTM networks in the bidirectional LSTM using the adaptive moment estimation method. The model building and training unit, connected to the parameter optimization unit, is used to build a bidirectional LSTM model and train it using time-series data from ultrasonic water meters. The data repair unit, connected to the model building and training unit, is used to import the test set of the ultrasonic water meter time series into the trained bidirectional LSTM model and output the repaired predicted value. The quality assessment unit, connected to the data repair unit, is used to assess the quality of the repaired data.
[0013] Preferably, the data acquisition unit includes a high-precision time measurement module for accurately measuring the ultrasonic time difference. This module consists of a temperature-controlled crystal oscillator clock source, a time-to-digital converter, and a signal conditioning circuit.
[0014] Preferably, the outlier filtering unit, data preprocessing unit, parameter optimization unit, model building and training unit, data repair unit, and quality assessment unit are all integrated into a processor with high-performance computing capabilities. This processor adopts a multi-core architecture and has a computing speed of trillions of floating-point operations per second.
[0015] Preferably, the model building and training unit further includes a model storage subunit, which is used to store the parameters and structure information of the trained bidirectional LSTM model. When the system restarts or a new repair task is started, the stored model can be directly called to perform data repair without retraining. The model parameters include the weight matrix of each layer, the bias vector and the optimizer parameters, and the storage format adopts binary serialization format.
[0016] This invention provides a method for repairing ultrasonic water meter data based on bidirectional LSTM. It has the following beneficial effects: 1. In terms of repair accuracy, the bidirectional LSTM model can effectively capture long-term dependencies and complex patterns in ultrasonic water meter time series data, which greatly improves the accuracy of data repair compared with traditional interpolation methods and simple statistical models.
[0017] 2. In terms of adapting to complex working conditions, the present invention uses a bidirectional LSTM model to learn from historical data, which can adapt to various complex and changing water flow conditions. Whether it is a sudden acceleration or deceleration of the water flow or a sudden pressure impact, it can accurately identify and repair abnormal data, thus maintaining high repair accuracy even under complex conditions.
[0018] 3. When processing large-scale data, this invention can shorten the training time by more than 50% compared with traditional machine learning algorithms, which can meet the water management scenarios with high real-time requirements, promptly repair abnormal data, and ensure the real-time performance and integrity of the data. Detailed Implementation
[0019] The technical solutions of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.
[0020] As one aspect of the present invention, the present invention provides a method for repairing ultrasonic water meter data based on bidirectional LSTM, comprising the following steps: Step 1: Calculate the ultrasonic time-of-flight difference using the ultrasonic water meter's time chip to obtain the raw time series data of the ultrasonic water meter. ,in , This represents the total number of time-series datasets obtained from ultrasonic water meters during the test period. An outlier screening of this ultrasonic water meter time-series dataset is performed using a dynamic threshold method. The specific processing procedure is as follows: 1.1 The weighted moving average method is used to calculate the dynamic average value of the time-series data of the ultrasonic water meter. The calculation formula is as follows: in, express The dynamic average value at the specified point; 2M+1 is the period for calculating the selected data segment using the weighted moving average; This represents the weight of each item. ; The values and weights of each element are set based on the amount and characteristics of the ultrasonic water meter's time-series data. 1.2. Define the average weight of the selected data segment as... The average weight at point is denoted as The dynamic standard deviation of ultrasonic water meter time-series data is calculated using the weighted standard deviation method, and the formula is as follows: 1.3. Combining the above dynamic average and dynamic standard deviation, adopt... The guidelines set dynamic thresholds for time-series data from ultrasonic water meters, defined as follows: in, express The upper boundary of the dynamic threshold range, express The lower boundary of the dynamic threshold range; 1.4. Combining the above dynamic thresholds, if ,So If the data is determined to be normal, no repair is needed; or ,So The data has been identified as abnormal and needs to be repaired.
[0021] Step 2: Perform time-series data preprocessing of ultrasonic water meters to remove outliers from the dataset, and configure the training and test sets according to the features of the LSTM model. The specific processing flow is as follows: 2.1 Remove outlier values from the ultrasonic water meter time series dataset, based on the results of step 1.4. 2.2. Based on the data characteristics of the ultrasonic water meter time series dataset and the basic requirements of the LSTM model for the training set, a dataset of suitable duration is selected as the training set. Based on the above anomaly detection results, the p terms preceding the anomaly values to the q terms following the anomaly values are used as the test set, and the data in the test set is denoted as... ,in .
[0022] Step 3: Optimize the parameter settings for the forward and inverse LSTM networks in the bidirectional LSTM using the adaptive moment estimation method. The specific process is as follows: 3.1 The process of setting the optimization parameters of the forward LSTM network using the Adam algorithm, based on the time series data of the ultrasonic water meter, is as follows: 3.1.1 Initialization Parameters First-order moment estimation Second-order moment estimation Calculate the gradient Update the first-order moment estimate Second-order moment estimation The formula is as follows: ; in, express Time gradient; This represents the first-order moment estimate of the decay exponent; This represents the second moment estimate of the decay exponent; 3.1.2 Calculate the first-moment estimate with bias correction and bias-corrected second-moment estimation The formula is as follows: ; 3.1.3 Update model parameters The formula is as follows: ; in, For learning rate, To prevent extremely small constants with a denominator of zero; 3.2. Combining the time series data of the ultrasonic water meter, the Adam algorithm is used to set the optimization parameters of the reverse LSTM network in the same way as in step 3.1, except that the relevant parameter identifiers are replaced with the parameter identifiers of the reverse LSTM network. Step 4: Construct a bidirectional LSTM model and train it using time-series data from ultrasonic water meters. The specific process is as follows: 4.1: Constructing a forward LSTM network, the process is as follows: 4.1.1: Create a neural network and set the number of nodes in the input layer. Number of output layer nodes Number of hidden layer nodes The relationship between the three satisfies the following empirical formula: ; 4.1.2: Setting the input gate for the forward LSTM network Forgotten Gate and output gate Input and output functions to set the current state of the Cell unit. The output function is shown in the following formula: ; in, for Activation function For element-wise multiplication, This is the weight matrix. For bias vectors, for Input at any time, for Output at all times for Cell state at any given time; 4.2: Construct a reverse LSTM network. The construction process is similar to that of the forward LSTM network, but the data flow is reversed. 4.3: Setting the input and output functions for the output layer of the bidirectional LSTM model: ; in, Indicates the input of the output layer; This represents the weights from the forward cell to the output layer; This represents the weights from the reverse Cell unit to the output layer; This represents the output activation function of the output layer; Indicates time The predicted value output by the bidirectional LSTM model; 4.4: Combining the above optimized parameter settings and the initial bidirectional LSTM model, import the ultrasonic water meter time series training dataset and train the bidirectional LSTM model. 4.4.1: Calculating the loss function for a forward LSTM network: in, Indicates time True ultrasonic value; 4.4.2: Adjust and optimize the weights based on the backpropagation error of the bidirectional LSTM model, defining: 4.4.3: Adjust and optimize the weights according to the backpropagation of the error of the forward LSTM network, and make corresponding adjustments to the weights of the input gate, forget gate, output gate and cell unit.
[0023] Step 5: Import the test set of ultrasonic water meter time series data into the trained bidirectional LSTM model and output... Predicted value ; Step 6: Evaluate the quality of the repaired data. Evaluation indicators include, but are not limited to, the error rate between the repaired data and the real data, and the stability of the repaired data. If the error rate exceeds the preset threshold or the stability does not meet the requirements, readjust the bidirectional LSTM model parameters and return to step 4 to retrain the model.
[0024] As another aspect of the present invention, the present invention provides an ultrasonic water meter data repair system based on bidirectional LSTM, comprising: The data acquisition unit is used to acquire the ultrasonic time-of-flight difference through the ultrasonic water meter time chip and obtain the raw data of the ultrasonic water meter time series. It includes a high-precision time measurement module for accurately measuring the ultrasonic time-of-flight difference. This module consists of a temperature-controlled crystal clock source, a time-to-digital converter and a signal conditioning circuit. An outlier filtering unit, connected to the data acquisition unit, is used to filter outliers in the time series dataset of ultrasonic water meters using a dynamic threshold method. The data preprocessing unit, connected to the outlier filtering unit, is used to remove outlier values from the dataset and configure the training and test sets according to the features of the LSTM model. The parameter optimization unit, connected to the data preprocessing unit, is used to optimize the parameter settings of the forward and inverse LSTM networks in the bidirectional LSTM using the adaptive moment estimation method. The model building and training unit, connected to the parameter optimization unit, is used to build a bidirectional LSTM model and train it using time-series data from ultrasonic water meters. It also includes a model storage subunit, which stores the parameters and structural information of the trained bidirectional LSTM model. When the system restarts or a new repair task is started, the stored model can be directly called for data repair without retraining. The model parameters include the weight matrices, bias vectors, and optimizer parameters of each layer. The storage format adopts binary serialization format. The data repair unit, connected to the model building and training unit, is used to import the test set of the ultrasonic water meter time series into the trained bidirectional LSTM model and output the repaired predicted value. The quality assessment unit, connected to the data repair unit, is used to assess the quality of the repaired data. The outlier screening unit, data preprocessing unit, parameter optimization unit, model building and training unit, data repair unit, and quality assessment unit are all integrated into a processor with high-performance computing capabilities. This processor adopts a multi-core architecture and has a computing speed of trillions of floating-point operations per second.
[0025] The following is a description with reference to specific embodiments: Step 1: Raw Data Acquisition and Outlier Screening The time difference of ultrasonic waves propagating in water is collected in real time by an ultrasonic water meter time chip to generate raw time series data. The test period was set at 72 hours, with a sampling frequency of 1 time per minute; therefore, the total number of time-series datasets was [number missing]. ,Right now The dynamic threshold method is used to filter out outliers, and the process is as follows: 1.1 Calculation of dynamic average: The weighted moving average method is used, taking the data segment period as an example. (Right now =5), weight Set according to the principle that the closer to the center, the greater the weight. , , , , , The formula for the dynamic average is: Among them, the molecule is the central data. The weighted sum of the five data points before and after the given values, with the denominator being the sum of the weights. ).
[0026] 1.2 Calculation of Dynamic Standard Deviation: Defining the Average Weight The formula for dynamic standard deviation is: .
[0027] 1.3 Dynamic threshold definition: (Using...) Criteria, upper boundary , .
[0028] 1.4 Anomaly Detection: If exist Data within the specified range is considered normal; otherwise, it is marked as abnormal data (e.g., at a certain moment). =120, =80, =10, then =110, since 120>110 is considered abnormal).
[0029] Step 2: Data Preprocessing and Dataset Partitioning 2.1 Outlier Removal: For the outlier data marked in step 1.4, fill the gaps with the mean of adjacent normal data, using the following formula: For example, abnormal data =120, its preceding normal data =78, Subsequent normal data =82, then fill with =(78+82) / 2=80.
[0030] 2.2 Training and Test Set Configuration: Select data without anomalies from the first 60 hours (total...) () as the training set; for each outlier, take the previous () After the item The 21 items in total are used as the test set, denoted as . .
[0031] Step 3: Optimize the parameters of the bidirectional LSTM network. The Adam algorithm is used to optimize the parameters of the forward and reverse LSTM networks respectively. The specific settings are as follows: 3.1 Forward LSTM Parameter Optimization 3.1.1 Initialization of First-Order Moment Estimation Second-order moment estimation ,gradient Calculated using the partial derivative of the loss function. First-order moment decay exponent. Second moment decay index The updated formula is: 3.1.2 Deviation Correction: ; 3.1.3 Parameter Update: Learning Rate Numerical stable quantity The formula is: ; 3.2 Optimization of Reverse LSTM Parameters: The process is the same as the forward LSTM, except that the parameter identifiers are replaced with reverse network-specific identifiers (e.g., ...). , ).
[0032] Step 4: Bidirectional LSTM Model Construction and Training 4.1 Construction of Forward LSTM Network: 4.1.1 Network Structure: Number of Nodes in the Input Layer (Input the first 10 data items to predict the 11th item), output the number of layer nodes. The number of hidden layer nodes is calculated using an empirical formula. Calculate, take Therefore .
[0033] 4.1.2 Gate Functions and Cell States: ; ; ; ; .
[0034] 4.2 Construction of the reverse LSTM network: The structure is the same as the forward network, but the data flow is reversed (propagating from back to front). The input is the last 10 data items of the test set, and the preceding data is predicted.
[0035] 4.3 Output Layer Fusion: The output layer input is a weighted sum of the outputs of the forward and reverse network cell units: The output activation function V is a linear function, therefore the predicted value... .
[0036] 4.4 Model Training: Import the training set, set the number of iterations to 1000, and the loss function... The weights (such as the output gate error) are adjusted through backpropagation of the error. until the loss function converges (after 500 iterations). .
[0037] Step 5: Abnormal Data Repair test set Import the trained bidirectional LSTM model and feed the predicted values into the forward network. The inverse network outputs the extrapolated values. The model directly fuses and outputs repair values. For example, a certain abnormal data corresponds to the test set. positive prediction value Reverse inference value =79, Post-fusion repair value =80.5.
[0038] Step 6: Repair Quality Assessment Calculate the error rate between the repaired value and the true value. And improve data stability (standard deviation < 2 for 5 consecutive repaired values). If the error rate > 5% or the stability does not meet the requirements, adjust the number of hidden layer nodes (e.g., increase to 10) and return to step 4 for retraining. In this embodiment, the average error rate after repair is 3.2%, and the standard deviation of stability is 1.5, which meets the requirements.
[0039] This embodiment demonstrates, through specific parameter settings and process verification, that the method can effectively repair abnormal data from ultrasonic water meters, with repair accuracy and efficiency superior to traditional methods.
[0040] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for repairing ultrasonic water meter data based on bidirectional LSTM, characterized in that, Includes the following steps: Step 1: Calculate the ultrasonic time-of-flight difference using the ultrasonic water meter's time chip to obtain the raw time series data of the ultrasonic water meter. ,in , This represents the total number of time-series datasets obtained by the ultrasonic water meter during the test period. The dynamic threshold method is used to screen outliers in the ultrasonic water meter time-series dataset. Step 2: Perform time-series data preprocessing of ultrasonic water meters to remove outlier values in the dataset, and configure the training and test sets according to the features of the LSTM model. Step 3: Optimize the parameter settings for the forward and inverse LSTM networks in the bidirectional LSTM using the adaptive moment estimation method. The specific process is as follows: Step 3.1: Combining the time series data of the ultrasonic water meter, the Adam algorithm is used to set the optimization parameters of the forward LSTM network; Step 3.2: Combining the time series data of the ultrasonic water meter, the Adam algorithm is used to set the optimization parameters of the reverse LSTM network; Step 4: Construct a bidirectional LSTM model and train it using time-series data from ultrasonic water meters. Step 5: Import the test set of ultrasonic water meter time series data into the trained bidirectional LSTM model and output... Predicted value ; Step 6: Evaluate the quality of the repaired data. Evaluation indicators include, but are not limited to, the error rate between the repaired data and the real data, and the stability of the repaired data. If the error rate exceeds the preset threshold or the stability does not meet the requirements, readjust the bidirectional LSTM model parameters and return to step 4 to retrain the model.
2. The ultrasonic water meter data repair method based on bidirectional LSTM according to claim 1, characterized in that, The processing flow for step 1 is as follows: Step 1.1: Calculate the dynamic average value of the ultrasonic water meter time-series data using the weighted moving average method. The calculation formula is as follows: in, express The dynamic average value at the specified point; 2M+1 is the period for calculating the selected data segment using the weighted moving average; This represents the weight of each item. ; The values and weights of each element are set based on the amount and characteristics of the ultrasonic water meter's time-series data. Step 1.2: Define the average weight of the selected data segment as... The average weight at point is denoted as The dynamic standard deviation of ultrasonic water meter time-series data is calculated using the weighted standard deviation method, and the formula is as follows: Step 1.3: Combining the above dynamic mean and dynamic standard deviation, adopt... The guidelines set dynamic thresholds for time-series data from ultrasonic water meters, defined as follows: in, express The upper boundary of the dynamic threshold range, express The lower boundary of the dynamic threshold range; Step 1.4: Combining the above dynamic threshold, if ,So If the data is determined to be normal, no repair is needed; or ,So The data has been identified as abnormal and needs to be repaired.
3. The ultrasonic water meter data repair method based on bidirectional LSTM according to claim 1, characterized in that, The processing flow for step 2 is as follows: Step 2.1: Remove outlier values from the ultrasonic water meter time series dataset. The determination method is based on the results of step 1.
4. Step 2.2: Based on the data characteristics of the ultrasonic water meter time series dataset and the basic requirements of the LSTM model for the training set, select a dataset of suitable duration as the training set. Based on the above anomaly detection results, select the p terms preceding the anomaly values to the q terms following the anomaly values as the test set, and denote the data in the test set as follows: ,in .
4. The ultrasonic water meter data repair method based on bidirectional LSTM according to claim 1, characterized in that, In step 3.1, the process of setting the optimization parameters of the forward LSTM network using the Adam algorithm, based on the ultrasonic water meter time-series data, is as follows: Step 3.1.1: Initialize parameters First-order moment estimation Second-order moment estimation Calculate the gradient Update the first-order moment estimate Second-order moment estimation The formula is as follows: ; in, express Time gradient; This represents the first-order moment estimate of the decay exponent; This represents the second moment estimate of the decay exponent; Step 3.1.2: Calculate the first-moment estimate with bias correction. and bias-corrected second-moment estimation The formula is as follows: ; Step 3.1.3: Update model parameters The formula is as follows: ; in, For learning rate, To prevent extremely small constants with a denominator of zero.
5. The ultrasonic water meter data repair method based on bidirectional LSTM according to claim 1, characterized in that, In step 3.2, the process of setting the optimization parameters of the reverse LSTM network using the Adam algorithm in conjunction with the ultrasonic water meter time series data is the same as in step 3.1, except that the relevant parameter identifiers are replaced with the parameter identifiers of the reverse LSTM network.
6. The ultrasonic water meter data repair method based on bidirectional LSTM according to claim 1, characterized in that, The process of constructing the bidirectional LSTM model in step 4 is as follows: Step 4.1: Construct a forward LSTM network, the process is as follows: Step 4.1.1: Create a neural network and set the number of nodes in the input layer. Number of output layer nodes Number of hidden layer nodes The relationship between the three satisfies the following empirical formula: ; Step 4.1.2: Set the input gate for the forward LSTM network Forgotten Gate and output gate Input and output functions to set the current state of the Cell unit. The output function is shown in the following formula: ; in, for Activation function For element-wise multiplication, This is the weight matrix. For bias vectors, for Input at any time, for Output at all times for Cell state at any given time; Step 4.2: Construct a reverse LSTM network. The construction process is similar to that of the forward LSTM network, but the data flow is reversed. Step 4.3: Set the input and output functions for the output layer of the bidirectional LSTM model: ; in, Indicates the input of the output layer; This represents the weights from the forward cell to the output layer; This represents the weights from the reverse Cell unit to the output layer; This represents the output activation function of the output layer; Indicates time The predicted value output by the bidirectional LSTM model; Step 4.4: Combining the above optimized parameter settings and the initial bidirectional LSTM model, import the ultrasonic water meter time series training dataset and train the bidirectional LSTM model. Step 4.4.1: Calculate the loss function for the forward LSTM network: in, Indicates time True ultrasonic value; Step 4.4.2: Adjust and optimize the weights based on the backpropagation error of the bidirectional LSTM model, defining: Step 4.4.3: Adjust and optimize the weights according to the backpropagation error of the forward LSTM network, and make corresponding adjustments to the weights of the input gate, forget gate, output gate and cell unit.
7. A data repair system for ultrasonic water meters based on bidirectional LSTM, using the ultrasonic water meter data repair method based on bidirectional LSTM as described in any one of claims 1-6, characterized in that, include: The data acquisition unit is used to acquire the ultrasonic time-of-flight difference through the ultrasonic water meter time chip to obtain the raw time series data of the ultrasonic water meter. An outlier filtering unit, connected to the data acquisition unit, is used to filter outliers in the time series dataset of ultrasonic water meters using a dynamic threshold method. The data preprocessing unit, connected to the outlier filtering unit, is used to remove outlier values from the dataset and configure the training and test sets according to the features of the LSTM model. The parameter optimization unit, connected to the data preprocessing unit, is used to optimize the parameter settings of the forward and inverse LSTM networks in the bidirectional LSTM using the adaptive moment estimation method. The model building and training unit, connected to the parameter optimization unit, is used to build a bidirectional LSTM model and train it using time-series data from ultrasonic water meters. The data repair unit, connected to the model building and training unit, is used to import the test set of the ultrasonic water meter time series into the trained bidirectional LSTM model and output the repaired predicted value. The quality assessment unit, connected to the data repair unit, is used to assess the quality of the repaired data.
8. The ultrasonic water meter data repair system based on bidirectional LSTM according to claim 7, characterized in that, The data acquisition unit includes a high-precision time measurement module for accurately measuring the time difference of flight of ultrasonic waves. This module consists of a temperature-controlled crystal clock source, a time-to-digital converter, and a signal conditioning circuit.
9. The ultrasonic water meter data repair system based on bidirectional LSTM according to claim 7, characterized in that, The outlier filtering unit, data preprocessing unit, parameter optimization unit, model building and training unit, data repair unit, and quality assessment unit are all integrated into a processor with high-performance computing capabilities. This processor adopts a multi-core architecture and has a computing speed of trillions of floating-point operations per second.
10. The ultrasonic water meter data repair system based on bidirectional LSTM according to claim 9, characterized in that, The model building and training unit also includes a model storage subunit, which is used to store the parameters and structure information of the trained bidirectional LSTM model. When the system restarts or a new repair task is started, the stored model can be directly called to perform data repair without retraining. The model parameters include the weight matrix of each layer, the bias vector and the optimizer parameters. The storage format adopts binary serialization format.