Method for evaluating health of gas meter and electronic device
Patent Information
- Application Number
- CN202611311156.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-10-27
AI Technical Summary
[0004]本申请旨在解决上述技术问题,即解决如何结合不同来源数据提高燃气表健康度的评估精度的问题
[0017]在采用上述技术方案的情况下,本申请能够获取目标燃气表的历史数据,以得到目标燃气表在预设历史时间段内的用量数据和报警数据;根据用量数据和第一卷积自动编码器,获得用量特征向量,并根据报警数据和第二卷积自动编码器,获得报警特征向量;基于预设的注意力机制网络,分别确定用量特征向量和报警特征向量对应的注意力权重,并根据注意力权重对用量特征向量和报警特征向量进行特征融合,得到综合特征向量;根据综合特征向量,确定目标燃气表当前的健康度评分。
Smart Images

Figure CN122986901A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of gas meter monitoring technology, specifically providing a method for scoring the health of a gas meter and an electronic device. Background Technology
[0002] With the continuous improvement of the intelligence level of gas meters, gas meter health assessment has become a key technical link to ensure the safe use of gas and reduce operation and maintenance costs. Through systematic analysis of gas meter operation data, the real-time health status of gas meters can be obtained, and effective early warnings can be given before failures occur, reducing safety hazards.
[0003] Most existing technologies rely on single-source data to assess the health status of gas meters. However, in actual operation, data from different sources are complementary and potentially correlated. Relying on only one type of data makes it difficult to conduct a complete and accurate health assessment. Existing technologies also include simple concatenation of gas meter data from different sources and unified input into a fully connected network for health status assessment. However, since the contribution of different data sources to the gas meter health assessment dynamically changes with operational stages, fault types, and environmental conditions, this approach ignores the differences in contribution of different data in actual fault scenarios. It lacks adaptive adjustment capabilities based on data importance, making it difficult to support dynamic, fine-grained operational and maintenance decisions. The resulting health score is also prone to deviating from the actual risk level. This not only fails to identify operational risks in a timely manner, leading to delayed replacement or repair of gas meters, but also easily results in delayed fault detection or false alarms, increasing safety hazards such as leaks and inaccurate metering. Ultimately, it fails to meet the practical needs of gas companies and users for predictive maintenance and refined management of gas meters. Therefore, a technical solution is urgently needed to solve the above-mentioned technical problems. Summary of the Invention
[0004] This application aims to solve the aforementioned technical problem, namely, how to improve the accuracy of gas meter health assessment by combining data from different sources.
[0005] In a first aspect, this application provides a method for scoring the health of a gas meter, comprising: Acquire historical data of the target gas meter, including the gas consumption data and alarm data of the target gas meter within a preset historical time period; Based on the usage data and the first convolutional autoencoder, a usage feature vector is obtained, and based on the alarm data and the second convolutional autoencoder, an alarm feature vector is obtained. Based on a preset attention mechanism network, attention weights corresponding to the usage feature vector and alarm feature vector are determined respectively, and feature fusion is performed on the usage feature vector and alarm feature vector according to the attention weights to obtain a comprehensive feature vector. Based on the comprehensive feature vector, the current health score of the target gas meter is determined.
[0006] In one technical solution of the above-mentioned gas meter health rating method, obtaining the usage feature vector based on the usage data and the first convolutional autoencoder includes: The usage data is preprocessed to form a usage multidimensional feature matrix, which is a feature matrix composed of a time dimension and a usage feature dimension. Based on the first convolutional autoencoder, feature extraction and feature enhancement are performed on the usage multidimensional feature matrix to obtain the usage enhanced feature matrix; The usage enhancement feature matrix is flattened to expand it into a one-dimensional vector, thus obtaining the usage feature vector.
[0007] In one technical solution of the above-mentioned gas meter health rating method, the preprocessing of the usage data to form a multi-dimensional usage feature matrix includes: The usage data is normalized to map all the usage data to a preset numerical range; Based on the normalization processing results, the gas consumption status of the target gas meter within a preset time period is determined. The gas consumption status includes at least one of the following: average gas consumption, maximum gas consumption, gas consumption fluctuation value, and gas consumption change range. Based on the gas usage of the target gas meter, the data of the usage characteristic dimension are determined to form a multi-dimensional usage characteristic matrix.
[0008] In one technical solution of the above-mentioned gas meter health rating method, obtaining the alarm feature vector based on the alarm data and the second convolutional autoencoder includes: The alarm data is preprocessed to form an alarm multidimensional feature matrix, which is a feature matrix composed of a time dimension and an alarm feature dimension. Based on the second convolutional autoencoder, feature extraction and feature enhancement are performed on the alarm multidimensional feature matrix to obtain the alarm enhancement feature matrix; The alarm enhancement feature matrix is flattened to expand it into a one-dimensional vector, thus obtaining the alarm feature vector.
[0009] In one technical solution of the above-mentioned gas meter health rating method, the preprocessing of the alarm data to form an alarm multidimensional feature matrix includes: Based on the alarm data, at least one alarm type is determined, wherein the alarm type is a type used to indicate the cause of the gas meter malfunction; Based on the alarm data, determine the occurrence of alarm events for each alarm type within a preset time granularity. The occurrence status includes at least one of the following: the number of times the alarm event occurred, the duration, and the frequency of occurrence. Based on the occurrence of the alarm events, data on alarm feature dimensions are determined to construct a multi-dimensional alarm feature matrix.
[0010] In one technical solution of the above-mentioned gas meter health rating method, the attention mechanism network includes at least one fully connected layer and an activation function; The network based on a preset attention mechanism determines the attention weights corresponding to the usage feature vector and the alarm feature vector, respectively, including: Based on the usage feature vector and the alarm feature vector, a joint feature is obtained; Based on the at least one fully connected layer, the joint features are nonlinearly transformed to obtain the alarm raw attention score and the dosage raw attention score. Based on the activation function, the original attention score of the alarm and the original attention score of the usage are normalized to obtain the first attention weight corresponding to the usage feature vector and the second attention weight corresponding to the alarm feature vector.
[0011] In one technical solution of the above-mentioned gas meter health rating method, the step of fusing the usage feature vector and the alarm feature vector according to the attention weight to obtain a comprehensive feature vector includes: Multiply the first attention weight and the usage feature vector to obtain the usage weighted feature vector; Multiply the second attention weight and the alarm feature vector to obtain the alarm weighted feature vector; The usage-weighted feature vector and the alarm-weighted feature vector are superimposed or concatenated to obtain a comprehensive feature vector.
[0012] In one technical solution of the above-mentioned gas meter health rating method, determining the current health rating of the target gas meter based on the comprehensive feature vector includes: Based on a pre-trained fully connected neural network, the current health score of the target gas meter is determined according to the comprehensive feature vector.
[0013] In one technical solution of the above-mentioned gas meter health rating method, the fully connected neural network includes multiple fully connected layers and an output layer connected after the last fully connected layer; determining the current health rating of the target gas meter based on the comprehensive feature vector includes: Based on the multi-layer fully connected layers, the comprehensive feature vector is subjected to layer-by-layer feature mapping and information fusion to obtain an initial health score; Based on the output layer, the final health score is determined according to the initial health score. The output layer is an output layer with the Sigmoid function as the activation function.
[0014] In one technical solution of the above-mentioned gas meter health rating method, the method further includes: Obtain multi-source data of pre-labeled gas meters to obtain a training dataset. The multi-source data is data containing gas meter usage data and alarm data, labeled with gas meter health scores. Based on the training dataset, the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network are jointly trained end-to-end.
[0015] In one technical solution of the above-mentioned gas meter health rating method, the step of performing end-to-end joint training of the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network based on the training dataset includes: Based on the training dataset, obtain the health score result of each training data after passing through the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network; Based on a preset loss function, the loss value between the health score result and the gas meter health score used as a label is determined; Based on the backpropagation algorithm and the loss value, determine the parameter gradient of the loss function with respect to each model parameter in the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network; Based on the parameter gradient and optimizer, each model parameter is updated with the loss value as the objective until the loss value converges, resulting in the trained first convolutional autoencoder, second convolutional autoencoder, attention mechanism network, and fully connected neural network.
[0016] In a second aspect, this application provides an electronic device, the system comprising: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores a computer program, which, when executed by the at least one processor, implements the gas meter health rating method described in the above technical solution.
[0017] By adopting the above technical solution, this application can obtain historical data of the target gas meter to obtain the consumption data and alarm data of the target gas meter within a preset historical time period; obtain the consumption feature vector based on the consumption data and the first convolutional autoencoder, and obtain the alarm feature vector based on the alarm data and the second convolutional autoencoder; determine the attention weights corresponding to the consumption feature vector and the alarm feature vector based on the preset attention mechanism network, and perform feature fusion on the consumption feature vector and the alarm feature vector according to the attention weights to obtain a comprehensive feature vector; determine the current health score of the target gas meter based on the comprehensive feature vector.
[0018] Through the above configuration, this application utilizes a first convolutional autoencoder and a second convolutional autoencoder to extract and enhance features from gas meter usage data and alarm data, respectively. This allows for targeted leverage of the distribution characteristics of the convolutional autoencoder, improving the extraction quality of different types of feature data and enabling deep feature mining from multi-source data. Furthermore, it leverages the dynamic weighted fusion capability of the attention mechanism network to adaptively allocate attention weights to alarm feature vectors and usage feature vectors based on data contribution, enhancing the effectiveness of multi-source data fusion and ultimately achieving accurate quantitative scoring of gas meter health. Attached Figure Description
[0019] The preferred embodiments of this application are described below with reference to the accompanying drawings, in which: Figure 1 This is a schematic flowchart of the main steps of a gas meter health rating method according to an embodiment of this application; Figure 2 This is a schematic flowchart illustrating the main steps of obtaining a dosage feature vector according to one embodiment of this application. Figure 3 This is a schematic flowchart of the main steps for obtaining an alarm feature vector according to one embodiment of the present application. Figure 4 This is a flowchart illustrating the main steps of determining attention weights according to one embodiment of this application. Figure 5 This is a schematic flowchart illustrating the main steps of feature fusion according to one embodiment of this application. Figure 6 This is a schematic flowchart of the main steps of a joint training process according to one embodiment of the present application. Figure 7This is a schematic flowchart illustrating the main steps of operating an electronic device according to one embodiment of the present application. Figure 8 This is a schematic flowchart of the main steps of a gas meter health rating method according to one embodiment of the present application. Detailed Implementation
[0020] Some embodiments of this application are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of this application and are not intended to limit the scope of protection of this application.
[0021] In the description of this application, "module" and "processor" can include hardware, software, or a combination of both. A module can include hardware circuitry, various suitable sensors, communication ports, memory, and may also include software components, such as program code, or a combination of software and hardware. A processor can be a central processing unit, microprocessor, image processor, digital signal processor, or any other suitable processor. The processor has data and / or signal processing capabilities. The processor can be implemented in software, in hardware, or a combination of both. Computer-readable storage media includes any suitable medium capable of storing program code, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The terms "at least one A or B" or "at least one of A and B" have a similar meaning to "A and / or B" and can include only A, only B, or A and B.
[0022] See appendix Figure 1 , Figure 1 This is a schematic flowchart illustrating the main steps of a gas meter health rating method according to an embodiment of this application. Figure 1 As shown, the gas meter health rating method in this application embodiment mainly includes the following steps S101 to S103.
[0023] Step S101: Obtain historical data of the target gas meter.
[0024] Step S102: Obtain the usage feature vector based on the usage data and the first convolutional autoencoder, and obtain the alarm feature vector based on the alarm data and the second convolutional autoencoder.
[0025] Step S103: Based on the preset attention mechanism network, determine the attention weights corresponding to the usage feature vector and the alarm feature vector respectively, and perform feature fusion on the usage feature vector and the alarm feature vector according to the attention weights to obtain the comprehensive feature vector.
[0026] Step S104: Determine the current health score of the target gas meter based on the comprehensive feature vector.
[0027] The "historical data" in step S101 may include the usage data and alarm data of the target gas meter within a preset historical time period.
[0028] Here, usage data refers to the total volume of gas consumed by the target gas meter within a preset time granularity (weekly or daily). For example, usage data can specifically be time-series data formed from gas usage data of the previous week or the previous day.
[0029] Among them, alarm data refers to the type, number of occurrences, and duration of alarm events of the target gas meter within a preset time granularity.
[0030] In step S102, the “convolutional autoencoder” is an unsupervised deep learning model that uses convolutional layers and pooling layers to replace fully connected layers. It can combine the local feature extraction capability of convolutional neural networks (CNNs) with the unsupervised feature learning capability of autoencoders (AEs) to automatically learn low-dimensional, compact, and representative feature representations from high-dimensional, sparse alarm feature matrices.
[0031] Among them, the attention mechanism network refers to a neural network structure in deep learning that imitates the selective focusing characteristics of humans. It is mainly used to adaptively adjust the weights of each data source according to the feature distribution of the current input data, so that the features that are more valuable for judging health status receive higher attention, and the final accuracy of the gas meter health score is greatly improved.
[0032] The health score refers to a numerical value used to represent the health status of the target gas meter. This score ranges from [0,1]. A score closer to 1 indicates a better health status for the gas meter, with all operating indicators normal and no significant potential malfunctions. A score closer to 0 indicates a more serious potential malfunction or that the gas meter has already malfunctioned, requiring timely repair or replacement.
[0033] In one implementation, see Appendix Figure 2 , attached Figure 2 This is a schematic flowchart illustrating the main steps of obtaining a usage feature vector according to one embodiment of this application. Figure 2 As shown, step S102, "obtaining the usage feature vector based on the usage data and the first convolutional autoencoder," can further include steps S1021 to S1023: Step S1021: Preprocess the usage data to form a multidimensional feature matrix of usage.
[0034] Step S1022: Based on the first convolutional autoencoder, perform feature extraction and feature enhancement on the multidimensional feature matrix to obtain the enhanced feature matrix.
[0035] Step S1023: Flatten the usage enhancement feature matrix to expand it into a one-dimensional vector, thus obtaining the usage feature vector.
[0036] The step S1021, "preprocessing the usage data", can specifically include normalizing the collected raw usage data to eliminate the influence of dimensions and various external factors such as seasonal changes, differences in peak gas consumption, and holidays.
[0037] In step S1021, the "multi-dimensional feature matrix of gas consumption" is a two-dimensional or three-dimensional feature matrix, which may include feature vectors of time dimension and gas consumption feature dimension. The gas consumption feature dimension may include, but is not limited to, features such as average daily gas consumption, peak gas consumption, gas consumption fluctuation value, and gas consumption change rate.
[0038] As an example, the tensor shape of the multidimensional feature matrix input to the first convolutional autoencoder can be (time dimension, multidimensional feature dimension, number of channels); where the number of channels refers to the number of feature dimensions of the input data, that is, the number of feature types contained in the multidimensional feature dimension.
[0039] In step S1022, the "first convolutional autoencoder" is specifically used to extract and enhance features from the multidimensional feature matrix. Specifically, it may include an input layer, a convolutional layer, a pooling layer, a deconvolutional layer, and an output layer.
[0040] Specifically, step S1022 may include: the first convolutional autoencoder receives the preprocessed multi-dimensional gas consumption feature matrix through the input layer, and then extracts local temporal features from the multi-dimensional gas consumption feature matrix through the convolutional layer, such as the rising or falling trend of gas consumption over multiple consecutive days, and the abrupt change point of gas consumption within a specific time window; then, the local temporal features are reduced in dimensionality through the pooling layer to retain key trend information; finally, the multi-dimensional gas consumption feature matrix is reconstructed and enhanced through the deconvolutional layer, so that the model learns the normal change pattern of gas consumption under unsupervised conditions, and outputs the enhanced gas consumption feature matrix through the output layer as a health feature related to gas meter consumption.
[0041] Through the first convolutional automatic encoder in the above embodiments, the matrix can enhance the anti-interference ability and fault sensitivity of the usage feature matrix, and can more clearly reflect the intrinsic correlation between abnormal usage fluctuations and the health status of the gas meter.
[0042] In step S1023, "flattening" refers to the operation of expanding the multidimensional feature matrix into a one-dimensional vector by row or column. This process preserves all the original information in the augmented feature matrix while allowing it to participate in subsequent calculations in a more concise vector form.
[0043] In step S1021, the “multidimensional feature matrix of usage” is a feature matrix composed of the time dimension and the usage feature dimension.
[0044] In one embodiment, step S1021 may further include steps S10211 to S10213: Step S10211: Normalize the usage data to map all the usage data to a preset numerical range.
[0045] Step S10212: Based on the normalization processing results, determine the gas usage of the target gas meter within the preset time period.
[0046] Step S10213: Based on the gas usage of the target gas meter, determine the data of the usage characteristic dimension to form a multi-dimensional usage characteristic matrix.
[0047] In step S10211, the "normalization process" can use the Z-score normalization method or the Min-Max normalization method to uniformly map the usage features of different magnitudes and units to a similar numerical range, which facilitates model training and feature extraction.
[0048] In step S10212, the "preset time period" can be one month, one week, or one day; the "gas usage" can include at least one of the following: average gas usage, maximum gas usage, gas usage fluctuation value, and gas usage change range.
[0049] In one implementation, see Appendix Figure 3 , attached Figure 3 This is a schematic flowchart illustrating the main steps of obtaining an alarm feature vector according to one embodiment of this application. Figure 3 As shown, step S102, "obtaining the alarm feature vector based on the alarm data and the second convolutional autoencoder," can further include steps S1024 to S1026: Step S1024: Preprocess the alarm data to form an alarm multidimensional feature matrix.
[0050] Step S1025: Based on the second convolutional autoencoder, perform feature extraction and feature enhancement on the alarm multidimensional feature matrix to obtain the alarm enhancement feature matrix.
[0051] Step S1026: Flatten the alarm enhancement feature matrix to expand it into a one-dimensional vector, thus obtaining the alarm feature vector.
[0052] In step S1024, the "alarm multidimensional feature matrix" is a feature matrix composed of a time dimension and an alarm feature dimension. The alarm feature dimension refers to the total number of alarm categories that the gas meter can generate.
[0053] In step S1025, the "second convolutional autoencoder" is specifically used for deep feature extraction and feature enhancement of the alarm multidimensional feature matrix.
[0054] The second convolutional autoencoder may include an input layer, a convolutional layer, a pooling layer, a deconvolutional layer, and an output layer.
[0055] Specifically, step S1025 may include: the second convolutional autoencoder receives the preprocessed alarm multidimensional feature matrix using the input layer. The tensor shape of the alarm multidimensional feature matrix can be (time dimension, alarm type dimension, number of channels), where the number of channels can be set to 1 when using a single-source input; then, based on the convolution kernel in the convolutional layer, it performs sliding calculations on the alarm multidimensional feature matrix through multiple sets of convolution operations to extract local correlation features in the alarm multidimensional feature matrix. After the convolution operation, nonlinearity is introduced through the activation function of the convolutional layer to output the feature map of the alarm multidimensional feature matrix; then, the feature map output by the convolutional layer is reduced in dimensionality using the max pooling operation of the pooling layer; the low-dimensional features obtained after pooling are deconvolved (transposed convolution) using the deconvolutional layer to reconstruct and enhance the features; finally, based on the output layer, the attribute-enhanced alarm feature matrix is output.
[0056] Max pooling refers to taking the maximum value within the pooling window as the output, which is used to significantly reduce the size of the feature map while retaining the most critical features, reducing the amount of subsequent computation, and enhancing the robustness of the model to local translation. The role of the deconvolution layer is to gradually restore the compressed low-dimensional features to the size of the original input, and learn the most representative features by reconstructing the error constraint encoder, so as to retain the most important information for the input data, thereby achieving feature enhancement.
[0057] In one possible implementation, the convolution kernel in the convolutional layer can be a 3×3 kernel, so as to capture the correlation between different alarm types in adjacent time periods within a smaller receptive field, such as the temporal correlation between low battery alarms and valve failure alarms over multiple consecutive days.
[0058] In one implementation, the activation function in the convolutional layer can be the Rectified Linear Unit (ReLU) function as shown in Equation (1), which is computationally simple and effectively avoids the gradient vanishing problem, making the training of deep networks more stable: (1) Where x is the linear transformation output value of the convolution operation.
[0059] Through the second convolutional autoencoder in the above embodiments, the alarm enhancement feature matrix can have higher feature purity and stronger expressive power, thereby accurately reflecting the health characteristics related to gas meter alarms, such as the changing trend of alarm frequency, the co-occurrence pattern among multiple types of alarms, and the temporal evolution of alarm intensity.
[0060] The "flattening" process in step S1026 is the same as the "flattening" process in step S1023, and will not be described in detail here.
[0061] In one embodiment, step S1024 may further include steps S10241 to S10243: Step S10241: Determine at least one alarm type based on the alarm data.
[0062] Step S10242: Based on the alarm data, determine the occurrence of alarm events for each alarm type within a preset time granularity.
[0063] Step S10243: Determine the alarm feature dimension data based on the occurrence of alarm events to construct an alarm multidimensional feature matrix.
[0064] In step S10241, the "alarm type" indicates the type of malfunction of the gas meter. For example, alarm types may include, but are not limited to, low battery alarm (indicating insufficient battery power), leak alarm (detecting a risk of gas leak), abnormal start / stop alarm (recording abnormal behavior of the gas meter frequently opening or closing), valve malfunction alarm (valve jamming or unable to close properly), and magnetic interference alarm (detecting external magnetic field interference with metering accuracy). For example, the alarm count can be the number of times each type of alarm event occurred and its duration in the previous week or day.
[0065] The “occurrence status” in step S10242 includes at least one of the following data: the number of times the alarm event occurred, the duration, and the frequency of occurrence.
[0066] In one implementation, the "attention mechanism network" in step S103 may include at least one fully connected layer and an activation function.
[0067] In this embodiment, please refer to the appendix. Figure 4 , Figure 4 This is a schematic flowchart illustrating the main steps of determining attention weights according to one embodiment of this application. Figure 4 As shown, step S103, "determining the attention weights corresponding to the usage feature vector and the alarm feature vector based on the preset attention mechanism network," can further include steps S1031 to S1033: Step S1031: Obtain the joint feature based on the usage feature vector and the alarm feature vector.
[0068] Step S1032: Perform a nonlinear transformation on the joint features based on at least one fully connected layer to obtain the alarm original attention score and the dosage original attention score.
[0069] Step S1033: Based on the activation function, normalize the original attention score of the alarm and the original attention score of the usage to obtain the first attention weight corresponding to the usage feature vector and the second attention weight corresponding to the alarm feature vector.
[0070] Specifically, step S1031 may include: concatenating the usage feature vector and the alarm feature vector to form a joint feature containing the two types of data.
[0071] Specifically, step S1032 may include: performing a nonlinear transformation on the joint feature through one or more fully connected networks to output two unnormalized scores, which are used as the original attention scores for the alarm feature and the usage feature, respectively, namely the original alarm attention score and the original usage attention score.
[0072] Specifically, the "activation function" in step S1033 can be a normalized exponential function (Softmax Function, Softmax), which normalizes the original attention score of the alarm number and the original attention score of the usage into a probability distribution to obtain the final attention weight.
[0073] In step S1033, the specific values of the weights are automatically learned by the attention mechanism network through backpropagation during training and do not need to be manually set. If the first attention weight is denoted as ω1 and the second attention weight is denoted as ω2, then the first attention weight and the second attention weight satisfy ω1 + ω2 = 1, and ω1 and ω2 both belong to the interval [0, 1].
[0074] In specific practical application scenarios, when alarm messages occur frequently and are highly correlated with known fault modes, the attention mechanism network will automatically increase ω1; when the usage data shows obvious abnormal fluctuations (such as a sudden drop or rise in gas consumption) and alarm messages are relatively few, the attention mechanism network will automatically increase ω2.
[0075] In one implementation, see Appendix Figure 5 , Figure 5 This is a schematic flowchart illustrating the main steps of feature fusion according to one embodiment of this application. For example... Figure 5 As shown, step S103, "fusing the usage feature vector and alarm feature vector according to the attention weight to obtain a comprehensive feature vector," can further include steps S1034 to S1036: Step S1034: Multiply the first attention weight and the usage feature vector to obtain the usage weighted feature vector.
[0076] Step S1035: Multiply the second attention weight and the alarm feature vector to obtain the alarm weighted feature vector.
[0077] Step S1036: Superimpose or concatenate the usage-weighted feature vector and the alarm-weighted feature vector to obtain a comprehensive feature vector.
[0078] In step S1036, "overlay" refers to adding the two weighted feature vectors element by element; "concatenation" refers to joining the two weighted feature vectors end to end.
[0079] In one embodiment, step S104 may further include step S1041: Step S1041: Based on the pre-trained fully connected neural network, determine the current health score of the target gas meter according to the comprehensive feature vector.
[0080] Among them, a fully connected neural network (FCNN) refers to an artificial neural network in which all neurons in each layer are connected to all neurons in the adjacent layers, there are no connections between neurons in the same layer, and data is propagated unidirectionally from the input layer to the output layer without feedback.
[0081] In one implementation, a fully connected neural network may include multiple fully connected layers and an output layer connected after the last fully connected layer.
[0082] In one embodiment, step S1041 may further include steps S10411 and S10412: Step S10411: Based on a multi-layer fully connected layer, perform layer-by-layer feature mapping and information fusion on the comprehensive feature vector to obtain the initial health score.
[0083] Step S10412: Based on the output layer, determine the final health score according to the initial health score.
[0084] As an example, the fully connected neural network in step S10411 can be configured with 2 to 3 fully connected layers to perform layer-by-layer feature mapping and information fusion on the input comprehensive feature vector. The calculation formula for each fully connected layer is as follows: Formula (2): (2) The activation function can be the ReLU function, which is not only simple to calculate and has a constant derivative (1 on the positive half-axis), but also can effectively alleviate the gradient vanishing problem. It also has certain sparse activation characteristics, which helps to improve the generalization ability of the network.
[0085] In other possible implementations, the more the number of fully connected network layers increases, the more the model can learn to abstract from low-level features to high-level semantics, and can also establish a complex nonlinear mapping relationship between comprehensive features and health scores.
[0086] In step S10412, the output layer can be an output layer with the Sigmoid function as the activation function. The mathematical form of the Sigmoid function is as follows: (3) (3) Where x is the output value of the last fully connected layer, and the value of f(x) is in the range [0,1].
[0087] In one embodiment, the method may further include steps S105 and S106: Step S105: Obtain multi-source data from pre-labeled gas meters to obtain a training dataset.
[0088] Step S106: Based on the training dataset, perform end-to-end joint training on the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network.
[0089] Among them, multi-source data is data containing gas meter usage data and alarm data, tagged with gas meter health scores.
[0090] In one implementation, the gas meter health rating label for the training data can be obtained through expert experience annotation, mapping of historical operation and maintenance records, or laboratory calibration, and the value range of the label is [0, 1], where 0 represents complete failure and 1 represents complete health.
[0091] In one implementation, see Appendix Figure 6 , Figure 6 This is a schematic flowchart illustrating the main steps of a joint training process according to one embodiment of this application. Figure 6 As shown, step S106 may further include steps S1061 to S1064: Step S1061: Based on the training dataset, obtain the health score result of each training data after passing through the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network.
[0092] Step S1062: Determine the loss value between the health score result and the gas meter health score used as a label, based on the preset loss function.
[0093] Step S1063: Based on the backpropagation algorithm and the loss value, determine the parameter gradient of the loss function with respect to each model parameter in the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network.
[0094] Step S1064: Based on the parameter gradient and optimizer, update each model parameter with the loss value as the objective until the loss value converges, and obtain the trained first convolutional autoencoder, second convolutional autoencoder, attention mechanism network, and fully connected neural network.
[0095] In step S1061, the loss function can be the mean square error (MSE). By minimizing the MSE, the model during training can map the input multi-source data to a score output that is as close as possible to the label. Specifically, this loss function can be expressed as formula (4): (4) Where MSE is the mean squared error (i.e., the loss value), N is the number of health score results, x is the health score result, and y is the health score of the gas meter used as a label.
[0096] In step S1063, the “parameter gradient” refers to the vector composed of the partial derivatives of the loss function with respect to each parameter. This vector can represent the rate and direction of loss change caused by small changes in the model parameters, and can guide the model parameters to be updated along the negative gradient direction to minimize the loss.
[0097] The updated model parameters in step S1064 may include: the kernel weights and biases of the first and second convolutional autoencoders, the weights and biases of the fully connected layers in the attention mechanism network, and the weights and biases of each layer in the fully connected neural network.
[0098] In one implementation, the optimizer in step S1064 may specifically be an Adaptive Moment Estimation (Adam) optimizer. For example, steps S1063 and S1064 may specifically include: during training, calculating the gradient of the loss function with respect to each model parameter using the backpropagation algorithm, and updating the parameters along the gradient descent direction using the Adam optimizer.
[0099] In step S1064, model convergence can be determined based on the training epochs and the loss value obtained from the loss function. For example, when the loss value no longer decreases significantly and tends to converge, or when the preset maximum number of training epochs is reached, the model training can be considered complete.
[0100] In one implementation, the trained first convolutional autoencoder, second convolutional autoencoder, attention mechanism network, and fully connected neural network can be deployed to an actual gas meter health monitoring system or electronic equipment used for gas meter health monitoring to perform online health assessments on real-time collected alarm information and usage data, thereby achieving early warning and predictive maintenance of gas meter malfunctions.
[0101] For a specific implementation method in a particular application scenario, please refer to [the relevant documentation / reference]. Figure 7 and Figure 8 , Figure 7 This is a schematic flowchart illustrating the main steps of operating an electronic device according to one embodiment of the present application. Figure 8 This is a schematic flowchart illustrating the main steps of a gas meter health rating method according to one embodiment of this application. Figure 8 As shown, this method specifically includes steps S201 to S205: Step S201: Obtain the usage characteristic data and alarm characteristic data of the target gas meter.
[0102] This embodiment can be applied to electronic devices specifically designed for gas meter health monitoring, such as... Figure 7 As shown, the electronic device may include a data acquisition and preprocessing module, an alarm-level CAE1 module, a usage-level CAE2 module, a category-level attention mechanism network, and a fully connected neural network.
[0103] The data acquisition and preprocessing module can collect historical data of the target gas meter in real time over a recent period to obtain usage characteristic data and alarm characteristic data.
[0104] Among them, the usage characteristic data is equivalent to the "usage multidimensional characteristic matrix" in the above embodiment; the alarm characteristic data can be equivalent to the "alarm multidimensional characteristic matrix" in the above embodiment.
[0105] Step S202: Input the alarm feature data into the alarm layer CAE1 module to obtain the learned alarm feature data.
[0106] In this context, CAE1 in the alarm-level CAE1 module is equivalent to the "second convolutional autoencoder" in the above embodiment; "learning alarm feature data" can be equivalent to the "alarm enhancement feature matrix" in the above embodiment.
[0107] Step S203: Input the usage characteristic data into the usage level CAE2 module to obtain the learned usage characteristic data.
[0108] In this context, CAE2 in the usage-level CAE2 module is equivalent to the "first convolutional autoencoder" in the above embodiment; "learning usage feature data" can be equivalent to the "usage enhancement feature matrix" in the above embodiment.
[0109] Among them, CAE2 maintains the same overall structure as CAE1, both using the same convolutional autoencoder framework. However, the specific parameter configurations can be adaptively adjusted according to the characteristics of the usage data. For example, the number of convolutional kernels, the size of the pooling window, or the number of network layers can be adjusted to better capture the trend features and abnormal fluctuation patterns in the usage data.
[0110] This implementation method extracts enhanced features from alarm feature data and usage feature data in their respective dimensions through parallel processing of CAE1 and CAE2, constructing a two-dimensional feature system. This solves the problem of insufficient feature extraction from single data sources, realizes deep feature mining of multi-source data, and provides high-quality input for subsequent multi-source feature fusion.
[0111] Step S204: Input the learned alarm feature data and learned usage feature data into the category-level attention mechanism network to obtain the comprehensive feature vector.
[0112] The final comprehensive feature vector can be obtained through steps such as flattening, attention weight calculation, and feature fusion.
[0113] For example, step S204 may include the following steps S2041 to S2043: Step S2041: Flatten the learning alarm feature data and learning usage feature data.
[0114] Step S2042: Input the flattened learning alarm feature data and learning usage feature data into the category-level attention mechanism network, and calculate the attention weights of the two types of feature data.
[0115] Step S2043: Multiply the learned alarm feature data and learned usage feature data by the corresponding attention weights respectively to obtain the weighted alarm feature vector and usage feature vector. Superimpose or concatenate the two weighted feature vectors to form the final comprehensive feature vector.
[0116] In particular, through the above step S204, the comprehensive feature vector can not only integrate the key features in alarm information and dosage information, but also highlight the role of high contribution features and suppress the interference of low contribution or noise features through the adjustment of attention weight, thereby providing more accurate feature input for subsequent health scoring.
[0117] Step S205: Input the comprehensive feature vector into the fully connected neural network to obtain the health score of the target gas meter.
[0118] The fully connected neural network can further map, fuse, and nonlinearly transform the comprehensive feature vector to ultimately output the health score of the gas meter.
[0119] Through the above embodiments, this application utilizes a first convolutional autoencoder and a second convolutional autoencoder to extract and enhance features from gas meter usage data and alarm data, respectively. This allows for targeted leverage of the distribution characteristics of the convolutional autoencoder, improving the extraction quality of different types of feature data and enabling deep feature mining from multi-source data. Furthermore, it leverages the dynamic weighted fusion capability of the attention mechanism network to adaptively allocate attention weights to alarm feature vectors and usage feature vectors based on data contribution, enhancing the effectiveness of multi-source data fusion and ultimately achieving accurate quantitative scoring of gas meter health.
[0120] It should be noted that although the steps in the above embodiments are described in a specific order, those skilled in the art will understand that in order to achieve the effect of this application, different steps do not necessarily have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders. These adjusted solutions are equivalent to the technical solutions described in this application and therefore will also fall within the protection scope of this application.
[0121] Those skilled in the art will understand that all or part of the processes in the method of the above-described embodiment can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable storage medium can include any entity or device capable of carrying the computer program code, a medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0122] Another aspect of this application provides a computer-readable storage medium.
[0123] In one embodiment of a computer-readable storage medium according to this application, the computer-readable storage medium can be configured to store a program that performs the gas meter health scoring method of the above-described method embodiments. This program can be loaded and run by a processor to implement the gas meter health scoring method. For ease of explanation, only the parts related to the embodiments of this application are shown; for specific technical details not disclosed, please refer to the method section of the embodiments of this application. The computer-readable storage medium can be a storage device comprising various electronic devices. Optionally, in the embodiments of this application, the computer-readable storage medium is a non-transitory computer-readable storage medium.
[0124] Another aspect of this application provides an electronic device.
[0125] In one embodiment of an electronic device according to this application, the electronic device may include a multimodal sensing device, at least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program that, when executed by the at least one processor, implements the gas meter health scoring method described in any of the above embodiments.
[0126] In one embodiment, the electronic device may specifically be a gas meter, a server, or an edge device, which can realize the health monitoring of the gas meter by implementing the gas meter health scoring method described in any of the above embodiments.
[0127] The technical solutions of this application have been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of this application is obviously not limited to these specific embodiments. Without departing from the principles of this application, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of this application.
Claims
1. A method for scoring the health of a gas meter, characterized in that, The method includes: Acquire historical data of the target gas meter, including the gas consumption data and alarm data of the target gas meter within a preset historical time period; Based on the usage data and the first convolutional autoencoder, a usage feature vector is obtained, and based on the alarm data and the second convolutional autoencoder, an alarm feature vector is obtained. Based on a preset attention mechanism network, attention weights corresponding to the usage feature vector and alarm feature vector are determined respectively, and feature fusion is performed on the usage feature vector and alarm feature vector according to the attention weights to obtain a comprehensive feature vector. Based on the comprehensive feature vector, the current health score of the target gas meter is determined.
2. The gas meter health rating method according to claim 1, characterized in that, The step of obtaining the usage feature vector based on the usage data and the first convolutional autoencoder includes: The usage data is preprocessed to form a usage multidimensional feature matrix, which is a feature matrix composed of a time dimension and a usage feature dimension. Based on the first convolutional autoencoder, feature extraction and feature enhancement are performed on the usage multidimensional feature matrix to obtain the usage enhanced feature matrix; The usage enhancement feature matrix is flattened to expand it into a one-dimensional vector, thus obtaining the usage feature vector.
3. The gas meter health rating method according to claim 2, characterized in that, The preprocessing of the usage data to construct a multidimensional feature matrix of usage includes: The usage data is normalized to map all the usage data to a preset numerical range; Based on the normalization processing results, the gas consumption status of the target gas meter within a preset time period is determined. The gas consumption status includes at least one of the following: average gas consumption, maximum gas consumption, gas consumption fluctuation value, and gas consumption change range. Based on the gas usage of the target gas meter, the data of the usage characteristic dimension are determined to form a multi-dimensional usage characteristic matrix.
4. The gas meter health rating method according to claim 1, characterized in that, The step of obtaining the alarm feature vector based on the alarm data and the second convolutional autoencoder includes: The alarm data is preprocessed to form an alarm multidimensional feature matrix, which is a feature matrix composed of a time dimension and an alarm feature dimension. Based on the second convolutional autoencoder, feature extraction and feature enhancement are performed on the alarm multidimensional feature matrix to obtain the alarm enhancement feature matrix; The alarm enhancement feature matrix is flattened to expand it into a one-dimensional vector, thus obtaining the alarm feature vector.
5. The gas meter health rating method according to claim 4, characterized in that, The preprocessing of the alarm data to form a multi-dimensional alarm feature matrix includes: Based on the alarm data, at least one alarm type is determined, wherein the alarm type is a type used to indicate the cause of the gas meter malfunction; Based on the alarm data, determine the occurrence of alarm events for each alarm type within a preset time granularity. The occurrence status includes at least one of the following: the number of times the alarm event occurred, the duration, and the frequency of occurrence. Based on the occurrence of the alarm events, data on alarm feature dimensions are determined to construct a multi-dimensional alarm feature matrix.
6. The gas meter health rating method according to claim 1, characterized in that, The attention mechanism network includes at least one fully connected layer and an activation function; The network based on a preset attention mechanism determines the attention weights corresponding to the usage feature vector and the alarm feature vector, respectively, including: Based on the usage feature vector and the alarm feature vector, a joint feature is obtained; Based on the at least one fully connected layer, the joint features are nonlinearly transformed to obtain the alarm raw attention score and the dosage raw attention score. Based on the activation function, the original attention score of the alarm and the original attention score of the usage are normalized to obtain the first attention weight corresponding to the usage feature vector and the second attention weight corresponding to the alarm feature vector.
7. The gas meter health rating method according to claim 6, characterized in that, The step of fusing the usage feature vector and the alarm feature vector according to the attention weight to obtain a comprehensive feature vector includes: Multiply the first attention weight and the usage feature vector to obtain the usage weighted feature vector; Multiply the second attention weight and the alarm feature vector to obtain the alarm weighted feature vector; The usage-weighted feature vector and the alarm-weighted feature vector are superimposed or concatenated to obtain a comprehensive feature vector.
8. The gas meter health rating method according to claim 1, characterized in that, Determining the current health score of the target gas meter based on the comprehensive feature vector includes: Based on a pre-trained fully connected neural network, the current health score of the target gas meter is determined according to the comprehensive feature vector.
9. The health rating method for gas meters according to claim 8, characterized in that, The fully connected neural network includes multiple fully connected layers and an output layer connected after the last fully connected layer; determining the current health score of the target gas meter based on the comprehensive feature vector includes: Based on the multi-layer fully connected layers, the comprehensive feature vector is subjected to layer-by-layer feature mapping and information fusion to obtain an initial health score; Based on the output layer, the final health score is determined according to the initial health score. The output layer is an output layer with the Sigmoid function as the activation function.
10. The gas meter health rating method according to claim 8, characterized in that, The method further includes: Obtain multi-source data of pre-labeled gas meters to obtain a training dataset. The multi-source data is data containing gas meter usage data and alarm data, labeled with gas meter health scores. Based on the training dataset, the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network are jointly trained end-to-end.
11. The gas meter health rating method according to claim 10, characterized in that, The step of jointly training the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network end-to-end based on the training dataset includes: Based on the training dataset, obtain the health score result of each training data after passing through the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network; Based on a preset loss function, the loss value between the health score result and the gas meter health score used as a label is determined; Based on the backpropagation algorithm and the loss value, determine the parameter gradient of the loss function with respect to each model parameter in the first convolutional autoencoder, the second convolutional autoencoder, the attention mechanism network, and the fully connected neural network; Based on the parameter gradient and optimizer, each model parameter is updated with the loss value as the objective until the loss value converges, resulting in the trained first convolutional autoencoder, second convolutional autoencoder, attention mechanism network, and fully connected neural network.
12. An electronic device, characterized in that, The electronic device includes: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores a computer program, which, when executed by the at least one processor, implements the gas meter health rating method according to any one of claims 1 to 11.