Training method of water meter reading recognition model and water meter reading recognition method
By obtaining the water meter reading data set and brightness parameters, the parameters of the initial water meter reading recognition model are adjusted, which solves the problem of recognition error of water meter reading recognition under the influence of environmental factors, improves the recognition accuracy and speed, and enhances the robustness and robustness of the model. Training efficiency.
Patent Information
- Application Number
- CN202410948262.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-10-08
AI Technical Summary
Existing water meter reading recognition technology is affected by environmental factors such as humidity, temperature, dust, and water meter wear or stains. There are differences between the recognized water meter readings and the actual readings. Moreover, the traditional method is time-consuming, labor-intensive and error-prone. There is a need for automatic collection and identification. growing day by day.
By obtaining multiple water meter reading area images in the water meter reading data set, the brightness parameters of each image are obtained, and the preset initial water meter reading recognition model is used for identification. The model is evaluated based on the brightness parameters, label digital character sequence and predicted digital character sequence. Adjust the parameters to obtain the target water meter reading recognition model to improve the recognition accuracy and speed, and enhance the robustness and training efficiency of the model.
It improves the accuracy and speed of recognition of predicted digital character sequences corresponding to images in the water meter reading area, enhances the robustness and training efficiency of the target water meter reading recognition model, and reduces recognition errors and manual intervention.
Smart Images

Figure CN118747898A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition technology, and in particular to a training method for a water meter reading recognition model and a water meter reading recognition method. Background Art
[0002] With the intelligent development of urban water supply systems, smart water meters, as an important metering device, can record users' water consumption in real time. However, the traditional manual reading method is not only time-consuming and labor-intensive, but also prone to errors. The demand for automatic data collection and identification is growing.
[0003] At present, the existing water meter reading recognition mainly realizes automatic recognition of water meter readings by capturing water meter images with cameras and adopting optical character recognition technology combined with deep learning algorithms or manual recognition methods.
[0004] However, due to the location of the water meter, the water meter image may be affected by environmental factors such as humidity, temperature, dust, and wear or stains on the water meter itself. Therefore, the reading of the identified water meter is different from the actual reading of the water meter. Summary of the invention
[0005] The purpose of the present application is to provide a training method for a water meter reading recognition model and a water meter reading recognition method in response to the above-mentioned deficiencies in the prior art, so as to improve the accuracy and speed of recognizing the predicted digital character sequence corresponding to the reading area image, while improving the robustness and training efficiency of the target water meter reading recognition model.
[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0007] In a first aspect, an embodiment of the present application provides a method for training a water meter reading recognition model, the method comprising:
[0008] Acquire a water meter reading data set, the water meter reading data set comprising: a plurality of water meter reading area images, wherein each water meter reading area image is annotated with a corresponding label digital character sequence;
[0009] Obtaining brightness parameters of each water meter reading area image;
[0010] Using a preset initial water meter reading recognition model to perform reading recognition on each water meter reading area image, and obtain a predicted digital character sequence corresponding to each water meter reading area image;
[0011] According to the brightness parameters of each water meter reading area image, the label digital character sequence and the predicted digital character sequence, the initial water meter reading recognition model is adjusted to obtain the target water meter reading recognition model.
[0012] Optionally, the initial water meter reading recognition model includes: an initial feature extraction network and an initial prediction network;
[0013] The method of using a preset initial water meter reading recognition model to perform reading recognition on each water meter reading area image to obtain a predicted digital character sequence corresponding to each water meter reading area image includes:
[0014] Using the initial feature extraction network to extract features from each water meter reading area image, a feature sequence corresponding to each water meter reading area image is obtained, wherein the feature sequence is composed of: a plurality of feature vectors arranged in succession; the plurality of feature vectors respectively correspond to a plurality of receptive areas in each water meter reading area image;
[0015] Using the initial prediction network to predict the reading of the feature sequence, to obtain a predicted digital character sequence corresponding to each water meter reading area image;
[0016] The initial water meter reading recognition model is adjusted according to the brightness parameter of each water meter reading area image, the label digital character sequence and the predicted digital character sequence to obtain the target water meter reading recognition model, including:
[0017] According to the brightness parameters of each water meter reading area image, the predicted digital character sequence and the label digital character sequence, the initial feature extraction network and the initial prediction network are adjusted to obtain the target water meter reading recognition model including the target feature extraction network and the target prediction network.
[0018] Optionally, the initial feature extraction network and the initial prediction network are adjusted according to the brightness parameters of each water meter reading area image, the predicted digital character sequence and the label digital character sequence to obtain the target water meter reading recognition model including the target feature extraction network and the target prediction network, including:
[0019] Calculate the loss function value according to the brightness parameter of each water meter reading area image, the predicted digital character sequence and the label digital character sequence;
[0020] According to the loss function value, the initial feature extraction network and the initial prediction network are adjusted to obtain the target water meter reading recognition model including the target feature extraction network and the target prediction network.
[0021] Optionally, the initial feature extraction network includes: an input layer, a plurality of first convolutional layers, a plurality of maximum pooling layers, and an output mapping layer, wherein the plurality of first convolutional layers correspond to a plurality of maximum pooling layers respectively;
[0022] The using the initial feature extraction network to extract features from each water meter reading area image to obtain a feature sequence corresponding to each water meter reading area image includes:
[0023] Using the input layer to obtain each of the water meter reading area images as input;
[0024] Sequentially using the multiple first convolutional layers and the maximum pooling layers corresponding to each of the first convolutional layers to process each of the water meter reading area images, and obtaining a feature map output by the last maximum pooling layer as the feature map of each of the water meter reading area images;
[0025] The output mapping layer is used to map the feature map into the feature sequence.
[0026] Optionally, the initial feature extraction network further includes: a second convolutional layer, wherein the pixel size of the second convolutional layer is smaller than the pixel size of the first convolutional layer;
[0027] Before using the output mapping layer to map the feature map into the feature sequence, the method further includes:
[0028] Using the second convolutional layer to perform convolution processing on the feature map to obtain a target feature map;
[0029] The using the output mapping layer to map the feature map into the feature sequence comprises:
[0030] The target feature map is mapped into the feature sequence using the output mapping layer.
[0031] Optionally, a normalization layer is further arranged between the last multiple convolutional layers in the multiple first convolutional layers and the corresponding maximum pooling layer.
[0032] Optionally, calculating the loss function value according to the brightness parameter of each water meter reading area image, the predicted digital character sequence, and the label digital character sequence includes:
[0033] The label digital characters and the predicted digital characters corresponding to each water meter reading area image are stored in the first parameter variable and the second parameter variable in the preset loss calculation formula respectively;
[0034] The brightness parameter of each water meter reading area image is stored in the third parameter variable in the preset loss calculation formula;
[0035] According to the preset loss calculation formula, the loss function value is calculated.
[0036] Optionally, the initial prediction network includes: a first bidirectional long short-term memory BLSTM network, a second bidirectional long short-term memory BLSTM network and a comparison module; the initial prediction network is used to predict the reading of the feature sequence to obtain the predicted digital character sequence corresponding to each water meter reading area image, including:
[0037] Using the first bidirectional long short-term memory (BLSTM) network to perform bidirectional prediction processing on the feature sequence to obtain a first predicted character sequence corresponding to each water meter reading area image;
[0038] Using the second bidirectional long short-term memory (BLSTM) network to perform bidirectional prediction processing on the feature sequence to obtain a second predicted character sequence corresponding to each water meter reading area image;
[0039] The comparison module is used to obtain the predicted digital character sequence corresponding to each water meter reading area image based on the first predicted character sequence and the second predicted character sequence.
[0040] In a second aspect, another embodiment of the present application provides a water meter reading identification method, the method comprising:
[0041] Acquire a water meter reading area image of a target water meter;
[0042] The water meter reading area image is recognized using a pre-trained target water meter reading recognition model to obtain a target predicted digital character sequence for the target water meter, wherein the target water meter reading recognition model is a water meter reading recognition model trained using the first aspect described above.
[0043] In the third aspect, another embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the method described in any one of the first and second aspects above.
[0044] In a fourth aspect, another embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in any one of the first and second aspects are executed.
[0045] In a fifth aspect, another embodiment of the present application provides a training device for a water meter reading recognition model, the device comprising:
[0046] A first acquisition module is used to acquire a water meter reading data set, wherein the water meter reading data set includes: a plurality of water meter reading area images, wherein each water meter reading area image is annotated with a corresponding label digital character sequence;
[0047] A second acquisition module is used to acquire the brightness parameter of each water meter reading area image;
[0048] A recognition module, used to perform reading recognition on each water meter reading area image using a preset initial water meter reading recognition model to obtain a predicted digital character sequence corresponding to each water meter reading area image;
[0049] The module is used to adjust the parameters of the initial water meter reading recognition model according to the brightness parameters, label digital character sequence and predicted digital character sequence of each water meter reading area image to obtain the target water meter reading recognition model.
[0050] In a sixth aspect, another embodiment of the present application provides a water meter reading recognition device, the device comprising:
[0051] A third acquisition module is used to acquire a water meter reading area image of a target water meter;
[0052] The recognition module is used to use a pre-trained target water meter reading recognition model to recognize the water meter reading area image and obtain a target predicted digital character sequence of the target water meter, wherein the target water meter reading recognition model is a water meter reading recognition model trained using the first aspect mentioned above.
[0053] The beneficial effects of this application are:
[0054] The present application provides a training method for a water meter reading recognition model and a water meter reading recognition method, which comprises the following steps: obtaining a plurality of water meter reading area images in a water meter reading data set, and obtaining the brightness parameter of each water meter reading area image based on each water meter reading area image; using a preset initial water meter reading recognition model to perform reading recognition on each water meter reading area image, and comparing a predicted digital character sequence obtained by recognition according to the preset initial water meter reading recognition model with a label digital character sequence, while also obtaining the brightness parameter of each water meter reading area, thereby adjusting the parameters of the initial water meter reading recognition model according to the brightness parameter of each water meter reading area image, the label digital character sequence and the predicted digital character sequence, and obtaining a target water meter reading recognition model. That is to say, the target water meter reading recognition model obtained in the present application is not exactly the same. It is determined according to the brightness parameters of each water meter reading area image. The initial water meter reading recognition model is adjusted according to the brightness parameters of each water meter reading area image, the label digital character sequence and the predicted digital character sequence. The obtained target water meter recognition model improves the accuracy and speed of recognizing the predicted digital character sequence corresponding to the reading area image, and improves the robustness and training efficiency of the target water meter reading recognition model. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0056] Figure 1 A flow chart of a method for training a water meter reading recognition model provided in an embodiment of the present application;
[0057] Figure 2 A schematic diagram of a recognition process in a water meter reading recognition model training method is also provided for this application;
[0058] Figure 3 A schematic diagram of the structure of an initial water meter reading recognition model provided in an embodiment of the present application;
[0059] Figure 4 A schematic diagram of a flow chart of obtaining a target water meter reading recognition model in a training method of a water meter reading recognition model provided in an embodiment of the present application;
[0060] Figure 5 A schematic diagram of a flow chart for determining a feature sequence in a training method for a water meter reading recognition model provided in an embodiment of the present application;
[0061] Figure 6A schematic diagram of the structure of the first initial feature extraction network provided in an embodiment of the present application;
[0062] Figure 7 A schematic diagram of a flow chart for determining a feature sequence in another training method for a water meter reading recognition model provided in an embodiment of the present application;
[0063] Figure 8 A schematic diagram of the structure of a second initial feature extraction network provided in an embodiment of the present application;
[0064] Fig. 9 A schematic diagram of the structure of the third initial feature extraction network provided in the embodiment of the present application;
[0065] Fig.10 A schematic diagram of a process for determining a loss function value in a training method for a water meter reading recognition model provided in an embodiment of the present application;
[0066] Fig.11 A schematic diagram of a process for obtaining a predicted digital character sequence in a training method for a meter reading recognition model provided in an embodiment of the present application;
[0067] Fig.12 A schematic diagram of the structure of an initial prediction network provided in an embodiment of the present application;
[0068] Fig.13 Another embodiment of the present application also provides a flow chart of a water meter reading identification method;
[0069] Fig.14 A schematic diagram of the structure of a training device for a first recognition model of water meter readings provided in an embodiment of the present application;
[0070] Fig.15 A schematic diagram of the structure of a water meter reading recognition device provided by another embodiment of the present application;
[0071] Fig.16 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0072] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0073] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0074] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0075] In order to clearly describe the training method of the water meter reading recognition model provided in the embodiment of the present application, the training method of the water meter reading recognition model provided in the embodiment of the present application is described below with reference to a plurality of drawings. Figure 1 A flow chart of a method for training a water meter reading recognition model provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:
[0076] Step 101: Obtain a water meter reading dataset.
[0077] The water meter reading data set includes: multiple water meter reading area images, each of which is annotated with a corresponding label digital character sequence.
[0078] Optionally, before obtaining a water meter reading data set, it is first necessary to obtain multiple water meter reading images obtained by shooting actual scenes, determine the reading area in the multiple water meter reading images by an optical character recognition method or an artificial recognition method, and crop the multiple water meter reading images according to the reading area in the multiple water meter reading images to obtain multiple initial water meter reading area images, the width of the multiple water meter reading images obtained after cropping is 32 pixels, and the length can be any pixel, and the embodiment of the present application does not limit the length pixel. It is judged whether the multiple initial water meter reading area images meet the preset number of water meter reading data sets. If not, according to the preset number of water meter reading data sets, the multiple initial water meter reading area images are amplified by image processing operations such as rotation and symmetry to obtain multiple amplified initial water meter reading area images, wherein the water meter reading image includes the water meter reading area and the external information of the water meter, and the initial water meter reading area image only includes the water meter reading area but does not include the external information of the water meter, and the preset number of water meter reading data sets is determined according to the actual model training, and the present application does not limit this, and 5000 images are taken as an example in the present application.
[0079] Optionally, the multiple initial water meter reading area images in the amplified water meter reading data set are grayed, normalized, and the multiple initial water meter reading area images after processing are annotated with corresponding label digital character sequences as water meter reading area images, and the multiple water meter reading area images constitute the water meter reading data set. Each water meter reading area image is used as a training set, and the corresponding label digital character sequence annotated in each water meter reading area image is used as a validation set. The water meter reading data set includes: multiple water meter reading area images and the label digital character sequence corresponding to each water meter reading area image.
[0080] Step 102: Obtain the brightness parameter of each water meter reading area image.
[0081] The brightness parameter may be brightness-related parameters such as brightness, contrast, and exposure.
[0082] Optionally, a brightness parameter of each water meter reading area image is obtained according to pixel information of each water meter reading area image.
[0083] Step 103: Use a preset initial water meter reading recognition model to perform reading recognition on each water meter reading area image to obtain a predicted digital character sequence corresponding to each water meter reading area image.
[0084] The preset initial water meter reading recognition model is an image recognition model based on a convolutional neural network, which includes multiple convolutional layers and multiple maximum pooling layers, but does not include a fully connected layer. The predicted digital character sequence is the water meter reading corresponding to the water meter reading area obtained by the preset initial water meter reading recognition model when the water meter reading area image is recognized.
[0085] Optionally, each water meter reading area image is input into a preset initial water meter reading recognition model, and the preset initial water meter reading recognition model is used to perform reading recognition on each water meter reading area image to obtain the water meter reading corresponding to each water meter reading area image.
[0086] Step 104: According to the brightness parameters of each water meter reading area image, the label digital character sequence and the predicted digital character sequence, the initial water meter reading recognition model is adjusted to obtain the target water meter reading recognition model.
[0087] Optionally, the difference between the label digital character sequence and the predicted digital character sequence is determined, and the parameters of the initial water meter reading recognition model are adjusted according to the difference between the label digital character sequence and the predicted digital character sequence and the brightness parameters of each water meter reading area image to obtain a target water meter reading recognition model.
[0088] In the embodiment of the present application, a plurality of water meter reading area images in the water meter reading data set are obtained, and the brightness parameter of each water meter reading area image is obtained according to each water meter reading area image; a preset initial water meter reading recognition model is used to perform reading recognition on each water meter reading area image, and the predicted digital character sequence obtained according to the preset initial water meter reading recognition model is compared with the label digital character sequence, and the brightness parameter of each water meter reading area is also obtained, so that the initial water meter reading recognition model is adjusted according to the brightness parameter of each water meter reading area image, the label digital character sequence and the predicted digital character sequence, and the target water meter reading recognition model is obtained. In other words, the target water meter reading recognition model obtained in the present application is not exactly the same, and is determined according to the brightness parameter of each water meter reading area image. According to the brightness parameter of each water meter reading area image, the label digital character sequence and the predicted digital character sequence, the initial water meter reading recognition model is adjusted according to the brightness parameter of each water meter reading area image, and the target water meter recognition model is obtained, which improves the accuracy and speed of recognizing the predicted digital character sequence corresponding to the reading area image, and improves the robustness and training efficiency of the target water meter reading recognition model.
[0089] On the basis of the above-mentioned embodiment, the initial water meter reading recognition model includes: an initial feature extraction network and an initial prediction network. To this end, the present application also provides a recognition process in a water meter reading recognition model training method. Figure 2The present application also provides a schematic diagram of the recognition process in a water meter reading recognition model training method, such as Figure 2 As shown, in the above step 103, the preset initial water meter reading recognition model is used to perform reading recognition on each water meter reading area image to obtain a predicted digital character sequence corresponding to each water meter reading area image, including:
[0090] Step 201: Use an initial feature extraction network to extract features from each water meter reading area image to obtain a feature sequence corresponding to each water meter reading area image.
[0091] Among them, the feature sequence is composed of: multiple feature vectors arranged continuously; the multiple feature vectors correspond to multiple receptive areas in each water meter reading area image, and the receptive area refers to the area in the image used to extract features and make decisions. The specific number of receptive areas is determined according to the convolution kernel size of the convolution layer in the initial feature extraction network.
[0092] Optionally, an initial feature extraction network is used to extract features from each water meter reading area image to obtain a plurality of continuously arranged feature vectors corresponding to each water meter reading area, and the plurality of feature vectors respectively correspond to a plurality of receptive areas in each water meter reading area image.
[0093] Step 202: Use the initial prediction network to predict the reading of the feature sequence to obtain a predicted digital character sequence corresponding to each water meter reading area image.
[0094] Optionally, the initial prediction network is used to perform reading prediction on the feature sequence corresponding to each water meter reading area image to obtain a predicted digital character sequence corresponding to each water meter reading area image.
[0095] As in step 104 above, the initial water meter reading recognition model is adjusted according to the brightness parameter of each water meter reading area image, the label digital character sequence and the predicted digital character sequence to obtain the target water meter reading recognition model, including:
[0096] Step 203: According to the brightness parameters of each water meter reading area image, the predicted digital character sequence and the label digital character sequence, the initial feature extraction network and the initial prediction network are adjusted to obtain a target water meter reading recognition model including a target feature extraction network and a target prediction network.
[0097] For example, Figure 3 A schematic diagram of the structure of an initial water meter reading recognition model provided in an embodiment of the present application is shown in FIG. Figure 3As shown, the initial water meter reading recognition model includes: an initial feature extraction network and an initial prediction network. The initial feature extraction network is used to extract features from each water meter reading area image to obtain a feature sequence corresponding to each water meter reading area image. The initial prediction network is used to predict the reading of the feature sequence to obtain a predicted numerical character sequence corresponding to each water meter reading area image.
[0098] In the embodiment of the present application, the initial feature extraction network and the initial prediction network in the initial water meter reading recognition model obtain the predicted digital character sequence corresponding to each water meter reading area, so as to adjust the parameters of the initial feature extraction network and the initial prediction network according to the brightness parameters of each water meter reading area image, the predicted digital character sequence and the label digital character sequence, and obtain the target water meter reading recognition model including the target feature extraction network and the target prediction network, which improves the recognition accuracy of the target water meter reading recognition model, reduces the time of model training, thereby saving computing resources, and can improve the stability of model training, making the training process smoother.
[0099] On the basis of the above embodiments, the present application also provides a process for obtaining a target water meter reading recognition model in a water meter reading recognition model training method. Figure 4 A flow chart of obtaining a target water meter reading recognition model in a training method of a water meter reading recognition model provided in an embodiment of the present application, such as Figure 4 As shown, as described in the above step 203, according to the brightness parameters of each water meter reading area image, the predicted digital character sequence and the label digital character sequence, the initial feature extraction network and the initial prediction network are adjusted to obtain a marked water meter reading recognition model including a target feature extraction network and a target prediction network, including:
[0100] Step 401: Calculate the loss function value according to the brightness parameter of each water meter reading area image, the predicted digital character sequence and the label digital character sequence.
[0101] Optionally, the loss values of the digital character sequence predicted by the initial feature extraction network and the initial prediction network and the label digital character sequence are determined, and then the loss function is calculated based on the loss values and the brightness parameters of each water meter reading area image.
[0102] Step 402: According to the loss function value, the initial feature extraction network and the initial prediction network are adjusted to obtain a target water meter reading recognition model including a target feature extraction network and a target prediction network.
[0103] Among them, parameter adjustment includes adjusting parameters such as learning rate, batch size, number of iterations, regularization, etc., and this application does not impose any restrictions on this.
[0104] Optionally, the parameters of the initial feature extraction network and the initial prediction network are updated according to the gradient of the loss function value, the performance of the model is evaluated, and hyperparameters such as learning rate, batch size, number of iterations, regularization, etc. are adjusted to obtain a target water meter reading recognition model including a target feature extraction network and a target prediction network.
[0105] In the embodiment of the present application, the loss function value is calculated based on the brightness parameters of each water meter reading area image, the predicted digital character sequence and the label digital character sequence; thereby, the initial feature extraction network and the initial prediction network are adjusted according to the loss function value to obtain the target water meter reading recognition model, thereby ensuring that the obtained target water meter reading recognition model is more closely matched with the water meter reading area image, thereby improving the recognition accuracy of the target water meter reading recognition model in a variety of environments as well as the overall recognition speed and accuracy.
[0106] On the basis of the above embodiment, the initial feature extraction network includes: an input layer, multiple first convolutional layers, multiple maximum pooling layers and an output mapping layer, wherein the multiple first convolutional layers correspond to multiple maximum pooling layers respectively. To this end, the present application also provides a process for determining a feature sequence in a training method for a water meter reading recognition model. Figure 5 A schematic diagram of a flow chart for determining a feature sequence in a training method for a water meter reading recognition model provided in an embodiment of the present application, such as Figure 5 As shown, in the above step 201, the initial feature extraction network is used to extract features from each water meter reading area image, and a feature sequence corresponding to each water meter reading area image is obtained, including:
[0107] Step 501: Use the input layer to obtain each water meter reading area image input.
[0108] For example, Figure 6 The schematic diagram of the structure of the first initial feature extraction network provided in the embodiment of the present application is as follows: Figure 6 As shown, the initial feature extraction network includes: an input layer, multiple first convolutional layers, multiple maximum pooling layers and an output mapping layer, wherein the multiple first convolutional layers correspond to the multiple maximum pooling layers respectively.
[0109] Optionally, each water meter reading area image is sequentially input into an input layer, and the input layer pre-processes each water meter reading area image and converts it into a form that can be processed by an initial feature extraction network.
[0110] Step 502: sequentially use multiple first convolutional layers and the maximum pooling layers corresponding to each first convolutional layer to process each water meter reading area image, and obtain a feature map output by the last maximum pooling layer as the feature map of each water meter reading area image.
[0111] Among them, the number of channels per layer of the first convolutional layer is a multiple of 16. For example, the number of channels per layer of the first first convolutional layer is 16, the number of channels per layer of the second first convolutional layer is 32, the number of channels per layer of the third first convolutional layer is 64, and the number of channels per layer of the fourth first convolutional layer is 128. They are stacked in sequence. The specific number of channels per layer is determined according to the actual scenario. This application takes four first convolutional layers as an example. The convolution kernel movement step of the first convolutional layer is 1 pixel, the size of the edge of the input image padded by the first convolutional layer is 1 pixel, and the convolution kernel of the first convolutional layer is 3×3 pixels. The step size of the maximum pooling layer is 2 pixels, the windows of the first two maximum pooling layers are 2×2 pixels, and the windows of the last two maximum pooling layers are 2×1 pixels.
[0112] By way of example, the present application takes four first convolutional layers and four maximum pooling layers as examples, wherein the first first convolutional layer has 16 channels per layer, a step size of 1 pixel, a size of 1 pixel for filling the edge of the input image, and a convolution kernel size of 3×3 pixels, the first maximum pooling layer has a step size of 2 pixels, and a window of 2×2 pixels, the second first convolutional layer has 32 channels per layer, a step size of 1 pixel, a size of 1 pixel for filling the edge of the input image, and a convolution kernel size of 3×3 pixels, and the second maximum pooling layer has a step size of 2 pixels, the window is 2×2 pixels, the third first convolution layer has 64 channels per layer, a step size of 1 pixel, the size of the edge of the input image is 1 pixel, and the convolution kernel size is 3×3 pixels, the third maximum pooling layer has a step size of 2 pixels, and the window is 2×1 pixels, the fourth first convolution layer has 128 channels per layer, a step size of 1 pixel, the size of the edge of the input image is 1 pixel, and the convolution kernel size is 3×3 pixels, the fourth maximum pooling layer has a step size of 2 pixels and a window of 2×1 pixels. This application takes four first convolution layers and four maximum pooling layers as an example. Since the image of the water meter reading area is long and narrow, the feature map can be downsampled multiple times in the vertical direction until the height of the feature map is reduced to 1. By setting the window pixels of the last two maximum pooling layers to be smaller than the window pixels of the first two maximum pooling layers, the overlap of two adjacent characters and the loss of information in the width direction of the feature map can be avoided.
[0113] For example, each water meter reading area image is input into the first first convolutional layer and the first maximum pooling layer, and the accuracy of the predicted digital character sequence is 0.0913. Then it is input into the second first convolutional layer and the second maximum pooling layer, and the accuracy of the predicted digital character sequence is 0.3078. Then it is input into the third first convolutional layer and the third maximum pooling layer, and the accuracy of the predicted digital character sequence is 0.6504. Then it is input into the fourth first convolutional layer and the fourth maximum pooling layer, and the accuracy of the predicted digital character sequence is 0.8921.
[0114] Optionally, each water meter reading area is sequentially input into multiple first convolutional layers and the maximum pooling layers corresponding to each first convolutional layer to perform feature extraction on each water meter reading area image, and a feature map output by the last maximum pooling layer is obtained as the feature map of each water meter reading area image.
[0115] Step 503: Use the output mapping layer to map the feature map into a feature sequence.
[0116] Among them, the output mapping layer is Map-to-sequence, which is used to map the feature map to a feature sequence.
[0117] Optionally, the feature map of each water meter reading area image is mapped into a feature sequence using an output mapping layer.
[0118] In an embodiment of the present application, each water meter reading area image is passed through an input layer, multiple first convolution layers and a maximum pooling layer to obtain a feature map, and then a mapping sequence is obtained through an output mapping layer, wherein each first convolution layer corresponds to a maximum pooling layer, which can ensure more refined extraction of effective features of each water meter reading area image, and can compress the image while retaining the features to improve memory operation efficiency, prepare for the next convolution layer with more channels, and avoid the loss of feature maps in the width direction.
[0119] On the basis of the above embodiment, the initial feature extraction network further includes: a second convolutional layer, the pixel size of the second convolutional layer is smaller than the pixel size of the first convolutional layer. For this reason, the present application also provides another process for determining a feature sequence in a training method for a water meter reading recognition model. Figure 7 A schematic diagram of a flow chart for determining a feature sequence in another training method for a water meter reading recognition model provided in an embodiment of the present application, such as Figure 7 As shown, before the output mapping layer is used to map the feature map into a feature sequence in step 503, the following steps are also included:
[0120] Step 701: Use the second convolutional layer to perform convolution processing on the feature map to obtain a target feature map.
[0121] For example, Figure 8 A schematic diagram of the structure of the second initial feature extraction network provided in the embodiment of the present application is as follows: Figure 8 As shown in the above Figure 6 The initial feature extraction network also includes a second convolutional layer, and the last maximum pooling layer is connected to the output pooling layer through the second convolutional layer.
[0122] Among them, the number of channels in each layer is twice the number of channels in the last first convolution layer, the stride is the same as the first convolution layer, the size of the edge of the input image is 0 pixels, and the convolution kernel is smaller than the convolution kernel of the first convolution layer. In this application, when the first convolution layer is 4, the maximum pooling layer is 4, the number of channels in the second convolution layer is 256, the stride is 1 pixel, the size of the edge of the input image is 0 pixels, and the convolution kernel is 2×2 pixels.
[0123] For example, when the number of channels of the second convolutional layer is 256, the stride is 1 pixel, the size of the edge padding for the input image is 0 pixels, and the convolution kernel is 2×2 pixels, the accuracy of the predicted digital character sequence is 0.9310.
[0124] Optionally, the feature map obtained after the last maximum pooling layer is convolved using a second convolutional layer to obtain a target feature map.
[0125] The above step 503 uses the output mapping layer to map the feature map into a feature sequence, including:
[0126] Step 702: Use the output mapping layer to map the target feature map into a feature sequence.
[0127] In an embodiment of the present application, a second convolutional layer is set to perform convolution processing on the feature map. After obtaining the target feature map, the target feature map is mapped into a feature sequence using an output mapping layer, thereby improving the recognition accuracy of the feature map by the initial feature extraction network, reducing multiplication operations, improving computational efficiency, and being more adaptable to the image size, thereby avoiding information loss.
[0128] On the basis of the above-mentioned embodiment, a normalization layer is further arranged between the last multiple first convolutional layers and the corresponding maximum pooling layer in the multiple first convolutional layers in the initial feature extraction network in the embodiment of the present application.
[0129] For example, Fig. 9 A schematic diagram of the structure of the third initial feature extraction network provided in the embodiment of the present application is as follows: Fig. 9 As shown, when there are four first convolutional layers and four maximum pooling layers in the present application, a normalization layer is provided between the third first convolutional layer and the third maximum pooling layer, and a normalization layer is provided between the fourth first convolutional layer and the fourth maximum pooling layer. It is worth noting that the specific setting of the normalization layer is determined according to the actual usage scenario. When the model training speed slows down, the normalization layer can be added to increase the model training speed. The embodiment of the present application does not limit the specific setting of the normalization layer.
[0130] In an embodiment of the present application, a normalization layer is also provided between the last multiple first convolutional layers and the corresponding maximum pooling layer of the initial feature extraction network, which can reduce the training time of the initial feature extraction network, accelerate the convergence speed of the initial feature extraction network, and thus improve the model training speed.
[0131] Based on the above embodiments, the present application also provides a process for determining a loss function value in a training method for a water meter reading recognition model. Fig.10 A schematic diagram of a process for determining a loss function value in a training method for a water meter reading recognition model provided in an embodiment of the present application, such as Fig.10 As shown, in the above step 401, the loss function value is calculated according to the brightness parameter of each water meter reading area image, the predicted digital character sequence and the label digital character sequence, including:
[0132] Step 1001: store the label digital characters and predicted digital characters corresponding to each water meter reading area image into the first parameter variable and the second parameter variable in the preset loss calculation formula respectively.
[0133] Among them, y_true is defined as the first parameter variable, y_true is the observed true label or target value, that is, the label digital character corresponding to each water meter reading area image; y_pred is defined as the second parameter variable, y_pred is the output value predicted by the model, that is, the measured digital character corresponding to each water meter reading area image. Among them, the first parameter variable and the second parameter variable can be determined according to the initial water meter reading recognition model, and the parameter is automatically extracted during calculation.
[0134] Optionally, the predicted digital characters and the label digital characters corresponding to each water meter reading area image are stored in y_pred and y_true in the preset loss calculation formula, respectively.
[0135] Step 1002: Store the brightness parameter of each water meter reading area image into the third parameter variable in the preset loss calculation formula.
[0136] Optionally, obtain each water meter reading area image, convert each water meter reading area image into a grayscale image, calculate the average brightness of the grayscale image based on the grayscale image of each water meter reading area image and store it in the average_brightness array, divide the average brightness of the grayscale image by 100 to obtain the brightness percentage, and store the brightness percentage of each water meter reading area image in the brightness_percent array, wherein the brightness percentage of each water meter reading area is the brightness parameter of each water meter reading area image.
[0137] Among them, the loss function is the difference between the predicted value and the true value of the initial water meter reading recognition model, which is an indicator used to evaluate the model effect. The smaller the loss function value, the stronger the robustness of the model. The preset loss calculation formula is the loss function formula corresponding to the initial water meter reading recognition model. The third parameter variable is defined as r, which is a dynamic parameter in the model loss function and is used to indicate the brightness parameter of the water meter reading area image.
[0138] Step 1003: Calculate the loss function value according to the preset loss calculation formula.
[0139] The loss calculation formula of the model is formula (1).
[0140] My_loss(y_true,y_pred,r) (1)
[0141] Among them, My_loss is the loss function calculation formula, y_true is the first variable parameter, y_pred is the second variable parameter, and r is the third variable parameter.
[0142] For example, when the brightness percentage is 0.5, substitute 0.5 into the preset loss calculation formula to get the loss calculation formula My_loss(0.5). Substitute the loss calculation formula into the compiled model formula model.compile(loss=My_loss(0.5), optimizer=′sgd′, metrics=[′acc′]), and the loss value cannot be calculated. It can be determined that the My_loss function needs to pass three parameters, and it is impossible to flexibly define r. Improve the My_loss function, encapsulate a layer of new_loss, return the My_loss function, and substitute the brightness percentage brightness_percent value of each water meter reading area image into the formula, that is, the preset loss calculation formula is new_loss(brightness_percent).
[0143] Optionally, according to the preset loss calculation formula, the stochastic gradient descent optimizer = 'sgd' of the initial water meter reading recognition model and the accuracy indicator metrics = ['acc'] of the initial water meter reading recognition model, substitute into the compilation model formula model.compile(loss = new_loss(brightness_percent), optimizer = 'sgd', metrics = ['acc']), determine the image brightness ratio of each reading area in turn, and calculate the loss function value.
[0144] In an embodiment of the present application, the loss value is calculated based on the brightness parameters, predicted digital characters and label digital characters of each water meter reading area, so that the characters in the image of the water meter reading area of any brightness obtained in any installation position and any weather can be accurately recognized. The accuracy of character recognition in the image of the water meter reading area can be improved without adding other accessories, thereby reducing the image recognition cost of the water meter reading area and improving the recognition efficiency.
[0145] On the basis of the above embodiment, the initial prediction network includes: a first bidirectional long short-term memory BLSTM network, a second bidirectional long short-term memory BLSTM network and a comparison module; for this purpose, the present application also provides a process for obtaining a predicted digital character sequence in a training method for a water meter reading recognition model, Fig.11 A flowchart of obtaining a predicted digital character sequence in a training method for a table reading recognition model provided in an embodiment of the present application is shown in FIG. Fig.11 As shown, in the above step 202, the initial prediction network is used to predict the reading of the feature sequence, and the predicted digital character sequence corresponding to each water meter reading area image is obtained, including:
[0146] Step 1101: Use a first bidirectional long short-term memory (BLSTM) network to perform bidirectional prediction processing on the feature sequence to obtain a first predicted character sequence corresponding to each water meter reading area image.
[0147] For example, the present application provides a schematic diagram of the structure of an initial prediction network. Fig.12 A schematic diagram of the structure of an initial prediction network provided in an embodiment of the present application is shown in FIG. Fig.12 As shown, the initial prediction network includes: a first bidirectional long short-term memory BLSTM network, a second bidirectional long short-term memory BLSTM network and a comparison module, wherein the first bidirectional long short-term memory BLSTM network has 256 units in each time step, and the unit is used to represent the state of the sequence information captured in a given time step. The second bidirectional long short-term memory BLSTM network has the same structure as the first bidirectional long short-term memory BLSTM network, both of which have 256 units in each time step, and the comparison module is used to compare the first predicted character sequence and the second predicted character sequence.
[0148] The first bidirectional long short-term memory BLSTM network is a network obtained by connecting two long short-term memory networks (Long Short-Term Memory, referred to as LSTM) in series. One of the two LSTM networks is used for the forward sequence and the other is used for the reverse sequence. The LSTM network realizes the processing of long-term time sequences through three "gate" structures, which solves the problem of gradient disappearance to a certain extent. The three "gates" are input gate, forget gate and output gate. When recognizing text, LSTM can store long-distance information, but can only use past state information. For ordered images such as water meter readings, the current character recognition cannot be inferred only by the information of the previous moment, but also needs to be forward-calculated with the help of subsequent sequence information to obtain the current character information. Therefore, a bidirectional long short-term memory network (Bidirectional Long Short-Term Memory, referred to as BLSTM) network is adopted. The network is formed by superimposing two LSTM networks front and back. The forward layer processes the input sequence from the past to the future time step, and the backward layer processes the input sequence from the future to the past time step in the opposite direction. At the same time, forward and backward information are obtained, so that higher accuracy is obtained, but forward or backward information is still occasionally lost.
[0149] Optionally, the feature sequence is bidirectionally predicted from front to back and from back to front using a first bidirectional long short-term memory (BLSTM) network to obtain a first predicted character sequence corresponding to each water meter reading area image.
[0150] For example, when the feature sequence is abc, a first bidirectional long short-term memory BLSTM network is used to perform bidirectional prediction processing on abc from front to back and from back to front, and the obtained first predicted character sequence is abccba.
[0151] Step 1102: Use a second bidirectional long short-term memory (BLSTM) network to perform bidirectional prediction processing on the feature sequence to obtain a second predicted character sequence corresponding to each water meter reading area image.
[0152] Among them, the process of bidirectional prediction processing of the feature sequence by the second bidirectional long short-term memory BLSTM network is exactly the same as the process of bidirectional prediction processing of the feature sequence by the first bidirectional long short-term memory BLSTM network.
[0153] Step 1103: using a comparison module, based on the first predicted character sequence and the second predicted character sequence, obtain a predicted digital character sequence corresponding to each water meter reading area image.
[0154] Optionally, the first predicted character sequence and the second predicted character sequence are compared through a comparison module. When the first predicted character sequence is the same as the second predicted character sequence, a predicted digital character sequence corresponding to each water meter reading area image is obtained based on the first character prediction sequence and the second character prediction sequence.
[0155] In another possible implementation, when the first predicted character sequence is different from the second predicted character sequence, the first bidirectional long short-term memory BLSTM network and the second bidirectional long short-term memory BLSTM network are used to re-perform bidirectional prediction to compare the new first predicted character sequence with the second predicted character sequence, and the cycle is repeated until the two sequences are the same. If they are still different after 10 cycles, an error is reported.
[0156] In an embodiment of the present application, by setting a first BLSTM network and a second bidirectional long short-term memory BLSTM network, it is ensured that the feature sequence obtained by the initial feature extraction network is verified, thereby avoiding losses caused by recognizing wrong numbers, making the recognized digital information more complete, and the prediction results of the model more accurate.
[0157] Based on the same inventive concept, another embodiment of the present application further provides a water meter reading recognition method. Fig.13 Another embodiment of the present application also provides a flow chart of a water meter reading recognition method, such as Fig.13 As shown, the method includes:
[0158] Step 1301: Acquire a water meter reading area image of a target water meter.
[0159] Optionally, the image of the target water meter is collected by the camera of the target water meter, and the image of the target water meter is clipped by identifying the water meter reading area of the target water meter to obtain the water meter reading area image of the target water meter. Among them, the camera of the target water meter takes the OV7670FIFO model camera as an example. The camera is a 1 / 6 inch complementary metal oxide semiconductor (Complementary Metal-Oxide-Semiconductor, referred to as CMOS) video graphics array (VGA) image sensor. The VGA image sensor has a small size and low operating voltage. It provides all the functions of a single-chip camera and an image processor. Through the SCCB bus control, it can output various resolution 8-bit image data in the form of full frame, sub-sampling, windowing, etc. The VGA image of this product reaches up to 30 frames per second, which can reduce or eliminate optical electronic defects such as fixed pattern noise, tailing, floating, etc., improve image quality, and obtain a clear and stable color image. The camera in this application can also be a low-power camera with other resolution 8-bit image data, and the embodiment of this application is not limited to this.
[0160] Step 1302: Use a pre-trained target water meter reading recognition model to recognize the water meter reading area image and obtain a target predicted digital character sequence of the target water meter.
[0161] Among them, the target water meter reading recognition model is the water meter reading recognition model obtained by the above training.
[0162] Optionally, the water meter reading area image of the target water meter is input into a pre-trained target water meter reading recognition model to recognize the water meter reading area image, thereby obtaining a target predicted digital character sequence of the target water meter.
[0163] In one possible embodiment, the present application also includes quantizing the target water meter reading recognition model through a model conversion tool to obtain a target model, and deploying the target model to the processor of the meter reading device corresponding to each water meter. The processor of the meter reading device is used to execute the above-mentioned water meter reading recognition method. After obtaining the target predicted digital character sequence of the target water meter, the target predicted digital character sequence can be transmitted to the remote server through remote transmission technology.
[0164] Optionally, the model conversion tool is a TensorFlow Lite conversion tool. After the target water meter reading recognition model is generated into a TensorFlow model through the TensorFlow Lite conversion tool, the "post_training_quantize" tag in the TensorFlow Lite conversion tool can be implemented, and then the generated quantized tflite model is named quantized_model.tflite to obtain the target model. The post-training quantization model can reduce the target water meter reading recognition model to 1 / 4 of the original size. The execution speed of the target water meter reading recognition model mainly composed of convolutional layers is increased by 50%. The target water meter reading recognition model based on the convolutional neural network is accelerated by 3 times. Due to the reduction in memory and computing requirements, the model will also reduce a lot of power consumption.
[0165] Optionally, the processor of the meter reading device corresponding to each water meter is a low-power single-chip microcomputer, and the low-power single-chip microcomputer can be an STM32L151RD single-chip microcomputer or other low-power single-chip microcomputer. The STM32L151RD single-chip microcomputer combines the connection power supply of the universal serial bus with the high-performance ARM Cortex M3 32-bit RISC core operating at 32MHz, a memory protection unit, and a high-speed embedded memory up to 384K bytes of flash memory and up to 48K bytes of RAM, a flexible static memory controller interface, suitable for devices with 100 pins and above, and various enhanced I / O and peripheral devices connected to two APB buses. The embodiment of the present application does not limit this. Through the low-power single-chip microcomputer, the water meter reading area image of the target water meter can be processed and identified locally and then transmitted to the remote server through the remote transmission technology, avoiding the information leakage caused by directly uploading the water meter reading area image of the target water meter.
[0166] Based on the same inventive concept, the embodiment of the present application also provides a training device for the first recognition model of water meter readings corresponding to the training method for the first recognition model of water meter readings. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the training method for the first recognition model of water meter readings in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0167] Fig.14 A schematic diagram of the structure of a training device for a first recognition model of water meter readings provided in an embodiment of the present application, the device comprising: a first acquisition module 1401, a second acquisition module 1402, a first recognition module 1403, and an acquisition module 1404, wherein the first acquisition module 1401 is used to acquire a water meter reading data set, the water meter reading data set comprising: a plurality of water meter reading area images, wherein each water meter reading area image is annotated with a corresponding label digital character sequence;
[0168] The second acquisition module 1402 is used to acquire the brightness parameter of each water meter reading area image;
[0169] The first recognition module 1403 is used to perform a first recognition of the readings of each water meter reading area image using a preset initial water meter reading first recognition model to obtain a predicted digital character sequence corresponding to each water meter reading area image;
[0170] Obtaining module 1404, which is used to adjust the parameters of the initial water meter reading first recognition model according to the brightness parameters, label digital character sequence and predicted digital character sequence of each water meter reading area image, to obtain the target water meter reading first recognition model.
[0171] In a possible implementation, the first recognition model of the initial water meter reading includes: an initial feature extraction network and an initial prediction network; a first recognition module 1403, specifically used to: use the initial feature extraction network to extract features from each water meter reading area image, and obtain a feature sequence corresponding to each water meter reading area image, wherein the feature sequence is composed of: a plurality of feature vectors arranged continuously; the plurality of feature vectors respectively correspond to a plurality of receptive areas in each water meter reading area image;
[0172] The initial prediction network is used to predict the readings of the feature sequence and obtain the predicted digital character sequence corresponding to each water meter reading area image.
[0173] In one possible implementation, module 1404 is obtained, which is specifically used to adjust the parameters of the initial feature extraction network and the initial prediction network according to the brightness parameters of each water meter reading area image, the predicted digital character sequence, and the label digital character sequence, to obtain a first recognition model of the target water meter reading including a target feature extraction network and a target prediction network.
[0174] In a possible implementation, the first recognition module 1403 is specifically configured to: calculate a loss function value according to a brightness parameter of each water meter reading area image, a predicted digital character sequence, and a label digital character sequence;
[0175] According to the loss function value, the parameters of the initial feature extraction network and the initial prediction network are adjusted to obtain a first recognition model of the target water meter reading including the target feature extraction network and the target prediction network.
[0176] In a possible implementation, the initial feature extraction network includes: an input layer, multiple first convolutional layers, multiple maximum pooling layers, and an output mapping layer, wherein the multiple first convolutional layers correspond to the multiple maximum pooling layers respectively; a first recognition module 1403 is specifically used to: use the input layer to obtain each water meter reading area image input;
[0177] Using multiple first convolutional layers and the maximum pooling layers corresponding to each first convolutional layer in sequence to process each water meter reading area image, and obtaining a feature map output by the last maximum pooling layer as the feature map of each water meter reading area image;
[0178] An output mapping layer is used to map the feature map into a feature sequence.
[0179] In a possible implementation, the initial feature extraction network further includes: a second convolutional layer, wherein the pixel size of the second convolutional layer is smaller than the pixel size of the first convolutional layer; and a first recognition module 1403, further configured to:
[0180] The second convolutional layer is used to perform convolution on the feature map to obtain the target feature map.
[0181] In a possible implementation, the first recognition module 1403 is specifically configured to: map the target feature map into a feature sequence using an output mapping layer.
[0182] In a possible implementation manner, a normalization layer is further arranged between the last of the plurality of first convolutional layers and the corresponding maximum pooling layer.
[0183] In a possible implementation manner, the first recognition module 1403 is specifically used to: store the label digital characters and the predicted digital characters corresponding to each water meter reading area image into the first parameter variable and the second parameter variable in the preset loss calculation formula respectively;
[0184] storing the brightness parameter of each water meter reading area image into the third parameter variable in the preset loss calculation formula;
[0185] Calculate the loss function value according to the preset loss calculation formula.
[0186] In a possible implementation, the initial prediction network includes: a first bidirectional long short-term memory BLSTM network, a second bidirectional long short-term memory BLSTM network, and a comparison module; the first recognition module 1403 is specifically used to: use the first bidirectional long short-term memory BLSTM network to perform bidirectional prediction processing on the feature sequence to obtain a first predicted character sequence corresponding to each water meter reading area image;
[0187] A second bidirectional long short-term memory (BLSTM) network is used to perform bidirectional prediction processing on the feature sequence to obtain a second predicted character sequence corresponding to each water meter reading area image;
[0188] A comparison module is used to obtain a predicted digital character sequence corresponding to each water meter reading area image based on the first predicted character sequence and the second predicted character sequence.
[0189] Based on the same inventive concept, an embodiment of the present application also provides a first water meter reading identification device corresponding to the first water meter reading identification method. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the first water meter reading identification method mentioned above in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0190] Fig.15 A schematic diagram of a water meter reading recognition device provided by another embodiment of the present application, the device comprises: a third acquisition module 1501 and a second recognition module 1502; wherein the third acquisition module 1501 is used to acquire a water meter reading area image of a target water meter;
[0191] The second recognition module 1502 is used to use a pre-trained target water meter reading recognition model to recognize the water meter reading area image and obtain a target predicted digital character sequence of the target water meter, wherein the target water meter reading recognition model is a water meter reading recognition model obtained by the above training.
[0192] The embodiment of the present application also provides an electronic device, Fig.16 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Fig.16 As shown, it includes: a processor 1601, a storage medium 1602, and optionally, a bus 1603. The storage medium 1602 stores machine-readable instructions executable by the processor 1601. When the electronic device 60 is running, the processor 1601 communicates with the storage medium 1602 through the bus 1603. When the machine-readable instructions are executed by the processor 1601, the training method of the water meter reading recognition model and the steps of the water meter reading recognition method are performed.
[0193] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of training the water meter reading recognition model and the water meter reading recognition method are executed.
[0194] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0195] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or part of the technical solution that contributes to the prior art or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program code.
[0196] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A training method for a water meter reading recognition model, It is characterized in that The method comprises: Acquire a water meter reading data set, the water meter reading data set comprising: a plurality of water meter reading area images, wherein each water meter reading area image is annotated with a corresponding label digital character sequence; Obtaining brightness parameters of each water meter reading area image; Using a preset initial water meter reading recognition model to perform reading recognition on each water meter reading area image, and obtain a predicted digital character sequence corresponding to each water meter reading area image; According to the brightness parameters of each water meter reading area image, the label digital character sequence and the predicted digital character sequence, the initial water meter reading recognition model is adjusted to obtain the target water meter reading recognition model.
2. The training method of the water meter reading recognition model according to claim 1, It is characterized in that The initial water meter reading recognition model includes: an initial feature extraction network and an initial prediction network; The method of using a preset initial water meter reading recognition model to perform reading recognition on each water meter reading area image to obtain a predicted digital character sequence corresponding to each water meter reading area image includes: Using the initial feature extraction network to extract features from each water meter reading area image, a feature sequence corresponding to each water meter reading area image is obtained, wherein the feature sequence is composed of: a plurality of feature vectors arranged in succession; the plurality of feature vectors respectively correspond to a plurality of receptive areas in each water meter reading area image; Using the initial prediction network to predict the reading of the feature sequence, to obtain a predicted digital character sequence corresponding to each water meter reading area image; The initial water meter reading recognition model is adjusted according to the brightness parameter of each water meter reading area image, the label digital character sequence and the predicted digital character sequence to obtain the target water meter reading recognition model, including: According to the brightness parameters of each water meter reading area image, the predicted digital character sequence and the label digital character sequence, the initial feature extraction network and the initial prediction network are adjusted to obtain the target water meter reading recognition model including the target feature extraction network and the target prediction network.
3. The training method of the water meter reading recognition model according to claim 2, It is characterized in that The initial feature extraction network and the initial prediction network are adjusted according to the brightness parameters of each water meter reading area image, the predicted digital character sequence and the label digital character sequence to obtain the target water meter reading recognition model including the target feature extraction network and the target prediction network, including: Calculate the loss function value according to the brightness parameter of each water meter reading area image, the predicted digital character sequence and the label digital character sequence; According to the loss function value, the initial feature extraction network and the initial prediction network are adjusted to obtain the target water meter reading recognition model including the target feature extraction network and the target prediction network.
4. The training method of the water meter reading recognition model according to claim 2, It is characterized in that The initial feature extraction network includes: an input layer, a plurality of first convolutional layers, a plurality of maximum pooling layers, and an output mapping layer, wherein the plurality of first convolutional layers correspond to the plurality of maximum pooling layers respectively; The using the initial feature extraction network to extract features from each water meter reading area image to obtain a feature sequence corresponding to each water meter reading area image includes: Using the input layer to obtain each of the water meter reading area images as input; Sequentially using the multiple first convolutional layers and the maximum pooling layers corresponding to each of the first convolutional layers to process each of the water meter reading area images, and obtaining a feature map output by the last maximum pooling layer as the feature map of each of the water meter reading area images; The output mapping layer is used to map the feature map into the feature sequence.
5. The training method of the water meter reading recognition model according to claim 4, It is characterized in that The initial feature extraction network further includes: a second convolutional layer, wherein the pixel size of the second convolutional layer is smaller than the pixel size of the first convolutional layer; Before using the output mapping layer to map the feature map into the feature sequence, the method further includes: Using the second convolutional layer to perform convolution processing on the feature map to obtain a target feature map; The using the output mapping layer to map the feature map into the feature sequence comprises: The target feature map is mapped into the feature sequence using the output mapping layer.
6. The training method of the water meter reading recognition model according to claim 4, It is characterized in that A normalization layer is further arranged between the last of the plurality of first convolutional layers and the corresponding maximum pooling layer.
7. The training method of the water meter reading recognition model according to claim 3, It is characterized in that The calculating of the loss function value according to the brightness parameter of each water meter reading area image, the predicted digital character sequence and the label digital character sequence comprises: The label digital characters and the predicted digital characters corresponding to each water meter reading area image are stored in the first parameter variable and the second parameter variable in the preset loss calculation formula respectively; The brightness parameter of each water meter reading area image is stored in the third parameter variable in the preset loss calculation formula; According to the preset loss calculation formula, the loss function value is calculated.
8. The training method of the water meter reading recognition model according to claim 2, It is characterized in that The initial prediction network includes: a first bidirectional long short-term memory BLSTM network, a second bidirectional long short-term memory BLSTM network and a comparison module; the initial prediction network is used to predict the reading of the feature sequence to obtain the predicted digital character sequence corresponding to each water meter reading area image, including: Using the first bidirectional long short-term memory (BLSTM) network to perform bidirectional prediction processing on the feature sequence to obtain a first predicted character sequence corresponding to each water meter reading area image; Using the second bidirectional long short-term memory (BLSTM) network to perform bidirectional prediction processing on the feature sequence to obtain a second predicted character sequence corresponding to each water meter reading area image; The comparison module is used to obtain the predicted digital character sequence corresponding to each water meter reading area image based on the first predicted character sequence and the second predicted character sequence.
9. A method for identifying water meter readings, It is characterized in that The method comprises: Acquire a water meter reading area image of a target water meter; A pre-trained target water meter reading recognition model is used to recognize the water meter reading area image to obtain a target predicted digital character sequence of the target water meter, wherein the target water meter reading recognition model is a water meter reading recognition model trained using the above claims 1-9.
10. An electronic device, It is characterized in that The electronic device includes: a processor, a storage medium and a bus, the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of the method as described in any one of claims 1-9.
