A water meter code intelligent recognition method based on convolutional neural network technology
Through the intelligent recognition method based on convolutional neural network, the problem of poor accuracy of traditional water meter code recognition in complex environments is solved. Through image acquisition and deep learning technology, highly accurate recognition and rotation verification of water meter codes are achieved, reducing errors. Rate.
Patent Information
- Application Number
- CN202010795175.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-10
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2040-08-10
AI Technical Summary
Traditional water meter code recognition algorithms are susceptible to interference from the external environment and are difficult to achieve high accuracy in complex environments, and there are limitations in feature extraction of manually designed algorithms.
An intelligent recognition method based on convolutional neural network is adopted, through image collection, upright and inverted judgment, affine transformation rotation and feature extraction, combined with deep learning technology, using networks such as GoogleNet, ResNet, Mask-RCNN and Faster-RCNN to identify water meters. Code feature identification and verification.
It achieves highly accurate recognition of water meter codes in complex environments, reduces the error rate, and improves recognition accuracy.
Smart Images

Figure CN112001383B
Abstract
Description
Technical Field
[0001] The invention relates to a meter reading method, and in particular to a water meter code intelligent recognition method based on convolutional neural network technology. Background Art
[0002] The traditional algorithm for identifying water meter codes is very susceptible to interference from external complex environments. If you want to achieve a relatively good accuracy rate, there are very high requirements and shooting restrictions on the water meter dial image.
[0003] Compared with the classic image processing algorithm, the image processing technology based on convolutional neural network has achieved great breakthroughs and progress in various fields. In the actual meter reading process, various external factors such as weather, environment, dust, etc. often interfere with the automatic recognition of water meter codes, which poses a great challenge. The feature extraction of artificially designed algorithms often has certain limitations. Through deep learning technology, using convolutional neural networks and back propagation algorithms, combined with a large number of irregular pictures on site, the water meter code features can be extracted very well. Summary of the invention
[0004] The purpose of the present invention is to provide a water meter code intelligent recognition method based on convolutional neural network technology.
[0005] The technical solution to achieve the purpose of the present invention is: a water meter code intelligent recognition method based on convolutional neural network technology, comprising the following steps:
[0006] Step 1: Capture an image of the side of the water meter with the water meter code;
[0007] Step 2: Using the water meter code in the collected water meter image as a standard, a classification algorithm is used to identify and determine whether the water meter image is an upright image or an inverted image, and model parameters for determining whether the water meter image is upright or inverted are obtained;
[0008] Step 3: Identify the mask image of the water meter code of the water meter image, calculate the circumscribed moment, perform affine transformation and rotation according to the angle of the circumscribed moment, and obtain a water meter code image in which the water meter code is placed in a standard horizontal position;
[0009] Step 4: Identify the water meter code image and obtain the coordinates and numerical information of each number in the water meter code.
[0010] The specific steps of step 2 include:
[0011] S1. Produce upright and inverted classification data sets based on the water surface images collected in step 1.
[0012] S2. Network training uses the GoogleNet network as the basis. The final classification layer of the classification data set is modified to 2 categories. The number of some low-level networks is reduced by half based on the original number. From the fourth layer onwards, it is no longer changed. The back propagation algorithm is used to train the classification model. During the training process, random augmentation operations are used in combination with labels to expand the full classification data set.
[0013] S3. Perform convolution operation on the collected water meter images and the trained network, and take the final softmax classification as the output result.
[0014] The step 2 described in the invention is to generate a classification data set of upright and inverted water meters according to the water meter image, wherein the criteria for judging upright and inverted water meters are as follows: when the angle between the water meter code below and the image horizontal line is between 90 and 180 degrees, it is inverted, and the others are upright.
[0015] The specific steps of step three include:
[0016] S1. The water meter code, pointer wheel, and water meter dial in the water meter image are marked by masking, and the rectangular coordinates of the area containing them are stored in a file. The starting coordinates are saved in the form of length, width, and height, and the contour coordinates store the coordinates of each contour point.
[0017] S2. Use resnet50 to extract skeleton features, train the network, and use the Mask-RCNN algorithm to identify the contour results of the water meter code, pointer wheel, and water meter dial.
[0018] S3, combining the standard situation of the water meter features and the classification result of whether the water meter image is upright or inverted obtained in step 2;
[0019] If it is an upright water meter image, then input the image;
[0020] If it is an inverted water meter image, the circumscribed moment of the water meter code is calculated according to the angle between the water meter code and the horizontal line of the image; the inverted water meter image is rotated by affine transformation until the water meter code is in a standard posture and the image is output.
[0021] The specific steps of step 4 include:
[0022] S1. Obtain upright water meter images, manually mark the digital positions of each image to create a training set and a validation set, which account for 90% and 10% of the total number of images respectively, and use a deep residual network (ResNet-18) for training.
[0023] S2. After training, the model selects the parameters that perform best on the validation set for actual detection, and obtains the target character coordinates and values through the image output in step 3.
[0024] The specific steps of step 4 also include:
[0025] S3. Sort all character results left and right according to the coordinates, and then calculate the interval between every two characters. Considering the characteristics of water meter codes, the distances between water meter codes are basically equal or proportional. By calculating the standard deviation of the intervals, the obviously abnormal character intervals are removed according to the standard deviation value.
[0026] S4. According to the reasonable character coordinate array obtained in S3, if some coordinates are very close, it means that there are multiple results or hyphens appear here. There are two cases. If there is no hyphen, take the number with a larger Faster-RCNN prediction probability. If a hyphen appears, directly take the larger number among the hyphens, for example, 5_6, the current number is set to 6.
[0027] By adopting the above technical scheme, the present invention has the following beneficial effects: the present invention collects water meter image data, determines whether the water meter image is upright or inverted based on the digital code, identifies the key area of the water meter code of the upright or inverted water meter image, extracts the water meter code by the external moment method, rotates the water meter code to the standard position by affine transformation, identifies the pointer character wheel on the water meter for digital code verification, further determines whether the water meter is upright or inverted based on the image relationship between the character wheel and the water meter code, further corrects the rotation mode of the water meter code, obtains the digital position of each water meter code and the classification result based on the rotated water meter code by using the image recognition technology based on the convolutional neural network, corrects the final result by using the linear fitting method based on the prior knowledge of the water meter, calculates the water meter code value, and realizes intelligent water meter value recognition with low error rate and accurate recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below according to specific embodiments and in conjunction with the accompanying drawings, wherein
[0029] Figure 1 It is a flowchart of the present invention;
[0030] Figure 2 It is a schematic diagram of the water meter code of the present invention being rotated to a standard position;
[0031] Figure 3 A schematic diagram of a hyphenated water meter code of the present invention; DETAILED DESCRIPTION
[0032] Embodiment 1
[0033] See Figure 1 The water meter code intelligent recognition method based on convolutional neural network technology of this embodiment includes the following steps:
[0034] Step 1: Capture images of the side of the water meter with the water meter code; use a mobile phone and a meter reading pole to shoot water meters at any angle, including outdoor water meters and indoor water meters, and water meters with various weather, dust, mud and other environmental factors.
[0035] Step 2: Using the water meter code in the collected water meter image as a standard, a classification algorithm is used to identify and determine whether the water meter image is an upright image or an inverted image, and model parameters for determining whether the water meter image is upright or inverted are obtained;
[0036] Step 3: Identify the mask image of the water meter code of the water meter image, calculate the circumscribed moment, perform affine transformation and rotation according to the angle of the circumscribed moment, and obtain a water meter code image in which the water meter code is placed in a standard horizontal position;
[0037] Step 4: Identify the water meter code image and obtain the coordinates and numerical information of each number in the water meter code.
[0038] The specific steps of step 2 include:
[0039] S1. Create upright and inverted classification data sets based on the water meter images collected in step 1. Define the upright or inverted labels of the images based on the standard position of the water meter code, and finally distribute the images in a ratio of 80% training set and 20% validation set.
[0040] S2. Network training uses the GoogleNet network as the basis. The final classification layer of the classification data set is modified to 2 categories. The number of some low-level networks is reduced by half based on the original number. From the fourth layer onwards, it is no longer changed. The back propagation algorithm is used to train the classification model. During the training process, random augmentation operations are used in combination with labels to expand the full classification data set.
[0041] S3, convolution operation is performed on the collected water meter images and the trained network, and the final softmax classification is used as the output result. The best performing model in the validation set is selected to obtain the parameters of the water meter image upright and inverted judgment model.
[0042] The step 2 described in the invention is to generate a classification data set of upright and inverted water meters according to the water meter image, wherein the criteria for judging upright and inverted water meters are as follows: when the angle between the water meter code below and the image horizontal line is between 90 and 180 degrees, it is inverted, and the others are upright.
[0043] The specific steps of step three include:
[0044] S1. The water meter code, pointer wheel, and water meter dial in the water meter image are marked by masking, and the rectangular coordinates of the area containing them are stored in the file. The starting coordinates are saved in the form of length, width, and height. The contour coordinates store the coordinates of each contour point, and the coordinate values are saved in the file in json format. 90% of the labeled data are selected as the training set and 10% of the data are selected as the validation set.
[0045] S2. Use resnet50 to extract skeleton features and train the network. Use the Mask-RCNN framework to train the network and recognize the contours of the water meter code, pointer wheel, and water meter dial. The best performing model parameters are retained in the validation set.
[0046] S3, combining the standard situation of the water meter features and the classification result of whether the water meter image is upright or inverted obtained in step 2;
[0047] If it is an upright water meter image, then input the image;
[0048] If it is an inverted water meter image, the circumscribed moment of the water meter code is calculated according to the angle between the water meter code and the horizontal line of the image; the inverted water meter image is rotated by affine transformation until the water meter code is in a standard posture and the image is output.
[0049] The specific steps of step 4 include:
[0050] S1. Obtain upright water meter images, manually mark the digital positions of each image to create training sets and validation sets, accounting for 90% and 10% of the total number of images, respectively, and use a deep residual network (ResNet-18) for training. Note that in addition to marking the regular 0 to 9 numbers, hyphens are also marked here, and the marking content includes 0_1, 1_2, 2_3, 3_4, 4_5, 5_6, 6_7, 7_8, 8_9, 9_0, etc., to create a data set, select 90% of the data as the training set and 10% of the data as the validation set.
[0051] S2. After training, the model selects the parameters that perform best on the validation set for actual detection, and obtains the target character coordinates and values through the image output in step 3.
[0052] The specific steps of step 4 also include:
[0053] S3. Sort all character results left and right according to the coordinates, and then calculate the interval between every two characters. Considering the characteristics of water meter codes, the distances between water meter codes are basically equal or proportional. By calculating the standard deviation of the intervals, the obviously abnormal character intervals are removed according to the standard deviation value.
[0054] S4. According to the reasonable character coordinate array obtained in S3, if some coordinates are very close, it means that there are multiple results or hyphens appear here. There are two cases. If there is no hyphen, take the number with a larger Faster-RCNN prediction probability. If a hyphen appears, directly take the larger number among the hyphens, for example, 5_6, the current number is set to 6.
[0055] The water meter code intelligent recognition method based on convolutional neural network technology in this embodiment is implemented as follows:
[0056] Step 1: Use a mobile phone and a meter reading pole to take pictures of water meters at any angle, including outdoor and indoor water meters, and pictures of water meters with visible water meter codes in various weather conditions, dust, mud, etc. Define the labels of upright or inverted pictures based on the standard position of the water meter code, and finally distribute the pictures in a ratio of 80% training set and 20% validation set.
[0057] Step 2: Network training uses the GoogleNet network as the basis, modifies the last classification layer to 2 categories, reduces the number of some low-level networks, and reduces the number by half from the original number. Starting from the fourth layer, no changes are made, and the classification model is trained using the back propagation algorithm. During the training process, random augmentation operations are used in combination with labels to expand the data set.
[0058] Step 3: Select the model with the best performance in the validation set and obtain the model parameters for judging upright and inverted images.
[0059] Step 4: Mark the image data in step 1, use masking to mark, including the water meter code, pointer wheel, and dial contour data, and store the rectangular coordinates of their area in the form of starting coordinates, length, width, and height. The contour coordinates store the coordinates of each contour point, and save their values in json format. Select 90% of the data as the training set and 10% of the data as the validation set.
[0060] Step 5: Use resnet50 to extract skeleton features, use the Mask-RCNN framework to train the network, and save the model with the best performance in the validation set.
[0061] Step 6: Use the model parameters in step 5, input all the data set images, obtain the outline coordinates of the water meter code, calculate the circumscribed moment, and use the affine transformation method to rotate it to the standard position, such as Figure 2 .
[0062] Step 7: Mark the water meter code at the standard position, including the rectangular coordinates of the water meter code and the label value. Manually mark the digital position of each image to create a training set and a verification set, which account for 90% and 10% of the total number of images respectively. Note that in addition to marking the regular 0 to 9 numbers, hyphens are also marked here. The marking content includes 0_1, 1_2, 2_3, 3_4, 4_5, 5_6, 6_7, 7_8, 8_9, 9_0, etc. Figure 3 , make a data set, select 90% of the data as the training set and 10% of the data as the validation set.
[0063] Step 8: Use a deep residual network (ResNet-18) to train based on the Faster-RCNN architecture. The trained model selects the parameters that perform best on the validation set for actual detection.
[0064] Step 9: Save the three model parameters after training in step 3, step 5, and step 8, and input the water meter picture taken at any angle by the meter reading pole or mobile phone. The model in step 3 can determine whether the water meter picture is upright or inverted. The input picture is passed through the model in step 5 to obtain the water meter code, pointer wheel, dial outline coordinates and circumscribed moment.
[0065] Step 10: If there is a pointer wheel, the prior knowledge that the pointer wheel is located below the water meter code is used to determine whether the water meter is upright or inverted. If it is consistent with the model classification result of step 3, the upright and inverted results can be confirmed, and the first-level confidence is set to 99%. If it is inconsistent, the pointer wheel result confidence is greater than the model classification confidence of step 3. The result judged according to the position of the pointer wheel is taken, and the first-level confidence is set to the pointer wheel confidence. Otherwise, the model classification confidence of step 3 is taken. According to the upright and inverted results, the water meter code is rotated to the standard position.
[0066] Step 11: The water meter code image obtained in step 10 is predicted using the model obtained in step 8 to obtain the target character coordinates and values.
[0067] Step 12: Sort the results of step 11 left and right according to the coordinates, and then calculate the interval between every two characters. Considering the characteristics of the water meter digital code, the distance between the digital codes is basically equal or proportional. By calculating the standard deviation of the interval, the obviously abnormal character interval is removed according to this standard deviation value. Generally, abnormal character intervals may be misjudged due to the presence of interference.
[0068] Step 13: According to the reasonable character coordinate array obtained in step 12, if some coordinates are very close, it means that there are multiple results or hyphens appear here. There are two cases. If there is no hyphen, take the number with a larger Faster-RCNN prediction probability. If a hyphen appears, directly take the larger number among the hyphens, for example, 5_6, the current number is set to 6.
[0069] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A water meter code intelligent recognition method based on convolutional neural network technology, characterized in that: The following steps are involved: Step 1: Capture an image of the side of the water meter with the water meter code; Step 2: Using the water meter code in the collected water meter image as the standard, the classification algorithm is used to identify and judge whether the water meter image is an upright image or an inverted image. The collected water meter image is convolved with the trained network, and the final softmax classification is used as the output result. The model with the best performance in the verification set is selected to obtain the model parameters for judging the upright and inverted water meter images. Step 3: Identify the mask image of the water meter code of the water meter image, calculate the circumscribed moment, perform affine transformation and rotation according to the angle of the circumscribed moment, and obtain a water meter code image in which the water meter code is placed in a standard horizontal position; Step 4: Identify the water meter code image and obtain the coordinates and numerical information of each number in the water meter code.
2. The water meter code intelligent recognition method based on convolutional neural network technology according to claim 1 is characterized in that: The specific steps of step 2 include: S1, according to step one The collected water surface images are used to produce upright and inverted classification datasets; S2. Network training uses GoogleNet as the basis, modifies the last classification layer of the classification data set to 2 categories, reduces the number of some low-level networks, and reduces it by half based on the original number. From the fourth layer onwards, it will not be changed. Use the back propagation algorithm to train the classification model. During the training process, use random augmentation operations in combination with labels to expand the full classification data set. S3. Perform convolution operation on the collected water meter images and the trained network, and take the final softmax classification as the output result.
3. The water meter code intelligent recognition method based on convolutional neural network technology according to claim 2 is characterized in that: The second step is to generate a classification data set of upright and inverted water meter images, wherein the criteria for judging upright and inverted water meter images are as follows: when the angle between the water meter code below and the image horizontal line is between 90 and 180 degrees, it is inverted, and the others are upright.
4. The water meter code intelligent recognition method based on convolutional neural network technology according to claim 2 is characterized in that: The specific steps of step three include: S1. Mark the contours of the water meter code, pointer wheel, and water meter dial in the water meter image in a mask manner, store the coordinates of the rectangular area containing them in a file, save the starting coordinates in the form of length, width, and height, and store the coordinates of each contour point in the contour coordinates; S2. Use resnet50 to extract skeleton features, train the network, and use the Mask-RCNN algorithm to identify the contour results of the water meter code, pointer wheel, and water meter dial; S3, combining the standard situation of the water meter features and the classification result of whether the water meter image is upright or inverted obtained in step 2; If it is an upright water meter image, then input the image; If it is an inverted water meter image, the circumscribed moment of the water meter code is calculated according to the angle between the water meter code and the horizontal line of the image; the inverted water meter image is rotated by affine transformation until the water meter code is in a standard posture and the image is output.
5. The water meter code intelligent recognition method based on convolutional neural network technology according to claim 4 is characterized in that: The specific steps of step 4 include: S1. Obtain upright water meter images, manually mark the digital positions of each image to create a training set and a validation set, which account for 90% and 10% of the total number of images respectively, and use a deep residual network (ResNet-18) for training; S2. After training, the model selects the parameters that perform best on the validation set for actual detection, and obtains the target character coordinates and values through the image output in step 3.
6. The water meter code intelligent recognition method based on convolutional neural network technology according to claim 5 is characterized in that: The specific steps of step 4 also include: S3. Sort all the character results left and right according to the coordinates, and then calculate the interval between every two characters. Considering the characteristics of the water meter code, the distances between the water meter codes are basically equal or proportional. By calculating the standard deviation of the intervals, the obviously abnormal character intervals are removed according to the standard deviation value; S4. According to the reasonable character coordinate array obtained in S3, if some coordinates are very close, it means that there are multiple results or hyphens appear here. There are two cases. If there is no hyphen, take the number with the larger Faster-RCNN prediction probability. If a hyphen appears, directly take the larger number among the hyphens.
Citation Information
Patent Citations
Logistics composite code identification method based on multitask depth learning
CN108416412A
Accurate digital indicator reading detection method
CN108875739A
Character recognition model establishment, character recognition method, device, medium and device
CN109299717A
License plate recognition method and cloud system
WO2019169532A1
