Character wheel type mechanical water meter reading identification method based on Meter-YOLO model

By using the Meter-YOLO model in the wheel-type reading recognition of mechanical water meters, combined with the multi-scale hole attention mechanism, Slim-Neck structure and GIoU loss function, the problem of insufficient recognition accuracy and robustness in the existing technology is solved. , achieving more efficient identification of water meter readings.

CN118587722APending Publication Date: 2024-09-03BASIC INTELLIGENCE TECH CO LTD

Patent Information

Application Number
CN202410755265.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

The existing technology has problems of insufficient accuracy, speed and robustness in the wheel-type reading recognition of mechanical water meters. Especially under interference conditions such as dust and tilt, the deep learning model still has problems in terms of detection accuracy and computational complexity. Room for improvement.

Method used

Using the Meter-YOLO model based on the YOLOv8 model, the feature extraction and bounding box regression are improved by embedding a multi-scale hole attention mechanism in the backbone network, using the Slim-Neck structure for feature fusion, and using the GIoU loss function in the detection head. , improving the accuracy and robustness of recognition.

Benefits of technology

It improves the accuracy, speed and robustness of mechanical water meter wheel reading recognition, reduces the computational complexity of the model, is suitable for practical application scenarios with limited resources, reduces missed detections and false detections, and improves detection accuracy. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587722A
    Figure CN118587722A
Patent Text Reader

Abstract

The invention discloses a character wheel type mechanical water meter reading recognition method based on a Meter-YOLO model. The character wheel type mechanical water meter reading recognition method comprises the following steps that S1, a character wheel type water meter data set is manufactured; s2, the character wheel type water meter data set is used for training a Meter-YOLO model, and the Meter-YOLO model is an improvement based on a YOLOv8 model; and S3, performing water meter reading identification on the character wheel type water meter image by using the trained Meter-YOLO model. According to the Meter-YOLO model, a multi-scale cavity attention mechanism is introduced into a backbone network of the Meter-YOLO model, so that the feature extraction capability of the network can be improved; in addition, the calculation complexity of the model is further reduced by adopting a Slim-Neck feature fusion structure, meanwhile, bounding box regression calculation of the model in the training process is optimized by using a GIoU loss function, and the reading precision is further improved. According to the method, the average precision of 98.2% is achieved on a character wheel type water meter data set, the calculation complexity of 2.6 GFLOPS is reduced compared with a YOLOv8s baseline model, and the performance of important indexes such as the accuracy rate and the recall rate is superior to that of the baseline model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of water meter reading recognition, and in particular to a method for recognizing readings of a wheel-type mechanical water meter based on a Meter-YOLO model. Background Art

[0002] Water meters are one of the main instruments for measuring water supply in various industries, including residential, hotel, restaurant and other civil industries as well as a wide range of industrial fields. Among them, mechanical water meters are roughly divided into two types: one is a pointer water meter with multiple dials, which requires reading the pointer readings in multiple dials and multiplying the range of each dial to obtain the reading result; the other is a wheel-type digital display, namely a wheel-type mechanical water meter (also known as a wheel-type water meter), which obtains the current reading of the water meter by reading the numbers in the wheel area.

[0003] In recent years, many image-based automatic meter reading (AMR) methods have been proposed for the recognition of readings of wheel-type mechanical water meters. Although traditional methods can achieve certain results in the detection and recognition of mechanical water meter readings with images as input data, they have limitations in terms of accuracy, speed and robustness. In actual application scenarios, interference such as dust and tilt will have a great impact on the recognition results, and therefore cannot achieve the expected effect.

[0004] In addition, with the development of computer computing power, deep learning technology has gradually been applied to the recognition of mechanical water meter readings, including deep network models such as ResNet and YOLO. Deep learning technology uses complex network structures to learn the features in water meter images and use these features to recognize water meter character readings. However, the existing deep learning models used for mechanical water meter reading recognition still have a lot of room for improvement in detection accuracy, model false detection, missed detection, and computational complexity. Summary of the invention

[0005] 1. Technical issues to be resolved

[0006] In view of the deficiencies in the prior art, the present invention provides a method for recognizing readings of a wheel-type mechanical water meter based on a Meter-YOLO model, which can solve the above technical problems.

[0007] (II) Technical solution

[0008] In order to solve the above technical problems, the present invention provides the following technical solutions: a method for recognizing readings of a wheel-type mechanical water meter based on a Meter-YOLO model, comprising the following steps:

[0009] S1: creating a wheel-type water meter dataset, wherein the wheel-type water meter dataset includes a plurality of different wheel-type water meter images;

[0010] S2: Use the wheel-type water meter dataset to train the Meter-YOLO model, where the Meter-YOLO model is an improvement based on the YOLOv8 model;

[0011] S3: Use the trained Meter-YOLO model to recognize water meter readings on the wheel-type water meter image.

[0012] Preferably, the Meter-YOLO model includes a backbone network, a feature fusion structure and a detection head.

[0013] Preferably, a multi-scale hole attention mechanism is embedded at the end of the backbone network of the Meter-YOLO model, and the Meter-YOLO model uses the backbone network to extract image features of the wheel-type water meter image to output multiple different feature maps.

[0014] Preferably, the feature fusion structure of the Meter-YOLO model adopts a Slim-Neck structure, and the Meter-YOLO model uses the feature fusion structure to fuse features of multiple different feature maps.

[0015] Preferably, the detection head of the Meter-YOLO model is a multi-scale detection head, and the Meter-YOLO model uses the detection head to perform border regression and character prediction classification on the feature map after feature fusion to realize water meter reading recognition.

[0016] Preferably, the detection head uses GIoU loss for bounding box regression.

[0017] Preferably, the multi-scale hole attention mechanism (MSDA) is expressed as:

[0018] h i =SWDA(Q i , K i , V i , r i ), 1≤i≤n

[0019] X=Linear(Concat[h1,...,h n ])

[0020] Among them, r i is the hole coefficient of the ith head, Q i , K i and V i It represents the slice of the feature map input to the i-th head, Concat represents concatenating the output results of different heads, and Linear represents sending it to the linear layer for feature fusion.

[0021] Preferably, the Slim-Neck structure includes the following three modules: GSConv, GS bottleneck and VoV-GSCSP.

[0022] Preferably, the calculation formula of GIoU loss is as follows:

[0023]

[0024] Among them, IoU represents the intersection over union of the predicted box and the true box, C represents the area of ​​the minimum bounding box; A∪B represents the union area of ​​the predicted box and the true box; C\(A∪B) represents the difference between the minimum bounding box and the union of the predicted box and the true box, that is, the area of ​​the part of C that does not belong to A∪B; |X| represents the area measurement of set X.

[0025] Preferably, step S1 specifically includes: photographing and uploading a plurality of different wheel-type water meter images to prepare a wheel-type water meter data set, and further labeling the wheel-type water meter images in the wheel-type water meter data set.

[0026] (III) Beneficial effects

[0027] Compared with the prior art, the present invention provides a method for identifying readings of a wheel-type mechanical water meter based on a Meter-YOLO model, which has the following beneficial effects: the present invention adopts the Meter-YOLO model to identify readings of a wheel-type mechanical water meter, wherein the Meter-YOLO model is an improvement based on the YOLOv8 model. Compared with the prior art, the Meter-YOLO model of the present invention can enhance the information fluidity of the feature extraction network while ensuring the overall lightweight of the network, effectively reducing the computational complexity of the model, providing a more comprehensive similarity measurement method for the application scenarios of the wheel-type water meter reading recognition that require positioning accuracy, and improving the model's missed detection and misdetection. The present invention can improve the accuracy, speed, and robustness of the wheel-type mechanical water meter reading recognition, and can more effectively perform the recognition of the wheel-type mechanical water meter reading. While ensuring high accuracy, it is also suitable for actual application scenarios with limited resources, providing an effective solution for improving the accuracy of reading recognition, effectively improving the detection accuracy, and effectively reducing the phenomenon of model misdetection, missed detection, and the like. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a flowchart of the steps of the method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model of the present invention;

[0029] Figure 2 It is a structural diagram of the Meter-YOLO model of the present invention;

[0030] Figure 3It is a structural diagram of the MSDA module of the Meter-YOLO model of the present invention;

[0031] Figure 4 It is a Slim-Neck structure diagram of the Meter-YOLO model of the present invention;

[0032] Figure 5 It is a structural diagram of the GSConv module of the Meter-YOLO model of the present invention;

[0033] Figure 6 It is a structural diagram of the GS bottleneck module of the Meter-YOLO model of the present invention;

[0034] Figure 7 It is a structural diagram of the VoV-GSCSP module of the Meter-YOLO model of the present invention;

[0035] Figure 8 It is a curve change diagram of various indicators in the model training process of the present invention;

[0036] Fig. 9 The image of the wheel-type water meter which is difficult to identify is concentrated in the wheel-type water meter data set of the present invention. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] The present invention is applied to the reading recognition of a digit wheel type mechanical water meter. The digit wheel type mechanical water meter is a digit wheel type water meter. The digit wheel type water meter adopts a digit wheel type digital display. The reading of each digit wheel is recognized to obtain the reading of the digit wheel type water meter.

[0039] The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model of the present invention comprises the following steps:

[0040] S1: Create a wheel-type water meter dataset, wherein the wheel-type water meter dataset includes a plurality of different wheel-type water meter images.

[0041] In the preparation of the wheel-type water meter dataset, the dataset can be prepared by installing a camera and upload module on the meter end of the wheel-type mechanical water meter in the actual production environment, shooting and compressing the uploaded wheel-type water meter images, and annotating the wheel boundary box and wheel reading of the water meter image data through Labelme annotation software.

[0042] Specifically, a total of 16,488 wheel-type water meter images of more than 20 styles were selected for annotation to facilitate sufficient testing and evaluation of the model. In the acquisition process, the continuity of water meter readings was taken into account to avoid repeated shooting of water meter images with the same readings, and water meter images of different dates and time periods were randomly selected.

[0043] Preferably, the image dataset of the water meter collected by the present invention not only covers water meters of various specifications and styles, but also has the following challenges and data diversity:

[0044] (1) Interference of water meter working environment on identification

[0045] The digit wheel type water meter is usually installed in a relatively concealed, insufficiently lit and high humidity environment, such as underground pipes, under manhole covers or in wall corners. The dim light or reflection caused by these conditions, dew or blur caused by humidity and other phenomena will introduce additional interference factors during shooting, bringing considerable challenges to the recognition task, so that the present invention can be better applied to the digit wheel type water meter reading recognition in actual environments.

[0046] (2) Challenges of “half-character” recognition

[0047] In the daily operation of the wheel-type mechanical water meter, the water meter wheel may stay between two numbers, which leads to the so-called "half-character" situation. By adding half-characters and other incompletely displayed characters to the wheel-type water meter data set, the present invention can more correctly interpret the values ​​displayed by the half-characters.

[0048] (3) Diversity of shooting angles and wheel styles

[0049] The shooting angle of the wheel-type water meter may vary depending on the installation location, resulting in the angle tilt or perspective distortion of the characters in the image. In addition, water meters of different manufacturers and models also have differences in the wheel style, such as font size, shape, color, quantity configuration, etc. The wheel-type water meter dataset of the present invention contains the diversity of the above different water meters to ensure that the Meter-YOLO model can learn and adapt to recognition in various practical situations.

[0050] (4) External obstruction and impurities

[0051] The image of the wheel-type water meter may contain external obstructions caused by the installation environment or operation, such as dust, rust and other impurities on the water meter glass.

[0052] The wheel-type water meter dataset includes wheel-type water meter images with the above-mentioned challenging factors, which can make the training and testing process of the Meter-YOLO model of the present invention closer to the actual application scenario, so as to improve the generalization ability and robustness of the model; constructing a diverse wheel-type water meter dataset is to ensure that the wheel-type mechanical water meter reading recognition model constructed by the present invention has high accuracy and practicality, and shows excellent recognition performance in actual industrial environments.

[0053] in, Fig. 9 The following are some images of water meter with wheel type that are difficult to identify in the water meter dataset. Fig. 9 It can be seen that different styles of water meters (produced by different manufacturers) as well as shooting angles and environments will cause great changes in images in many factors, such as size, aspect ratio, color, style, character position, number of characters, etc., and their common features need to be used to improve recognition. Irrelevant character information on the dial, such as number, range, and barcode, can easily interfere with the recognition results.

[0054] In addition, for the preparation of the word wheel water meter data set, 67% of the images in the word wheel water meter data set can be randomly selected to train the Meter-YOLO model, and the other 33% are used for model verification and testing. The structure of the word wheel water meter data set can be specifically shown in Table 1 below:

[0055] Table 1 Structure of the wheel water meter dataset

[0056]

[0057] S2: The Meter-YOLO model is trained using the wheel-type water meter dataset, where the Meter-YOLO model is an improvement based on the YOLOv8 model.

[0058] YOLO (You Only Look Once) is a series of groundbreaking object detection networks, whose advantage is that it can achieve real-time object detection while maintaining high accuracy. YOLO transforms the problem of object detection into a regression problem, directly predicting bounding boxes and category probabilities in a single neural network. Compared with traditional object detection methods, YOLO does not require a separate region extraction step. It divides the image into grids, and each grid cell is responsible for predicting the object whose center falls within the cell. Each version of YOLO has tried to balance the accuracy and speed of detection, including continuous optimization and improvement of the bounding box prediction mechanism, network architecture, and training strategy. In 2015, YOLOv1 first proposed to convert the object detection task directly into a regression problem, predicting bounding boxes and classifications in one step. In 2016, YOLOv2 (also known as YOLO9000) added batch normalization to YOLOv1, used anchors to improve accuracy, and supported the detection of images of different sizes. In 2018, YOLOv3 further added multi-scale detection and a deeper network structure, which further improved the detection accuracy and speed. In 2020, YOLOv4 and YOLOv5 (Zhu et al., 2021) continued to optimize speed and accuracy, introduced new training techniques and a new network architecture called CSPNet to improve previous versions, and provided more powerful feature extraction capabilities and detection effects.

[0059] The YOLOv8 model on which the present invention is based was launched in 2023 (Reis et al., 2023), which represents the latest progress in the YOLO series; compared with the traditional visual detection method, the YOLO model, a target detection algorithm based on deep learning, can classify the different wheel images detected in the water meter, that is, recognize the wheel readings, and can also provide position information such as the wheel bounding box at the same time, which is a function that traditional visual detection cannot achieve. The YOLOv8 model is mainly composed of three parts: a backbone network (Backbone) for extracting image features, a connection part (Neck) for fusing multi-layer features, i.e., a feature fusion structure, and a head (Head) for outputting classification and positioning predictions, i.e., a detection head. Considering the multi-scale characteristics of objects, three scale detection heads are used to adapt to targets of different scales.

[0060] The Meter-YOLO model of the present invention is based on YOLOv8 as the basic model, and improves and optimizes the YOLOv8 model from three perspectives: attention mechanism, feature fusion and loss function. That is, the Meter-YOLO model also includes a backbone network, a feature fusion structure and a detection head. For the small-size feature map of the wheel-type water meter image, the Meter-YOLO model of the present invention embeds a multi-scale hole attention mechanism at the end of the backbone network to optimize the feature extraction performance of the backbone network, and splices the output feature maps of three different scales into a Slim-Neck module for feature fusion. Finally, the GIoU loss function is used in the multi-scale detection head to optimize the similarity calculation of the bounding box (i.e., the border, i.e., the wheel-type bounding box) regression. The structure of the Meter-YOLO model is as follows: Figure 2 As shown:

[0061] (1) The present invention embeds a multi-scale void attention mechanism (module) into the backbone network CSPDarknet53 of the YOLOv8 model. This attention mechanism can enhance the information flow of the feature extraction network while ensuring the overall lightweight of the network.

[0062] (2) In order to maintain model accuracy and reduce latency and computing resource consumption, and optimize the computational cost of the reading recognition model, the Meter-YOLO model of the present invention uses a Slim-Neck structure in the feature fusion structure to replace the PAN-FPN structure in the YOLOv8 model. The Slim-Neck structure fuses the three different levels of feature representations B3-B5 extracted from the backbone network and reuses the feature information, effectively reducing the computational complexity of the model.

[0063] (3) In the two independent branches of the detection head, the present invention adopts the GIoU loss function for the bounding box prediction regression task of the wheel-type water meter to perform calculations, providing a more comprehensive similarity measurement method for the wheel-type water meter reading recognition application scenario that requires positioning accuracy, thereby improving the model's missed detection and false detection situations.

[0064] The following further describes the Meter-YOLO model of the present invention in detail from the aspects of attention mechanism, feature fusion and loss function.

[0065] 1. Attention Mechanism:

[0066] In the specific application scenario of wheel-type mechanical water meter reading recognition, the main challenge lies in identifying and detecting wheel-type digital characters from complex backgrounds. As a convolutional neural network (CNN) model, YOLOv8 is famous for its powerful feature extraction and fast detection capabilities, but it is essentially local processing and cannot obtain the relationship between global features. This is especially true when dealing with a lot of complex and irrelevant character information on the water meter dial. CNN may not be able to effectively distinguish the subtle differences between numbers and backgrounds on a global scale. Compared with the traditional CNN model, the Transformer-based model can use its attention mechanism to capture the dependencies between any pixels on a global scale, thereby effectively improving recognition accuracy.

[0067] The working principle of the attention mechanism is as follows: First, by encoding the input data sequence, we get [x1, x2, x3, ..., x T Then, through the linear transformation matrix W Q , W K , W V We obtain three matrices of query Q, key K, and value V. We calculate the dot product between the query Q and the corresponding key, normalize it, and finally multiply it with the matrix V to get the weighted sum. Prevent the gradient of the result from disappearing, where represents the dimension of the matrix K. The attention formula is shown in the following formula (1):

[0068]

[0069] However, there is a key problem with the traditional attention mechanism, which is that it will bring high computational complexity and large memory consumption. The introduction of such a mechanism may seriously occupy hardware resources and affect the inference speed of the model. In order to alleviate this resource burden, some researchers have proposed the concept of sparsity (Child et al., 2019), that is, to reduce the consumption of the attention mechanism by reducing the number of key-value pairs calculated. Based on these considerations, a series of sparsity-based attention variants have been developed, such as local attention (Luong et al., 2015), deformable attention (Zhu et al., 2020) and hollow attention (Yang et al., 2022). Although these methods provide improvements in computation and memory usage, they are usually based on artificially set static modes and cannot dynamically adjust sparsity according to changes in content. To solve these problems, the present invention introduces the multi-scale hollow attention (MSDA) mechanism (Jiao et al., 2023). The core idea of ​​MSDA is to apply self-attention at different scales, which can not only capture local features, but also capture long-range dependencies through a larger hollow receptive field. Compared with other attention mechanisms, the advantages of MSDA are:

[0070] (1) Multi-scale design: MSDA sets different dilation coefficients in different heads, allowing the network to adaptively focus on different scales when learning specific character features, and to perform more refined division and focused processing of key features.

[0071] (2) Computational efficiency: MSDA uses a dilated attention operation, which is similar to a dilated convolution. It can increase the receptive field without reducing the resolution of the feature map. At the same time, due to its sparsity, it can reduce unnecessary global calculations and improve computational efficiency.

[0072] (3) Dynamic sparsity: MSDA dynamically performs self-attention calculations on key patches in the surrounding area through a sliding window hole attention (SWDA) operation. Compared with some local attention models, MSDA can adapt to image content more flexibly instead of being simply restricted to a fixed-size neighborhood.

[0073] The structure of MSDA is as follows Figure 3 As shown in the figure, MSDA first receives an input feature map X and obtains the corresponding query, key and value matrices through linear projection transformation. Then, the number of channels of the feature map is equally divided into n heads, each head processes a subset of the feature map, and performs multi-scale sliding window dilated attention (SWDA) operations on different heads with different dilated coefficients r.

[0074] SWDA performs sparse sampling to select keys and values ​​in a sliding window centered at each position (i, j) in the query matrix Q. The size of the sliding window is set to w×w. The degree of coefficient of selecting keys and values ​​in the window is controlled by defining the hole coefficient r. As the hole coefficient increases, the selected keys and values ​​will be more dispersed in space, allowing a larger receptive field to be covered. Self-attention calculations are then performed on these keys and values. The output X of SWDA has the value x at position (i, j) ij for:

[0075]

[0076] Among them, H and W represent the height and width of the feature map respectively, and K r and V r Represents the value sampled from K and V. For a given position (i, j), self-attention calculation is performed, and the key and value are selected from the position (i′, j′):

[0077] {(i′,j′)|i′=i+p×r,j′=j+q×r},

[0078]

[0079] For queries located at the edge of the feature map, a zero-filling strategy is used when performing self-attention calculations to maintain the size of the feature map. Through this query-centric sparse selection of keys and values, SWDA can meet locality and sparsity, effectively model long-distance dependencies, and reduce the amount of computation.

[0080] MSDA can be expressed as:

[0081] h i =SWDA(Q i ,K i ,V i ,r i ),1≤i≤n

[0082] X=Linear(Concat[h1,...,h n ]) (4)

[0083] Among them, r i is the hole coefficient of the ith head, Q i , K i and V i It represents the slice of the feature map input to the i-th head, and Concat represents the output results h of different heads. i For splicing, Linear means sending it to the linear layer for feature fusion.

[0084] By setting different hole coefficients for different heads, MSDA can effectively aggregate semantic information at various scales within the attention receptive field, and effectively reduce the redundancy of the self-attention mechanism without increasing complex operations and additional computational costs.

[0085] MSDA provides a method for the reading recognition of wheel-type mechanical water meters that can not only capture local fine features but also understand the relationship between characters in a wider field. It combines the global attention range of Transformer and the computational efficiency of CNN, effectively making up for the shortcomings of traditional CNN and global attention models.

[0086] The present invention embeds MSDA into the backbone network of the Meter-YOLO model, so that the Meter-YOLO model can more effectively identify the readings of the wheel-type mechanical water meter. While ensuring high precision, it is also suitable for practical application scenarios with limited resources, providing an effective solution for improving the accuracy of reading recognition.

[0087] 2. Feature Fusion:

[0088] In the application of wheel-type mechanical water meter reading recognition, an accurate and efficient detection model is crucial for deployment and use in practical application scenarios. The YOLO series of target detectors have been widely used in the industrial field due to their efficient detection effects, and the latest YOLOv8 architecture provides extremely high accuracy in applications, but its computational cost still has room for optimization on edge computing devices. In order to reduce latency and computing resource consumption while maintaining accuracy, the present invention introduces a new Slim-Neck structure (Li et al., 2022), which replaces the feature fusion part in the original YOLOv8 model network, thereby optimizing the network's performance in feature fusion.

[0089] The main goal of the Slim-Neck structure design is to reduce the computational complexity and inference time of the detector while maintaining accuracy. Its structure mainly consists of three modules: GSConv, GS bottleneck and VoV-GSCSP. The structure of Slim-Neck is as follows Figure 4 shown.

[0090] In order to speed up the prediction, the image input to CNN always undergoes a similar conversion process, that is, the spatial information is gradually transferred to the channel. However, each spatial (width and height) compression and channel expansion of the feature map will result in the loss of some semantic information. The standard convolution operation (SC) maximizes the retention of the hidden connections between each channel, while the depthwise separable convolution (DSC) completely cuts off this part of the connection. This defect causes the feature extraction and fusion capabilities of the depthwise separable convolution to be much lower than that of ordinary convolution. Therefore, many lightweight networks such as Xception (Chollet et al., 2017), MobileNets (Howard et al., 2017) and ShuffleNets (Zhang et al., 2018), although they greatly improve the speed of the detector through the depthwise separable convolution operation, have led to a decrease in accuracy. Compared with other convolution methods (SC, DSC and ShuffleNet methods), the Slim-Neck structure GSConv can retain the hidden connections between each channel as much as possible at a lower computational cost (close to 50% of the standard convolution), especially when the channel of the feature map is wide, it provides significant computational efficiency improvement. The basic structure of the GSConv module is as follows: Figure 5 shown.

[0091] The GSConv module performs a depth-separable convolution operation on the input feature map after ordinary convolution, and then splices the results of the two convolutions. The spliced ​​feature map is then subjected to a random permutation operation on the feature channels, which rearranges the feature channels and improves the information flow between features, making the final output result closer to the accuracy of ordinary convolution while reducing its computational complexity and improving operating efficiency.

[0092] Based on GSConv, the Slim-Neck structure introduces the GS bottleneck module to further refine and compress the feature map (the GS bottleneck module is located at Figure 4 Between the "GSConv module" and "splicing", Figure 4 The GS bottleneck module is not shown in the figure to reduce the complexity of the computational task, and then the VoV-GSCSP (Cross Stage Partial Network with One-Shot Aggregation) module is used to expand the information flow channel and reuse information with efficient use of resources; this design enables features to propagate quickly within the network while avoiding repeated calculations. The structures of the GS bottleneck module and the VoV-GSCSP module are shown in Figure 1. Figure 6 , Figure 7 shown.

[0093] like Figure 6 As shown in Figure 2, the GS bottleneck module improves the learning ability of the model by superimposing the GS Conv module and enhances the feature processing performance of the network. Figure 7 As shown in the figure, the VoV-GSCSP module further integrates the information of ordinary convolution on the basis of the GS bottleneck module, reuses the information, and improves the efficiency of feature utilization and network performance.

[0094] 3. Loss function:

[0095] In the task of recognizing the readings of a wheel-type mechanical water meter, the main task of the model is to identify the position of the wheel on the water meter dial and its readings. This requires the model to accurately locate and recognize numbers. At the same time, the shapes, sizes, and spacing of numbers on water meters of different specifications and styles may vary. Therefore, using a reasonably designed loss function can effectively improve the detection performance of the model.

[0096] The YOLOv8 model uses the distribution focus loss (DFL) (Lin et al., 2017) and the completeness intersection over union (CIoU) (Zheng et al., 2020) to calculate the bounding box regression loss, but CIoU has the following limitations in the specific scenario of wheel-type mechanical water meter reading recognition:

[0097] (1) First, CIoU does not explicitly consider the balance between sample difficulty. In the task of recognizing water meter readings with a wheel, the water meter wheel may become difficult to recognize due to factors such as lighting, reflection, or water stains. CIoU does not make special treatments on the distribution of difficult and easy samples, which will reduce the model's ability to recognize wheel numbers under these conditions.

[0098] (2) Secondly, CIoU uses the aspect ratio of the bounding box as part of the loss function. However, in the water meter reading scenario, even if the aspect ratio of the true box and the predicted box is the same, if the absolute sizes of their width and height do not match, it will still have a great impact on digital recognition, and the penalty term of CIoU may not accurately reflect the difference in the absolute sizes of width and height.

[0099] (3) Finally, the CIoU loss calculation includes inverse trigonometric function operations, which are more time-consuming and increase the computing power consumption of the model. The CIoU calculation formula is as follows (5):

[0100]

[0101] In the above formula (5), the intersection over union (IoU) represents the intersection ratio between the predicted box and the true box; ρ 2 (b,b gt ) represents the Euclidean distance between the center point of the real box and the predicted box; h and w represent the height and width of the predicted box respectively; h gt and w gt Represents the height and width of the real box respectively; c h and c w Represents the height and width of the smallest enclosing box formed by the predicted box and the true box.

[0102] The GIoU loss (Rezatofighi et al., 2019) adopted by the detection head of the Meter-YOLO model of the present invention is an improved method for calculating the similarity of bounding boxes in target detection. It is proposed to solve the limitations of the traditional intersection-over-union (IoU) loss indicator. In some cases, even if the predicted box does not overlap or only partially overlaps the real box, the traditional IoU cannot effectively reflect the degree of this offset. The introduction of GIoU aims to provide a more comprehensive similarity measurement method. GIoU loss measures the similarity between the predicted box and the real box by introducing a minimum closed box to include the two boxes involved in the comparison. Compared with simple IoU, GIoU can still provide gradient updates when the predicted box and the real box do not overlap. This feature is particularly beneficial for applications that require positioning accuracy. The calculation formula of GIoU loss is shown in the following formula (6):

[0103]

[0104] Among them, IoU represents the intersection over union of the predicted box and the true box, C represents the area of ​​the minimum bounding box; A∪B represents the union area of ​​the predicted box and the true box; C\(A∪B) represents the difference between the minimum bounding box and the union of the predicted box and the true box, that is, the area of ​​the part of C that does not belong to A∪B; |X| represents the area measurement of set X.

[0105] The value of GIoU will never exceed the value of IoU, and the value range is [-1,1]. When the predicted box overlaps with the real box, it takes the maximum value of 1, and GIoU is equal to IoU. As the non-overlapping area between the predicted box and the real box increases, the value of GIoU will decrease, and when there is no intersection and the two are infinitely far apart, the minimum value of -1 is taken, which can better show the degree of separation between the boxes.

[0106] The present invention can achieve the following beneficial effects by introducing GIoU into the target bounding box regression loss: on the one hand, GIoU provides a more stable gradient update, and through the concept of the minimum bounding box, it can provide the model with continuous and effective gradient feedback even when the predicted box does not overlap with the true box. In the digital detection task of the wheel-type mechanical water meter, when encountering a large number of non-overlapping prediction boxes, it can bring performance improvement; on the other hand, unlike the CIoU loss involving complex geometric calculations such as inverse trigonometric functions, the GIoU loss does not integrate additional complex penalty terms of aspect ratio and center point distance, and is simpler and more intuitive in form, easy to implement and has high computational efficiency. This simplification reduces the difficulty of optimization, especially in tasks such as water meter reading recognition, where the accuracy of digital position often outperforms the perfect matching of aspect ratio, and the simplicity of GIoU can well meet this demand.

[0107] S3: Use the trained Meter-YOLO model to recognize water meter readings on the wheel-type water meter image.

[0108] It can be understood that after the Meter-YOLO model is trained using the word-wheel water meter dataset, the word-wheel water meter image to be identified is further input into the Meter-YOLO model for reading recognition. Finally, the Meter-YOLO model can output the reading recognition result corresponding to the word-wheel water meter image to be identified.

[0109] The following is an experimental analysis of the relevant models to verify the performance of the Meter-YOLO model of the present invention for the recognition of the readings of the wheel-type mechanical water meter.

[0110] 1. Experimental environment and training strategy

[0111] The hardware platform and environment parameters used in the experimental training phase are shown in Table 2.

[0112] Table 2 Training environment and hardware platform parameters

[0113]

[0114] In order to facilitate flexible deployment on hardware devices in various application scenarios, the YOLOv8 model generates five different scaling models by adjusting the width and depth parameters. These models are called YOLOv8n, YOLOv8s, YOLOv8m, YOLOv8l and YOLOv8x. The number of parameters and resource consumption of these five models increases successively, and the detection performance is getting better and better. The channel width, depth and maximum number of channels corresponding to these five models are shown in Table 3.

[0115] Table 3 Parameters corresponding to YOLOv8 of different sizes

[0116]

[0117] In order to better study and improve the model, the present invention selects YOLOv8s as the baseline model. Some key parameter settings in the model training process are shown in Table 4. In order to accelerate model convergence, Mosaic data enhancement is turned off in the last 10 stages of the training process.

[0118] Table 4 Key parameters set during model training

[0119]

[0120] 2. Evaluation indicators

[0121] In order to comprehensively evaluate the performance of the improved target detection model proposed in the present invention, namely the Meter-YOLO model, the present invention uses the performance of accuracy (Precision), recall rate (Recall), mean average precision (mAP) under different intersection over Union (IoU) thresholds, and the indicator of model computational complexity GFLOPs (billion floating point operations) to measure the performance of different aspects of the model.

[0122] Precision is one of the key indicators for judging the prediction accuracy of the model, reflecting the proportion of samples classified as positive that are actually positive. The accuracy is directly related to the frequency of false positives generated by the model in practical applications. Its calculation formula is shown in the following formula (7):

[0123]

[0124] Among them, TP (True Positives) represents the number of positive samples detected correctly, and FP (False Positives) represents the number of negative samples mistakenly judged as positive samples.

[0125] Recall is the ratio of the number of positive samples detected by the model to the total number of positive samples. It is an important indicator for evaluating the level of missed detection of the model. Its calculation formula is shown in the following formula (8):

[0126]

[0127] Among them, FN (False Negatives) refers to the number of positive samples that are mistakenly classified as negative samples.

[0128] The mean average precision (mAP) is a widely used indicator to evaluate the performance of object detection models. It provides a performance measure by aggregating the average accuracy (AP) of the model on all categories, which comprehensively reflects the detection ability of the model for all categories. For a single category, AP is the area under the accuracy and recall curve of the category, that is, the integral of precision and recall. Its calculation formula is shown in the following formula (9):

[0129]

[0130] The calculation of mAP involves the area under the precision and recall curves at different IoU thresholds. The calculation formula is shown in the following formula (10):

[0131]

[0132] Where N is the total number of categories, AP iis the average precision of the i-th category. mAP0.5 represents the mAP value when the IoU threshold is 0.5, and mAP0.5:0.95 represents the average mAP value under the IoU threshold from 0.5 to 0.95 with a step size of 0.05. mAP0.5 emphasizes the accurate detection and positioning of the target, while mAP@0.5:0.95 provides a more comprehensive evaluation, reflecting the consistency and robustness of the model under multiple IoU thresholds from loose to strict.

[0133] GFLOPs (Giga Floating-Point Operations) is an indicator to measure the computational complexity of the model in the inference stage. It indicates the number of floating-point operations (in billions) required for the model to perform a forward propagation. This indicator is closely related to the efficiency and practicality of the model, especially in resource-constrained deployment environments. Models with lower GFLOPs values ​​can achieve faster inference speeds and lower energy consumption while maintaining performance, which is a key consideration for edge computing and real-time application scenarios.

[0134] 3. Loss function comparison experiment

[0135] In this section, we verify the superiority of introducing GIoU as a loss function to improve the performance of the YOLOv8s model. In order to ensure the fairness and comparability of the experiment, all other training conditions remain the same except for the use of different loss functions.

[0136] The experimental results are shown in Table 5 below, which shows the performance comparison of the YOLOv8s model on the word wheel water meter dataset when using different loss functions such as SIoU (Gevorgyan, 2022), EIoU (Zhang et al., 2022), and MPDIoU (Siliang et al., 2023).

[0137] Table 5 Comparison of detection results of YOLOv8s with different loss functions

[0138]

[0139] From the experimental results in Table 5, it can be seen that when GIoU is used as the bounding box regression loss function of the model for training, the model achieves the best detection performance, and the results are better than those using other loss functions. When GIoU loss is used, the mAP0.5 and mAP0.5:0.95 indicators of the model are improved by 0.2% compared with the CIoU loss used in the original model, the accuracy is improved by 0.6% and the recall is improved by 1.0%. Therefore, the experiment proves the effectiveness of introducing the GIoU loss function on the model's performance in predicting water meter readings.

[0140] 4. Comparative experiment

[0141] In order to illustrate the superiority and effectiveness of the improved model proposed in the present invention, the present invention compares the proposed model Meter-YOLO model with other YOLO series models widely used in the reading detection of digital wheel mechanical water meters. The models compared in the present invention include:

[0142] YOLOv3 first introduced the concept of multi-scale detection, significantly improving the model's ability to detect targets of different sizes; YOLOv4 introduced the concept of CSPNet structure, using the CSPDarknet53 backbone network to achieve lightweight while maintaining high detection accuracy and reducing model complexity; YOLOv5 optimizes performance by using Mosaic data enhancement and Focus structure. Mosaic data enhancement can improve model training speed and multi-scale detection effects, while the Focus structure reduces the amount of calculation and the number of parameters without losing detection performance. YOLOv7 uses the efficient network architecture ELAN to further optimize the performance of the model. The results of the comparative experiment are shown in Table 6 below.

[0143] Table 6 Comparative experimental results of some YOLO series models and the model proposed in this invention

[0144]

[0145] Table 6 above shows the performance comparison of various YOLO series algorithms in terms of computational complexity, detection accuracy, etc. In the application scenario of automatically reading the readings of a wheel-type mechanical water meter, the operating efficiency and accuracy of the model are particularly important. According to the experimental results in Table 6, the earlier YOLO series algorithm, YOLOv3-Tiny, achieved lightweight models, but lost a large part of the detection accuracy. Compared with other YOLO versions, YOLOv5s and YOLOv8s have smaller model sizes, lower computational complexity, and better detection performance. Compared with YOLOv8s, the improved model (Meter-YOLO model) proposed in the present invention has reduced the computational complexity by 2.6GLOPS, while achieving a higher average detection accuracy and overall detection performance of 98.2% on the wheel-type water meter dataset.

[0146] Figure 8 The changing trends of key performance indicators of the Meter-YOLO model proposed in this invention during the training process are shown. The changes in these indicators reflect the process of model learning efficiency and performance improvement.

[0147] 5. Ablation experiment

[0148] In order to verify the effectiveness of the various improvement strategies proposed in the present invention, an ablation experiment is performed on the baseline model using the wheel-type water meter dataset. The experimental results are shown in Table 7. In Table 7, GIoU, Slim-Neck and MSDA represent the corresponding improvement strategies, and √ indicates that this improvement strategy is used. The present invention uses the above YOLOv8s as the baseline model.

[0149] Table 7 Detection results after introducing different improvement strategies

[0150]

[0151] The experimental results in Table 7 above show that when applied to the baseline model, each improvement strategy of the present invention improves the detection performance to varying degrees. GIoU is introduced in the prediction box regression loss. GIoU can provide better gradient information and effectively handle the situation of non-overlapping bounding boxes, which improves mAP by 0.2% and recall by 1%. Slim-Neck replaces the Neck part in the original model, reducing the computational cost and improving the learning ability of the model, reducing the computational complexity by 3.5 GFLOPS. Finally, the Multi-Scale Dilated Attention (MSDA) mechanism (module) is introduced into the backbone network to effectively capture multi-scale semantic information and reduce the redundancy of the self-attention mechanism, requiring only a very small computational cost, so that mAP and accuracy are improved. Finally, the improved model has been effectively improved in most detection metrics, especially in detection accuracy, with mAP reaching 98.2%, and the model computational complexity is also reduced by 2.6 GFLOPS compared with the baseline model, and it is also better than the baseline model in other indicators.

[0152] It can be understood that the present invention proposes an improved model Meter-YOLO for the task of recognizing the readings of a wheel-type mechanical water meter based on the YOLOv8 model architecture. First, the Meter-YOLO model integrates the GIoU loss function to more effectively handle the problem of non-overlapping bounding boxes and provide better quality gradient information, thereby enhancing the overall detection performance of the model. Secondly, the present invention adopts a lighter and more efficient Slim-Neck structure to replace the Neck layer in the original architecture, significantly reducing the computational complexity of the model by 2.6GFLOPS. Finally, the performance of the Meter-YOLO model is significantly improved by embedding the MSDA module into the backbone network. After the above improvements, the present invention has achieved a detection accuracy of 98.2% in the above-mentioned wheel-type water meter data set, and the accuracy and recall rate have increased by 1.1% and 0.6% respectively compared with the YOLOv8s baseline model, effectively reducing the model's false detection and missed detection phenomena. In multiple key indicators, the present invention has shown superior performance than other YOLO series models.

[0153] With the development of computer vision and deep learning technology, these technologies play a very important role in many fields. At present, there are still many challenges in the reading of mechanical water meters. In the natural use environment, the image collection conditions of the water meter are difficult to control, so there are image quality problems caused by uneven brightness, dust accumulation, angle offset, fog blur and different shooting angles. The present invention studies in detail the actual difficulties of mechanical water meter reading recognition. For the digital wheel mechanical water meter, the deep learning technology is used to design and optimize the corresponding reading algorithm. Combined with computer technology, a water meter automatic reading system is built for application. Specifically, the present invention has the following beneficial effects:

[0154] (1) In view of the problem that there are few publicly available data sets in the current research on mechanical water meter reading recognition, the present invention constructs a large-scale and diverse wheel-type water meter data set, which covers 16,488 wheel-type mechanical water meter images, all of which are from actual working environments and include a variety of wheel-type mechanical water meter styles. More importantly, in order to more comprehensively simulate the actual usage scenario, the above-mentioned wheel-type water meter data set specifically includes images taken under different brightness conditions and various shooting angles, ensuring the diversity and comprehensiveness of the data. Through this data set, the Meter-YOLO model of the present invention can more effectively learn the complex changes of wheel-type water meter images in the natural environment, thereby establishing a more robust and accurate recognition algorithm.

[0155] (2) In order to solve the problem of automatic reading of wheel-type mechanical water meters, the present invention proposes a wheel-type mechanical water meter reading algorithm Meter-YOLO based on improved YOLOv8, and solves the reading problem of wheel-type water meters through an end-to-end target detection method. First, the present invention introduces a multi-scale hole attention (MSDA) mechanism in the feature extraction layer, which takes into account the global perception ability of Transformer and the local feature learning efficiency of CNN, so that it can capture the subtle features in the image more deeply, which is especially important for the small gaps and occlusions that may appear between the wheels. At the same time, MSDA enhances the network's sensitivity to scale changes by using hole convolutions of different sizes in different layers. In addition, in terms of feature fusion, the present invention uses a lightweight Slim-Neck structure to replace the feature fusion module in the original YOLOv8 network structure. The Slim-Neck structure reduces the computational overhead of the network by simplifying the feature path and reducing the number of parameters, while improving the efficiency of feature fusion, so that the model improves detection accuracy while maintaining real-time performance. Finally, the present invention introduces a GIoU loss function that is more suitable for the application scenario of wheel-type water meter reading to calculate the bounding box loss. The GIoU loss optimizes the accuracy of the network's wheel positioning by more effectively evaluating the geometric quality of the bounding box, making the final generated reading more accurate. The present invention verifies the specific contribution of each improvement measure to the performance improvement of the model through a series of ablation experiments and comparative experiments, and demonstrates the excellent performance of the Meter-YOLO model in the wheel-type mechanical water meter reading recognition task.

[0156] (3) In addition, in order to enable users to easily realize automatic reading of water meters, the digit-wheel mechanical water meter reading algorithm proposed in the present invention can be deployed in the server, providing a callable RESTful API service interface, and realizing automatic reading and management of digit-wheel mechanical water meters by building a water meter intelligent reading system, verifying the effectiveness of the recognition method and solving the problem of traditional manual meter reading.

[0157] It should be noted that the terms "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model, characterized in that: The following steps are involved: S1: creating a wheel-type water meter dataset, wherein the wheel-type water meter dataset includes a plurality of different wheel-type water meter images; S2: Using the wheel-type water meter dataset to train the Meter-YOLO model, wherein the Meter-YOLO model is an improvement based on the YOLOv8 model; S3: Using the trained Meter-YOLO model to recognize water meter readings on the wheel-type water meter image.

2. The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model according to claim 1 is characterized in that: The Meter-YOLO model includes a backbone network, a feature fusion structure and a detection head.

3. The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model according to claim 2 is characterized in that: A multi-scale hole attention mechanism is embedded at the end of the backbone network of the Meter-YOLO model, and the Meter-YOLO model uses the backbone network to extract image features of the wheel-type water meter image to output multiple different feature maps.

4. The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model according to claim 3 is characterized in that: The feature fusion structure of the Meter-YOLO model adopts a Sl im-Neck structure, and the Meter-YOLO model uses the feature fusion structure to fuse features of multiple different feature maps.

5. The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model according to claim 4 is characterized in that: The detection head of the Meter-YOLO model is a multi-scale detection head. The Meter-YOLO model uses the detection head to perform border regression and character prediction classification on the feature map after feature fusion to realize water meter reading recognition.

6. The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model according to claim 5 is characterized in that: The detection head uses GIoU loss for bounding box regression.

7. The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model according to claim 6 is characterized in that: The multi-scale hole attention mechanism (MSDA) is expressed as: h i =SWDA(Q i ,K i ,V i ,r i )),1≤i≤n X=Linear(Concat[h1,...,h n ]) Among them, r i is the hole coefficient of the ith head, Q i , K i and V i It represents the slice of the feature map input to the i-th head, Concat represents concatenating the output results of different heads, and Linear represents sending it to the linear layer for feature fusion.

8. The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model according to claim 7 is characterized in that: The Slim-Neck structure includes the following three modules: GSConv, GS bottleneck and VoV-GSCSP.

9. The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model according to claim 8 is characterized in that: The calculation formula of the GIoU loss is as follows: Among them, IoU represents the intersection over union of the predicted box and the true box, C represents the area of ​​the minimum bounding box; A∪B represents the union area of ​​the predicted box and the true box; C\(A∪B) represents the difference between the minimum bounding box and the union of the predicted box and the true box, that is, the area of ​​the part of C that does not belong to A∪B; |X| represents the area measurement of set X.

10. The method for recognizing readings of a wheel-type mechanical water meter based on the Meter-YOLO model according to claim 1, characterized in that: The step S1 specifically includes: photographing and uploading a plurality of different images of the wheel-type water meter to prepare the wheel-type water meter data set, and further labeling the wheel-type water meter images in the wheel-type water meter data set.

Citation Information

Patent Citations

  • Character wheel type water meter reading identification method and device based on deep learning

    CN116778137A

  • Method for identifying digital old water meter based on deep learning

    CN116844172A

  • Water meter reading identification method

    CN117576677A

  • Transformer substation terminal block drawing identification method and system based on computer vision technology

    CN118038481A

  • Character wheel type water meter reading identification method and system using Meter-YOLO model

    CN118629047A

Cited By

  • Heart MRI image segmentation method and system based on space channel reconstruction

    CN118941559A

  • Remote automatic meter reading method and system of intelligent water meter

    CN121583081A