Water representation value detection method and system

CN122730141BActive Publication Date: 2026-10-20WUHAN DIYUAN WATCHMAKING CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202611222955.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-13
Publication Date
2026-10-20
Estimated Expiration
2046-08-13

AI Technical Summary

Technical Problem

[0005]本申请提供水表示值检测方法及系统,旨在解决数字轮盘滚动过渡产生的半字模糊状态易导致识别歧义,且现有方案未结合轮盘固有位权差异与分类模糊程度进行自适应调整,导致水表示值识别准确率与稳定性不足问题

Benefits of technology

[0023]本申请通过卷积神经网络和序列解码网络深入探究水表图像特征,获取高精度的字符类别原始对数向量。在离散化分类过程中,采用Gumbel噪声构建扰动对数向量,并结合软分类向量的熵值及与轮盘固有位权反相关的基准温度,确定用于缩放处理的温度数值。能够根据不同轮盘位置的重要程度和识别不确定性差异化平滑概率分布,缓解网络训练过程中的梯度近似误差。在反向传播阶段构建了由软分类向量与单热点硬分类向量的L1范数构成的正则化项,并将所述正则化项加入总损失函数更新网络参数。约束了输入噪声造成的方差偏移,增强了模型对光照不均、图像模糊等干扰情况的抵抗能力,优化了深度学习模型的更新优化过程,提升了复杂环境下水表示值识别的准确率与泛化性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122730141B_ABST
    Figure CN122730141B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of water representation value detection, in particular to a water representation value detection method and system. The method comprises the following steps: collecting a water meter image, extracting a digital dial depth feature map through a convolutional neural network, inputting the digital dial depth feature map into a sequence decoding network to output original logarithmic vectors of characters of each dial, generating equal-dimension Gumbel noise superimposed on the original logarithmic vectors to obtain perturbed logarithmic vectors; obtaining a temporary soft classification vector through Softmax of the original logarithmic vectors, calculating a temperature adjustment value according to an entropy value of the vector, combining a reference temperature negatively related to a dial position weight to obtain an adaptive temperature, scaling the perturbed logarithmic vectors by using the adaptive temperature, and outputting a soft classification vector through Softmax; obtaining a hard classification recognition result through forward propagation and discretization, constructing a regular term by using an element-by-element product of the soft classification vector and noise and an L1 norm to form a total loss, iteratively updating a network, fusing all dial recognition results, and outputting a complete water representation value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of water level indicator detection technology. More specifically, this application relates to methods and systems for detecting water level indicators. Background Technology

[0002] In water meter production, extensive testing is required. Previously, water meter readings were done manually, which is tiring and prone to errors due to constant reading. By deploying image acquisition equipment to capture meter dial images, and utilizing deep learning models such as convolutional neural networks to extract features, decode sequences, and classify characters in the digital dial area, these methods have improved the intelligence level of water meter reading to a certain extent. Under ideal lighting and clear meter dial conditions, they have achieved good recognition results, thus promoting the overall construction of smart water management.

[0003] Chinese patent document CN109902751B discloses a dial digit character recognition method that integrates convolutional neural networks and half-character template matching, including: first, obtaining a segmented grayscale image with full-character and half-character labels; then, filtering and classifying the labels; if the label is 0, half-character recognition is performed, and if the label is 1, full-character recognition is performed; finally, the recognition results of the grayscale images are output sequentially according to the order of image input.

[0004] However, the digital roulette wheel is often in a half-word transition state, making it difficult for conventional models to determine a unique category during classification decisions, easily leading to recognition ambiguity. Water meter readings are composed of multiple digital roulette wheels, with different positions representing different inherent weights. Errors in higher-order digit recognition result in a much larger overall numerical deviation than those in lower-order digit recognition, yet there is no adjustment mechanism that combines weight characteristics and classification ambiguity. Furthermore, conventional deep neural networks often use deterministic probability outputs for parameter optimization during training. When processing roulette characters with highly ambiguous characteristics, the network's gradient updates are prone to bias, limiting the model's generalization ability. Therefore, how to improve the network's classification and gradient estimation mechanisms as a whole, enabling the network to handle roulette character recognition tasks with different levels of ambiguity and inherent weights, enhancing the model's anti-interference ability in complex environments, and improving the overall accuracy and stability of water meter reading recognition are pressing technical challenges in this field. Summary of the Invention

[0005] This application provides a method and system for detecting water level values, aiming to solve the problem that the half-word ambiguity caused by the scrolling transition of the digital roulette wheel can easily lead to recognition ambiguity, and that existing solutions do not adaptively adjust based on the inherent positional weight differences of the roulette wheel and the degree of classification ambiguity, resulting in insufficient accuracy and stability of water level value recognition.

[0006] In a first aspect, this application provides a water meter value detection method, the detection method comprising: S1, acquiring a water meter image and extracting a depth feature map of the digital roulette wheel region using a convolutional neural network; S2, inputting the depth feature map into a sequence decoding network to obtain the original logarithmic vector of the character category at each digital roulette wheel position; S3, independently generating a Gumbel noise vector with the same dimension as the original logarithmic vector as a perturbation noise vector, and adding the perturbation noise vector to the original logarithmic vector to obtain a perturbation logarithmic vector; S4, inputting the original logarithmic vector into a Softmax function to obtain a temporary soft classification vector and calculating the entropy value of the temporary soft classification vector; generating a temperature regulation value based on the entropy value, and then... The adaptive temperature value is determined by adding a temperature adjustment value to the baseline temperature that is inversely correlated with the inherent position weight of the digital roulette wheel; S5, the adaptive temperature value is used to scale the perturbation logarithmic vector, and the scaled perturbation logarithmic vector is input into the Softmax function to obtain the soft classification vector. In the forward propagation, the soft classification vector is discretized to obtain the single hotspot hard classification vector, and the single hotspot hard classification vector is used as the current position recognition result; S6, in the backpropagation, a regularization term consisting of the L1 norm of the difference between the soft classification vector and the single hotspot hard classification vector is constructed, and the regularization term is added to the total loss function to update the network parameters through gradient descent; the water representation value is output by combining the recognition results of all digital roulette wheel positions.

[0007] After extracting the original logarithmic vector, Gumbel noise is introduced to construct a perturbation logarithmic vector, allowing the network to explore the prediction space near the class boundary rather than getting trapped in the local optima of hard sampling. The entropy value of the temporary soft classification vector is used to dynamically sense the classification uncertainty at each position, and this is superimposed with the baseline temperature set by the position weight inverse correlation to form an adaptive temperature. This allows the low-position wheel with frequent flips and high ambiguity to obtain higher fault tolerance smoothness, while the high-position wheel, which has a high cost of error, approaches hard sampling to maintain sharpness. This achieves differentiated adjustment of the probability distribution according to both importance and ambiguity. At the same time, in the forward propagation, the output of discrete single hotspot results by the direct estimator is used to remove redundant probability interference. In the backpropagation, the L1 norm of the difference between the soft and hard classification vectors is used to construct a regularization term to constrain the variance offset introduced by noise and suppress false high confidence. This ensures that the network with discrete sampling steps is still end-to-end differentiable, improves the accuracy of the reading sequence, and enhances the anti-interference ability and generalization stability under complex conditions such as uneven lighting and motion ambiguity.

[0008] Further, a water meter image is acquired, and a depth feature map of the digital roulette wheel region is extracted using a convolutional neural network. This includes: inputting the water meter image into a convolutional neural network containing residual blocks, and extracting a global feature map through multi-layer two-dimensional convolution and non-linear activation operations; locating the region of interest containing all digital roulette wheels on the global feature map using an object detection algorithm; segmenting the region of interest into multiple independent sub-regions in spatial dimension according to the prior arrangement position of each digital roulette wheel; and scaling the feature map of each independent sub-region to a uniform width and height dimension using an interpolation algorithm to obtain the depth feature map of each digital roulette wheel region.

[0009] First, a convolutional network containing residual blocks is used to extract global feature maps. Then, an object detection algorithm is used to accurately define the region of interest containing all the digital roulette wheels. Based on the prior positions of the roulette wheels, the region is divided into independent sub-regions and then interpolated to unify the width and height dimensions. This ensures that each sub-region cleanly carries the feature information of a single character, eliminating background interference such as dial borders and scales. It also provides a consistent and non-interfering feature carrier for downstream sequence decoding. In actual copying, this effectively avoids misreading caused by the overlapping of features of adjacent roulette wheels, laying a reliable foundation for subsequent high-precision recognition.

[0010] Further, the deep feature maps are input into a sequence decoding network to obtain the original logarithmic vectors of character categories at each roulette wheel position. This includes: flattening the deep feature maps of each roulette wheel region along the channel direction and concatenating them to form a sequence feature vector; inputting the sequence feature vectors into a bidirectional long short-term memory network, and extracting contextual dependency features between roulette wheels through forward and backward time step propagation to obtain a hidden layer state sequence; inputting the hidden layer state sequence into a fully connected layer, and mapping the feature dimensions to a preset total number of character categories through linear transformation to output the original logarithmic vectors of the corresponding character categories at each roulette wheel position.

[0011] The features of each roulette wheel are flattened and spliced ​​into a sequence along the channel and then fed into a bidirectional long short-term memory network. The contextual dependencies and mechanical carry relationships between the digital roulette wheels are explicitly modeled through forward and backward time step propagation. The original logarithmic vector is then mapped to the character category dimension through a fully connected layer. This allows the network to use the continuity constraint of carry from low to high digits to help identify suspicious digits in a transitional state. With the mutual correction of adjacent semantics, the overall sequence error caused by isolated judgments is reduced, and the overall consistency and reliability of multi-digit reading combinations are improved.

[0012] Furthermore, independently generating a Gumbel noise vector with the same dimension as the original logarithmic vector as a perturbation noise vector includes: independently sampling random variables with the same dimension as the original logarithmic vector from a uniform distribution; calculating the negative logarithm twice for the random variables to generate a Gumbel noise vector that follows a standard Gumbel distribution; and using the Gumbel noise vector that follows a standard Gumbel distribution as a perturbation noise vector.

[0013] After independent sampling from a uniform distribution, a noise vector following a standard Gumbel distribution is accurately generated through two negative logarithmic transformations. This makes the superimposed perturbation logarithmic vector mathematically equivalent to differentiable random sampling of the class distribution. This fully activates the model's exploration of class boundaries with the positively skewed long-tail characteristics without destroying the smoothness condition of the original gradient, providing a theoretically consistent and computationally efficient source of random perturbation for subsequent differentiable discrete decoding.

[0014] Further, a temperature adjustment value is generated based on the entropy value. The adaptive temperature value is determined by adding the reference temperature, which is inversely correlated with the inherent position weight of the digital roulette wheel, to the reference temperature. This includes: calculating the entropy value of the temporary soft classification vector using the information entropy formula; multiplying the entropy value by a learnable scaling factor constrained to a non-negative value by the Softplus nonlinear activation function to output the temperature adjustment value; setting the reference temperature according to the inherent position weight of each digital roulette wheel, wherein higher-ranking digital roulette wheels are assigned a lower reference temperature and lower-ranking digital roulette wheels are assigned a higher reference temperature; and adding the reference temperature to the temperature adjustment value to calculate the adaptive temperature value corresponding to each position of the digital roulette wheel.

[0015] Furthermore, the perturbation logarithmic vector is scaled using an adaptive temperature value, and the scaled perturbation logarithmic vector is input into the Softmax function to obtain a soft classification vector. In the forward propagation, a single-hotspot hard classification vector is obtained based on the soft classification vector through a discretization operation, including: dividing the perturbation logarithmic vector by the adaptive temperature value to obtain a temperature-scaled logarithmic vector; performing Softmax normalization on the temperature-scaled logarithmic vector to obtain a soft classification vector of each character category probability; during the forward propagation, the category index corresponding to the maximum probability in the soft classification vector is extracted, the category index is converted into a single-hotspot hard classification vector, and a pass-through estimator is used to retain the gradient of the single-hotspot hard classification vector for backpropagation.

[0016] First, the perturbation logarithmic vector is scaled using adaptive temperature and then obtained as a soft classification vector through Softmax. During forward propagation, the maximum probability index is extracted and converted into a single hotspot hard classification vector to output a definite discrete reading and eliminate redundant probability interference. At the same time, the continuous gradient of the soft classification vector is preserved in the backpropagation by using a pass-through estimator, which cleverly solves the bottleneck of non-differentiability of the discrete sampling step. This allows the network to give a clear character judgment and to be stably trained end-to-end, taking into account both the determinism of the recognition result and the optimizability of the training process.

[0017] Furthermore, in backpropagation, a regularization term consisting of the L1 norm of the difference between the soft classification vector and the single-hotspot hard classification vector is constructed. This regularization term is then added to the total loss function for gradient descent to update the network parameters. This includes: calculating the difference between the soft classification vector and the single-hotspot hard classification vector at each position, summing the absolute values ​​of the differences to obtain the L1 norm of that position as the regularization term; multiplying the regularization term at all positions by a preset penalty weight, and then adding it to the cross-entropy loss function used to measure the difference between the recognition result and the true label to form the total loss function; executing the backpropagation algorithm to calculate the gradient of the total loss function with respect to the network parameters, and using an optimization algorithm to synchronously update the parameters.

[0018] Furthermore, the water representation value is output by combining the recognition results of all digital roulette positions, including: disabling the generation of Gumbel noise vectors during the inference stage, directly extracting the character category number from the original logarithmic vector of the character category at each digital roulette position through the maximum value index; and concatenating the character category numbers at each digital roulette position in descending order of digits to form a complete string sequence, which serves as the detection result of the water representation value.

[0019] Further, the adaptive temperature value is determined by adding the temperature adjustment value to the reference temperature that is inversely correlated with the inherent position weight of the digital wheel, including: setting the lowest reference temperature for the digital wheel with the highest position weight and the highest reference temperature for the digital wheel with the lowest position weight according to the arrangement order of the digital wheels from high to low position weight, and linearly interpolating the reference temperatures for the remaining digital wheels according to the order of position weight from high to low to obtain the reference temperature corresponding to each position of the digital wheel; and adding the temperature adjustment value corresponding to the position of each digital wheel to the reference temperature corresponding to each position to obtain the adaptive temperature value corresponding to each position of the digital wheel.

[0020] The lowest reference temperature is set for the wheel with the highest position weight, and the highest reference temperature is set for the wheel with the lowest position weight. The middle digits are linearly interpolated from high to low position weight and then superimposed with the temperature adjustment value. This makes the temperature amplitude of each wheel increase smoothly as the position weight decreases, avoiding the discontinuity of the classification scale caused by temperature abrupt changes between adjacent digits. This makes the differential smoothing strategy transition naturally and be reasonably distributed in the entire column of readings, further improving the robustness of multi-digit wheel collaborative recognition.

[0021] In a second aspect, this application also provides a water meter reading detection system, including a processor, a memory, and a communication interface. The memory stores computer program instructions, which, when executed by the processor, implement the water meter reading detection method according to the first aspect of this application.

[0022] This application has the following technical effects:

[0023] This application delves into the features of water meter images using convolutional neural networks and sequence decoding networks to obtain high-precision original logarithmic vectors for character categories. During the discretization classification process, Gumbel noise is used to construct a perturbation logarithmic vector, and the temperature value used for scaling is determined by combining the entropy value of the soft classification vector and the reference temperature inversely correlated with the inherent position weights of the wheel. This approach smooths the probability distribution based on the importance of different wheel positions and the differences in recognition uncertainty, mitigating gradient approximation errors during network training. In the backpropagation stage, a regularization term consisting of the L1 norm of the soft classification vector and the single-hotspot hard classification vector is constructed and added to the total loss function to update network parameters. This constrains the variance shift caused by input noise, enhances the model's resistance to interference such as uneven lighting and image blur, optimizes the update and optimization process of the deep learning model, and improves the accuracy and generalization performance of water meter value recognition in complex environments. Attached Figure Description

[0024] Figure 1 This is a flowchart of a water meter value detection method according to an embodiment of this application; Figure 2 This is a schematic diagram of adaptive temperature distribution according to an embodiment of this application; Figure 3 This is a schematic diagram comparing the ablation test accuracy according to an embodiment of this application; Figure 4 This is a structural block diagram of a water level indicator detection system according to an embodiment of this application. Detailed Implementation

[0025] Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0026] The first aspect of this application provides a method for detecting water level indication values. Figure 1 This is a flowchart of a water level value detection method according to an embodiment of this application. The specific implementation process of this method will be described in detail below.

[0027] S1: Acquire water meter images and extract digital wheel depth feature maps.

[0028] Acquire water meter images and use convolutional neural networks to extract depth feature maps of the digital roulette wheel region.

[0029] The water meter image is read, scaled to a preset resolution, and converted into tensor format using bilinear interpolation and normalization. A convolutional neural network feature extractor based on the ResNet50 residual network is constructed. Pre-trained weights are loaded and the fully connected layers are removed. The pre-processed water meter image tensor is input into this residual network. Through alternating processing using multi-layer two-dimensional convolutional function Conv2d, batch normalization function BatchNorm2d, and modified linear unit activation function ReLU, high-dimensional abstract spatial features of the digital roulette region in the water meter image are extracted. The output is a depth feature map tensor with dimensions equal to the batch size multiplied by the number of channels, height, and width.

[0030] In some embodiments, acquiring the water meter image and extracting the depth feature map of the digital roulette wheel region using a convolutional neural network includes: The water meter image is input into a convolutional neural network containing residual blocks, and the global feature map is extracted through multi-layer two-dimensional convolution and non-linear activation operations. The region of interest containing all the digital roulette wheels is located on the global feature map using an object detection algorithm; Based on the prior arrangement of each digital roulette wheel, the region of interest is spatially divided into multiple independent sub-regions; The feature maps of each independent sub-region are scaled to a uniform width and height dimension using an interpolation algorithm to obtain the depth feature maps of each digital roulette region.

[0031] In the water meter image preprocessing and feature extraction stage, a color water meter image with a resolution normalized to 224×224×3 is input into a convolutional neural network based on the ResNet50 backbone architecture. This convolutional neural network consists of four stages of residual blocks for multi-scale spatial downsampling. Each residual block uses a convolutional layer with a 3×3 kernel size and a stride of 2, combined with the ReLU nonlinear activation function. The input is the color water meter image with a resolution normalized to 224×224×3, and the output is a global feature map with 1024 channels and a size of 14×14. A regression head network pre-trained on the water meter dataset from the YOLOv5 object detection algorithm is used. This regression head network is a deep neural network regressor. The input is the global feature map with a size of 14×14, and the output is the bounding box coordinates with a confidence score greater than 0.85. (The bounding box is set as follows...) , , , The region of interest (ROI) containing the entire digit wheel is selected and cropped. Based on this, since standard household mechanical water meters typically contain a 5-digit digit wheel equidistantly distributed horizontally along the horizontal axis, the ROI feature map is sliced ​​into 5 equal independent sub-region boxes along the width dimension, with a relative width ratio of 20%, ensuring that each sub-region independently contains the feature information of a single character. To match the tensor specification requirements of downstream sequence decoding, a bilinear interpolation algorithm is used to resample and scale the feature blocks of varying sizes generated by the cropping to the required width. ,high With a unified spatial resolution, the depth feature map size of each sub-region changes to , , It serves as the encoding feature carrier for sequence models.

[0032] S2: Sequence decoding outputs the original logarithmic vectors of each roulette character.

[0033] The deep feature map is input into the sequence decoding network to obtain the original logarithmic vector of the character category at each position of the digital roulette wheel.

[0034] The height dimension of the deep feature map is compressed to 1 using the average pooling function `AdaptiveAvgPool2d`, and the tensor shape is adjusted to the format of sequence length multiplied by batch size multiplied by feature dimension using the tensor dimension transformation function `permute`. A sequence decoding network including a bidirectional long short-term memory (BiLSTM) network is constructed. The transformed feature sequence is input into the BiLSTM network to extract sequence context-dependent features, and then connected to a linear mapping layer (`Linear`) to map the hidden state dimension to the dimension of the total number of character categories. For each roulette wheel position, the output is a floating-point tensor without activation function processing, which represents the original logarithmic vector of the confidence score for each character category.

[0035] In some embodiments, inputting the deep feature map into a sequence decoding network to obtain the original logarithmic vector of the character category at each roulette wheel position includes: Flatten the depth feature maps of each digital roulette region along the channel direction and splice them together to form a sequence feature vector; The sequence feature vector is input into a bidirectional long short-term memory network, and the context dependency features between the digital roulette wheels are extracted through forward and backward time step propagation to obtain the hidden layer state sequence. The hidden layer state sequence is input into a fully connected layer, and the feature dimension is mapped to the preset total number of character categories through a linear transformation, outputting the original logarithmic vector of the corresponding character category at each position of the number wheel.

[0036] In the sequence decoding and feature mapping stage, for a single-digit roulette feature block with size C=512, H=16, W=8, global average pooling is used to compress the local receptive field of height H and width W to a size of 1×1, directly reshaping it into a one-dimensional feature vector with a single-step dimension of D=512. This operation is performed on each of the five roulette wheels and concatenated sequentially along the corresponding time step sequence from high to low digits, forming a sequence feature vector sequence with length T=5 and a single-step dimension of D=512. The five extracted feature frames are then input into the sequence decoding network, which consists of two layers of bidirectional long short-term memory network with 256 hidden units and a fully connected layer with bias parameters and weights initialized according to a truncated normal distribution. The input is a sequence feature vector sequence with length T=5 and a single-step dimension of D=512, and the output is the original unbounded logarithmic vector matrix with size 5×11.

[0037] A bidirectional long short-term memory network computes the states of the forget gate, input gate, and output gate in the forward pass at each time step, and integrates the reverse computation based on temporal inversion. Through forward and backward concatenation, a joint hidden layer state sequence with a time dimension T=5 and a single-step dimension D=512 is generated to identify the implicit mechanical carry relationships and continuity constraints between the number roulette wheels. This joint hidden layer state sequence is then fed into a fully connected layer to perform linear dimensionality reduction projection from the hidden states to discrete number classes. The number of output nodes in the fully connected layer is configured as follows: a preset total number of classes K=11, including Arabic numerals 0 to 9, and special class semi-characters in a half-word state between two numerals. The output size is a 5×11 original unbounded logarithmic vector matrix.

[0038] S3: Generate a perturbation logarithmic vector by superimposing Gumbel noise.

[0039] A Gumbel noise vector with the same dimension as the original logarithmic vector is generated independently as a perturbation noise vector, and the perturbation noise vector is added to the original logarithmic vector to obtain the perturbation logarithmic vector.

[0040] In the deep learning framework PyTorch, the uniformly distributed random number generation function `rand_like` is called to generate a uniformly distributed random tensor with the exact same shape as the original logarithmic vector and element values ​​between 0 and 1. The natural logarithm function `log` is called twice consecutively to calculate this random tensor, with both calculations being negative. Based on the inverse transform sampling theorem, a perturbation noise vector conforming to the standard Gumbel distribution is generated. The generated perturbation noise vector is then element-wise added to the original logarithmic vector using the addition operator, resulting in a perturbation logarithmic vector with random exploration characteristics.

[0041] In some embodiments, the step of independently generating a Gumbel noise vector with the same dimension as the original logarithmic vector as a perturbation noise vector includes: Independently sample random variables with the same dimension as the original logarithmic vector from a uniform distribution; Calculate the negative logarithm twice for the random variable to generate a Gumbel noise vector that follows a standard Gumbel distribution, and use the Gumbel noise vector that follows a standard Gumbel distribution as the perturbation noise vector.

[0042] The core of the random perturbation and reparameterization generation mechanism lies in inputting a differentiable discrete sampling step into the neural network. Specifically, using a pseudo-random number generator at the back end of the computation graph, independent and identically distributed random variable tensors U with the same dimension of 5×11 are extracted from a uniform distribution in the interval from 0 to 1. A fixed random number seed, such as Seed=42, can be configured at this stage to ensure reproducibility in the early training phase. Based on the standard reparameterization transformation formula G=-ln(-lnU), logarithmic and negative continuous algebraic calculations are performed point-by-point on the generated tensor U. This double logarithmic mapping transforms the uniform distribution within a limited interval into a probability form with positive skewness and a broader long tail, generating a continuous noise tensor G following a standard Gumbel distribution with a position parameter of 0 and a scale parameter of 1. The generated Gumbel noise tensor is considered as a perturbation noise vector used to explore the uncertainty of network predictions. This vector is additively superimposed on the original 5×11 prediction vector output by the network with the same dimension, simulating the sampling process of discrete random variables with temperature annealing without violating the gradient smoothing conditions of the original model.

[0043] S4: Calculate the entropy value and determine the adaptive temperature value for each wheel.

[0044] The original logarithmic vector is input into the Softmax function to obtain a temporary soft classification vector, and the entropy value of the temporary soft classification vector is calculated. A temperature adjustment value is generated based on the entropy value, and the temperature adjustment value is added to the reference temperature that is inversely correlated with the inherent position weight of the digital roulette wheel to determine the adaptive temperature value.

[0045] The Softmax function, a normalized exponential function, is used to perform a probability mapping on the original logarithmic vector along the category dimension, resulting in a temporary soft classification vector whose sum of all element values ​​is 1. The natural logarithm of this temporary soft classification vector is calculated using a logarithmic function. This natural logarithm is then multiplied element-wise by the temporary soft classification vector itself. The summation function `sum` is called along the category dimension to calculate the accumulated value, which is then negative to obtain the information entropy value. A temperature regulation module incorporating a Multilayer Perceptron (MLP) is constructed, where the information entropy value is input into the MLP and mapped to a scalar as the temperature regulation value. For the different digital dials of the water meter arranged from high to low digits, a pre-defined baseline temperature sequence that increases with decreasing digit weight is used. The baseline temperature corresponding to the current digital dial position is obtained through tensor indexing. An addition function is called to add the baseline temperature to the temperature regulation value output by the network, calculating the adaptive temperature value tensor specific to the current step.

[0046] In some embodiments, the step of generating a temperature adjustment value based on the entropy value, and adding the temperature adjustment value to a reference temperature that is inversely correlated with the inherent position weights of the digital roulette wheel, to determine an adaptive temperature value includes: The entropy value of the temporary soft classification vector is calculated using the information entropy formula. The entropy value is then multiplied by a learnable scaling factor that is constrained to be non-negative by the Softplus nonlinear activation function to output the temperature regulation value. The reference temperature is set according to the inherent position weight of each digital wheel, with the higher-position digital wheel assigned a lower reference temperature and the lower-position digital wheel assigned a higher reference temperature. The adaptive temperature value corresponding to each digital wheel position is calculated by adding the reference temperature to the temperature adjustment value.

[0047] The temperature adaptive generation module generates a temporary soft classification probability vector of size 5×11 for the model's forward pass. Information entropy is calculated to quantitatively represent the uncertainty of character classification at each position. According to the formula... By solving bit by bit, a non-negative real entropy tensor of size 5×1 is obtained. The formula is then added... To avoid logarithmic aberrations, a scalar or a 5×1 one-dimensional learnable parameter vector, pre-initialized to 0.1, is used. After processing this vector using the Softplus activation function to ensure its non-negativity, it is used as a scaling factor. This scaling factor is then multiplied by the information entropy tensor using a Hadamard product, outputting a temperature adjustment value that incorporates the model's local confidence perception features. For the five-digit wheel of a household mechanical water meter, representing the tens, thousands, hundreds, and thousands digits sequentially, initial reference temperatures are set according to the ease of change of inherent digit weights. For the higher-digit wheel, which experiences fewer rolling jumps, the tens digit is assigned an initial reference temperature parameter of 0.5, approximating hard sampling and exhibiting low smoothness. For the lowest-digit wheel, which rotates frequently and is more prone to producing half-digits and visual motion blur, the units digit is assigned a reference temperature parameter of 2.0, which offers stronger fault tolerance and noise tolerance. Other intermediate digits are assigned linear interpolation values ​​such as 0.8, 1.2, and 1.6 according to a decreasing trend. A feedforward addition operation is performed to add the prior-driven reference temperature vector to the temperature adjustment value learned based on data uncertainty, calculating the adaptive temperature scalar for each digit wheel. (See [reference needed]). Figure 2 As shown, the adaptive temperature amplitude corresponding to the reference temperature of the five-position wheel and the superimposed adjustment value is statistically analyzed. The reference temperature value of the high-position wheel is lower, while the reference temperature of the low-position wheel is higher. Since the low-position wheel, which is frequently flipped, has higher classification uncertainty, its corresponding information entropy value is larger. This makes the adjustment increment directly calculated from the entropy value expand as the wheel position weight decreases, thus distinguishing the temperature distribution differences of different positions.

[0048] In some embodiments, the range of the reference temperature is determined through pre-experimentation: three sets of comparison models are constructed with reference temperature ranges of 0.1 to 1, 0.5 to 2, and 1 to 3, respectively, and recognition accuracy tests are conducted on a validation set containing different rolling transition states; when the reference temperature range is generally low, the classification distribution of each digit wheel tends to be sharp, and the classification ambiguity caused by the frequent half-word transition states of the low-digit digit wheel is not sufficiently smoothed, resulting in a high low-digit recognition error rate; when the reference temperature range is generally high, the classification distribution of the high-digit digit wheel is overly smoothed, weakening the high-digit recognition accuracy. The sharpness of the digit wheel should be maintained, but the overall numerical deviation increases due to high-level misjudgment. Through comparative testing, the recognition accuracy of each digit wheel is best when the reference temperature range is 0.5 to 2. Therefore, the reference temperature of the digit wheel with the highest position weight is set to the lower limit of the range of 0.5, and the reference temperature of the digit wheel with the lowest position weight is set to the upper limit of the range of 2.0. In other embodiments, those skilled in the art can adjust the reference temperature range according to the degree of ambiguity, noise intensity and training data distribution of the water meter digit wheel in the actual application scenario. This application does not limit this.

[0049] S5: Scale the perturbation log vector and output the hard classification result.

[0050] The perturbation logarithmic vector is scaled using an adaptive temperature value, and the scaled perturbation logarithmic vector is input into the Softmax function to obtain a soft classification vector. In the forward propagation, the soft classification vector is discretized to obtain a single hotspot hard classification vector, which is then used as the current position recognition result.

[0051] The tensor division function `div` is called to divide each element of the perturbation logarithm vector by the calculated adaptive temperature value for numerical scaling. The scaled tensor is then input into the normalized exponential function `Softmax` to obtain the soft classification vectors for each class probability distribution. During the forward propagation phase, the maximum index function `argmax` is called to find the index position of the maximum probability value in the soft classification vector along the class dimension, and the single-hot encoding function `one_hot` is called to convert this index into a single-hot hard classification vector where only the corresponding class position is 1 and all others are 0. To ensure connectivity in the computational graph, the Straight-Through-Estimator algorithm technique is used. The gradient detach function is used to separate the soft classification vector from the computational graph. The single-hot hard classification vector is subtracted from the separated soft classification vector and then added to the original soft classification vector. This ensures that the forward propagation outputs the hard classification result while allowing the backpropagation to successfully calculate the continuous gradient of the soft classification vector.

[0052] In some embodiments, scaling the perturbation logarithmic vector using an adaptive temperature value and inputting the scaled perturbation logarithmic vector into the Softmax function to obtain a soft classification vector, and then discretizing the soft classification vector in forward propagation to obtain a single-hotspot hard classification vector, includes: Divide the perturbation logarithmic vector by the adaptive temperature value to obtain the temperature-scaled logarithmic vector. Perform Softmax normalization on the temperature-scaled logarithmic vector to obtain a soft classification vector of the probability of each character category; During forward propagation, the class index corresponding to the maximum probability in the soft classification vector is extracted, the class index is converted into a single hotspot hard classification vector, and a pass-through estimator is used to retain the gradient of the single hotspot hard classification vector for backpropagation.

[0053] The differentiable category decoding process is achieved by combining two steps: annealing scaling and direct gradient propagation. For the 5×11 additive perturbation logarithmic tensor obtained after noise fusion, element-wise division at corresponding positions by the 5×1 adaptive temperature value vector obtained in the previous step is used to nonlinearly amplify or smooth the category confidence differences. The standard Softmax normalization formula is performed on the terminal axis representing the 11 character categories to map out a dense soft classification feature tensor with probabilistic attributes and a row-wise sum of 1. During the forward propagation computation, a non-differentiable extremum function is invoked to extract the integer class index corresponding to the maximum probability value at each position. For example, if the highest confidence of the fifth prediction result is class 4, then index 4 is extracted. The index is then transformed into a discrete single-hotspot hard classification vector with only one dimension set to 1 and the remaining 10 dimensions set to 0 using a scattering method. This discontinuous transition creates non-differentiable breakpoints, prompting the network to reconstruct the forward graph using a pass-through estimator algebraic techniques, as shown in the formula. Where sg() is the gradient stopping symbol, in the forward computation, When taking the inverse derivative, This ensures that the actual output of the model in the feedforward stage, which is then passed to the subsequent evaluation, is an absolutely discrete single-hotspot result to remove the interference of class redundancy probability. During the backward chain rule differentiation, the Argmax operation is bypassed, and a differentiable Jacobian matrix is ​​passed back from the continuous tensor with embedded temperature adaptive parameters to smooth the gradient, thus solving the bottleneck of not being able to perform end-to-end differentiation in discrete sampling steps.

[0054] S6: Construct regularization terms, update parameters, and output values.

[0055] In backpropagation, a regularization term consisting of the L1 norm of the difference between the soft classification vector and the single hotspot hard classification vector is constructed, and the regularization term is added to the total loss function to update the network parameters through gradient descent; the water representation value is output by combining the recognition results of all digital wheel positions.

[0056] Calculate the difference between the soft classification vector and the previously generated single-hotspot hard classification vector. Use the norm calculation function to sum the absolute values ​​of the product results to calculate the L1 norm. Multiply this norm by a preset hyperparameter weight coefficient as a smoothing regularization term. Use the cross-entropy loss function to calculate the classification loss between the temporary soft classification vector and the true label. Combine the classification loss and the smoothing regularization term using an addition function to form the total loss function. Use the backpropagation function to calculate the gradient of the total loss function with respect to all learnable weights in the network. Use the update function of the Adam adaptive moment estimator optimizer to update the parameter matrices of the convolutional neural network and the sequence decoding network along the gradient descent direction according to the set learning rate. During the inference phase, disable the Gumbel perturbation noise generation mechanism. Directly convert the original logarithmic vectors obtained at all sequence time steps back to character category numbers using the maximum value index function. Use the string concatenation function `join` to combine the character numbers of each wheel position into a complete string sequence, outputting the actual determined degree reading of the water meter.

[0057] In some embodiments, the step of constructing a regularization term in backpropagation consisting of the L1 norm of the difference between the soft classification vector and the single-hotspot hard classification vector, and adding the regularization term to the total loss function for gradient descent to update the network parameters, includes: Calculate the difference between the soft classification vector and the single hotspot hard classification vector at each location, and sum the absolute values ​​of the difference results to obtain the L1 norm of the location as a regularization term; The regularization term at all positions is multiplied by a preset penalty weight and then added to the cross-entropy loss function used to measure the difference between the recognition result and the true label to form the total loss function. The backpropagation algorithm is executed to calculate the gradient of the total loss function with respect to the network parameters, and the parameters are updated synchronously using an optimization algorithm.

[0058] Noise feedback constraints and multi-task hybrid loss optimization are located at the end of the reverse cost calculation in the network computation graph. A continuous smooth state tensor soft classification vector (5×11 dimensions) and a single-hotspot hard classification vector generated by the feedforward are retrieved from memory, and their matrices are expanded along a two-dimensional plane of sequence length and number of classes, with element-wise subtraction. The system monitors for significant deviations at deterministic class nodes where the model's output classification probability approaches 1, extracting the first-order L1 norm of this matrix by summing the absolute values ​​of each scalar to construct a sparse regularization constraint term. To prevent primary and secondary gradient conflicts, this regularization constraint term is pre-multiplied by a penalty weight hyperparameter with a preferred value of 0.02, and the converted value is appended to the standard cross-entropy loss function between the forward output sequence and the human expert-annotated true value, synthesizing a scalar total cost function. A reverse chain rule is performed, and the initial learning rate is set... decay strategy with first-order momentum parameter and second-order momentum parameters The Adam adaptive gradient descent optimizer optimizes the gradient expansion of the mixed loss function and simultaneously updates the learnable parameters of various neurons, including the weights of the CNN backbone layer and the Gumbel feature decoding end.

[0059] In some embodiments, the penalty weight is determined by a grid search method: the impact of penalty weights of 0.005, 0.01, 0.02, 0.05, and 0.1 on the model convergence speed and recognition accuracy are tested on the validation set. When the penalty weight is too small, the contribution of the regularization term to the cross-entropy loss is negligible, failing to effectively constrain the variance shift caused by noise, and the model still suffers from false high confidence. When the penalty weight is too large, the regularization term accounts for too high a proportion in the total loss function, suppressing the dominant role of cross-entropy loss on classification accuracy, resulting in slower model convergence speed and decreased recognition accuracy. Through comparative testing, when the penalty weight is 0.02, the model can effectively suppress variance shift and false high confidence while maintaining the dominant position of classification accuracy, and the overall performance of convergence speed and loss smoothness is optimal. Therefore, the penalty weight is preferably set to 0.02. In other embodiments, those skilled in the art can adjust the penalty weight accordingly based on the noise intensity and training data distribution in the actual application scenario, and this application does not limit this.

[0060] The ablation experiments were conducted on a computing server equipped with an RTX 3090 graphics card, using the PyTorch deep learning framework. A dataset of 1000 real-world water meter images from various scenarios was used, with 800 images as the training set and 200 as the test set. All images underwent resolution normalization. The model was trained using the Adam optimizer with an initial learning rate of 0.0001 and standard momentum parameters, for a total of 50 training epochs. The experiment constructed a four-dimensional alignment network structure: a basic model using a residual convolutional network and a bidirectional sequence decoding network; a model incorporating a Gumbel random perturbation reparameterization mechanism; a model with an adaptive temperature adjustment module based on information entropy and intrinsic position weights; and a complete scheme model combining soft classification and a first-order norm regularization term for perturbation noise.

[0061] The basic model achieved an accuracy of 84.5% for water meter reading sequences when processing regular images. After adding a random perturbation tensor and a direct-pass estimator discrete class decoding strategy to the network framework, the model's noise resistance was enhanced, and the sequence recognition accuracy improved to 88.2%. After incorporating an adaptive temperature scalar adjustment module, the overall reading sequence accuracy jumped to 92.6%, especially in single-character recognition errors for frequently flipped individual digit roulette wheels and half-character categories, where the error rate decreased by approximately 40% compared to the previous stage. Using a complete model scheme incorporating a penalized weighted regularization hybrid loss mechanism, the overall sequence test accuracy reached 95.1%, with convergence speed and loss smoothness being the best among all control groups. (See reference...) Figure 3 As shown in the figure, the accuracy of the complete water meter sequence recognition corresponding to the four network architectures is recorded. With each addition of the core mechanism of this application, the overall recognition accuracy steadily increases. After the complete model is combined with all the improved modules, the test accuracy reaches the highest value among the four comparison networks.

[0062] Stacking basic convolutional and long short-term memory networks reveals shortcomings in feature extraction when faced with complex lighting and motion blur caused by continuous carry-over. Using continuous noise tensors for perturbation exploration activates the model's perception of the class boundary prediction space, reducing local optima traps in the hard sampling process. The adaptive temperature generation module deeply binds to the objective laws of low-frequency fluctuations in household mechanical watches, improving the classification tolerance boundary of semi-character blurry features through scaling and reducing interference from abrupt changes in visual features. Combined with the sparse absolute value penalty term constructed in the model's back-end computation link, the negative guidance from false high confidence is reduced through the output of the supervised network, ensuring end-to-end gradient differentiability in the complex decoding process and improving the generalization upper limit and stability of meter reading in real-world engineering scenarios.

[0063] According to a second aspect of this application, a water level indicator detection system is also provided. Figure 4 This is a structural block diagram of a water level indicator detection system according to an embodiment of this application. (See diagram below.) Figure 4 As shown, the system 50 includes a processor, a memory, and a communication interface. The memory stores computer program instructions, which, when executed by the processor, implement the water level indicator detection method according to the first aspect of this application. The system also includes other components well-known to those skilled in the art, such as a communication bus and a communication interface; their configuration and functions are known in the art and will not be described further here.

Claims

1. A method for detecting water level readings, characterized in that, The detection method includes: S1. Acquire a water meter image and extract the depth feature map of the digital roulette wheel region using a convolutional neural network; S2. Input the depth feature map into a sequence decoding network to obtain the original logarithmic vector of the character category at each digital roulette wheel position; S3. Independently generate a Gumbel noise vector with the same dimension as the original logarithmic vector as a perturbation noise vector, and add the perturbation noise vector to the original logarithmic vector to obtain the perturbation logarithmic vector; S4. Input the original logarithmic vector into a Softmax function to obtain a temporary soft classification vector and calculate the entropy value of the temporary soft classification vector; Based on the entropy value, generate a temperature adjustment value, add the temperature adjustment value to the reference temperature that is inversely correlated with the inherent position weight of the digital roulette wheel, and determine the adaptive temperature value, including: using the information entropy formula to calculate... Calculate the entropy value of the temporary soft classification vector, multiply the entropy value by a learnable scaling factor constrained to a non-negative value by the Softplus non-linear activation function, and output the temperature adjustment value. Set the reference temperature according to the inherent position weight of each digital wheel, where the digital wheel with the highest position weight is set with the lowest value, and the digital wheel with the lowest position weight is set with the highest value, and the other digital wheels are linearly interpolated to obtain the reference temperature corresponding to each position according to the position weight from high to low. Add the corresponding temperature adjustment value to the reference temperature corresponding to each position of the digital wheel to obtain the adaptive temperature value corresponding to each position of the digital wheel. S5: The perturbation logarithmic vector is scaled using an adaptive temperature value, and the scaled perturbation logarithmic vector is input into the Softmax function to obtain a soft classification vector. In the forward propagation, the soft classification vector is discretized to obtain a single hotspot hard classification vector, which is used as the current position recognition result. S6: In the backpropagation, a regularization term consisting of the L1 norm of the difference between the soft classification vector and the single hotspot hard classification vector is constructed, and the regularization term is added to the total loss function to update the network parameters through gradient descent. The water representation value is output by combining the recognition results of all digital wheel positions.

2. The method for detecting water level readings according to claim 1, characterized in that, The process of acquiring the water meter image and extracting the depth feature map of the digital roulette wheel region using a convolutional neural network includes: The water meter image is input into a convolutional neural network containing residual blocks, and a global feature map is extracted through multi-layer two-dimensional convolution and non-linear activation operations. An object detection algorithm is used to locate the region of interest containing all the digital roulette wheels on the global feature map. According to the prior arrangement of each digital roulette wheel, the region of interest is truncated into multiple independent sub-regions in the spatial dimension. An interpolation algorithm is used to scale the feature maps of each independent sub-region to a uniform width and height dimension to obtain the depth feature map of each digital roulette wheel region.

3. The method for detecting water level readings according to claim 1, characterized in that, The process of inputting the deep feature map into the sequence decoding network to obtain the original logarithmic vector of the character category at each position of the roulette wheel includes: The depth feature maps of each digital roulette region are flattened along the channel direction and spliced ​​to form a sequence feature vector. The sequence feature vector is input into a bidirectional long short-term memory network, and the context dependency features between digital roulettes are extracted through forward and backward time step propagation to obtain the hidden layer state sequence. The hidden layer state sequence is input into a fully connected layer, and the feature dimension is mapped to the preset total number of character categories through linear transformation, and the original logarithmic vector of the corresponding character category at each digital roulette position is output.

4. The method for detecting water level readings according to claim 1, characterized in that, The process of independently generating a Gumbel noise vector with the same dimension as the original logarithmic vector as the perturbation noise vector includes: Random variables with the same dimension as the original logarithmic vector are independently sampled from a uniform distribution; negative logarithms are calculated twice for the random variables to generate a Gumbel noise vector that follows a standard Gumbel distribution; the Gumbel noise vector that follows a standard Gumbel distribution is used as the perturbation noise vector.

5. The method for detecting water level readings according to claim 1, characterized in that, The process involves scaling the perturbation logarithmic vector using an adaptive temperature value and inputting the scaled perturbation logarithmic vector into the Softmax function to obtain a soft classification vector. During forward propagation, this soft classification vector is discretized to obtain a single-hotspot hard classification vector, including: Divide the perturbation logarithmic vector by the adaptive temperature value to obtain a temperature-scaled logarithmic vector; perform Softmax normalization on the temperature-scaled logarithmic vector to obtain a soft classification vector for each character category probability; during forward propagation, extract the category index corresponding to the maximum probability in the soft classification vector, convert the category index into a single-hotspot hard classification vector, and use a pass-through estimator to retain the gradient of the single-hotspot hard classification vector for backpropagation.

6. The method for detecting water level readings according to claim 1, characterized in that, The process of constructing a regularization term in backpropagation, consisting of the L1 norm of the difference between the soft classification vector and the single-hotspot hard classification vector, and adding this regularization term to the total loss function for gradient descent to update network parameters, includes: Calculate the difference between the soft classification vector and the single-hotspot hard classification vector at each location, and sum the absolute values ​​of the differences to obtain the L1 norm of the location as a regularization term. Multiply the regularization term of all locations by a preset penalty weight, and add it to the cross-entropy loss function used to measure the difference between the recognition result and the true label to form the total loss function. Execute the backpropagation algorithm to calculate the gradient of the total loss function with respect to the network parameters, and use the optimization algorithm to update the parameters synchronously.

7. The method for detecting water level readings according to claim 1, characterized in that, The combined identification results of all digital wheel positions output water representation values, including: During the inference phase, the generation of Gumbel noise vectors is turned off. The original logarithmic vectors of character categories at each roulette position are directly extracted to obtain the character category number through the maximum value index. The character category numbers at each roulette position are concatenated in order from the highest digit to the lowest digit to form a complete string sequence, which is used as the detection result of the water representation value.

8. A water level reading detection system, characterized in that, include: The system includes a processor, a memory, and a communication interface, wherein the memory stores a computer program that, when executed by the processor, implements the water level value detection method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • A dial digit character recognition method that integrates convolutional neural networks and half-word template matching

    CN109902751B

  • Water meter disc area detection method based on full convolution recurrent neural network

    CN106682664A

  • Fusion positioning method and device, computer equipment, storage medium and program product

    CN116068604A