Method and device for digital recognition of temperature instrument based on CNN-LSTM
Through a method based on CNN-LSTM, combining the long short-term memory network of convolutional neural network and recurrent neural network, the digital recognition of temperature instruments is directly performed, which solves the problem of cumbersome digital recognition process of temperature meters in the existing technology and improves efficiency and prediction. accuracy of results.
Patent Information
- Application Number
- CN202010802979.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-11
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-08-11
AI Technical Summary
In the existing technology, the temperature instrument digital recognition process is cumbersome and inefficient. It is limited by the processing complexity of machine learning technologies such as support vector machines, resulting in low efficiency in the prediction process.
Using a method based on CNN-LSTM, the temperature meter digital recognition is carried out through the long short-term memory network in the convolutional neural network and the recurrent neural network, and the display picture is directly used as the overall input model for prediction, which simplifies the preprocessing process of reading recognition. And improve the accuracy of prediction results through bidirectional long short-term memory network and connected temporal classifier.
It greatly simplifies the preprocessing process of temperature instrument digital identification, improves prediction efficiency, solves the problem of difficulty in corresponding input and output, and improves the performance of prediction results.
Smart Images

Figure CN111985484B
Abstract
Description
Technical Field
[0001] The present application relates to the field of neural network technology, and in particular to a method and device for digital recognition of temperature instruments based on CNN-LSTM. Background Art
[0002] With the extensive use of temperature instruments in substations, the workload of power grid thermal engineering professionals is becoming increasingly saturated. Limited by the slow temperature control speed of standard temperature equipment, temperature professionals face risks such as low efficiency, difficulty in concentration, and fire caused by out-of-control temperature equipment during field and laboratory work. In order to save manpower and time in temperature instrument readings in the power industry, many related automatic reading technologies continue to emerge, which have greatly improved production efficiency and accuracy.
[0003] The existing similar technology proposes to perform certain graphics preprocessing on the original instrument image and convert it into a binary image with a relatively fixed size and angle; after cutting the current binary image into a single digital image, use machine learning related technologies such as Support Vector Machine (SVM) to perform digital recognition and decimal point position recognition. Using SVM modeling to perform individual digital recognition and then combine and output makes the overall prediction process cumbersome and inefficient. Summary of the invention
[0004] In order to solve the above problems, the present application provides a method and device for temperature instrument digital recognition based on CNN-LSTM to solve the problem of low efficiency caused by cumbersome prediction process in the prior art.
[0005] In order to achieve the above objectives, this application is implemented through the following technical solutions:
[0006] On the one hand, a method for digital recognition of temperature instruments based on CNN-LSTM, the method comprising:
[0007] Get the temperature meter display picture;
[0008] Performing graphics preprocessing on the temperature meter indication image to obtain a binary indication image;
[0009] Determine the image features of the binary image according to the convolutional neural network;
[0010] According to the long short-term memory network in the recurrent neural network, digital recognition is performed on the features of the image to obtain probability data;
[0011] The probability data is input into a Softmax activation function to obtain an output sequence; the output sequence is decoded according to a connection timing classifier to determine a temperature reading digital string.
[0012] Optionally, the step of performing graphics preprocessing on the temperature meter indication image to obtain a binary indication image includes:
[0013] According to the Hough transform, the temperature meter numerical image is rotated, and the rotated image is cut to obtain a numerical image;
[0014] After the indication picture is binarized, an opening operation is performed to obtain a binarized indication picture.
[0015] Optionally, the structure of the convolutional neural network includes a convolution layer and a maximum pooling layer.
[0016] Optionally, the step of performing digital recognition on the image features according to the long short-term memory network in the recurrent neural network to obtain probability data includes:
[0017] The bidirectional long short-term memory network structure performs forward and reverse calculations on image features, outputs intermediate information, and obtains probability data.
[0018] Optionally, the search method adopted by the connection timing classifier is beam search.
[0019] On the other hand, a device for digital recognition of temperature instruments based on CNN-LSTM, the device comprising:
[0020] An acquisition unit, used for acquiring a temperature meter display image;
[0021] A processing unit, used for performing graphic preprocessing on the temperature meter indication image to obtain a binary indication image;
[0022] A determination unit, for determining the image features of the binary image according to a convolutional neural network;
[0023] A recognition unit, which is used to digitally recognize the features of the picture according to the long short-term memory network in the recurrent neural network to obtain probability data;
[0024] The output unit is used to input the probability data into the Softmax activation function to obtain an output sequence; the decoding unit is used to decode the output sequence according to the connection timing classifier to determine the temperature reading digital string.
[0025] It can be seen from the above technical solutions that the present application provides a method and device for digital recognition of temperature instruments based on CNN-LSTM. The method adopts a convolutional neural network combined with a long short-term memory network in a recurrent neural network for modeling, so that the image data in the input model does not need to undergo cumbersome preprocessing processes such as excessive cutting, and the indication image can be directly used as the overall input model for prediction, which greatly simplifies the preprocessing process of reading recognition. Among them, the long short-term memory network part adopts a bidirectional long short-term memory network, and considers past and future information at the same time, so that the prediction results are relatively better. The connection time series classifier is used to decode the output sequence, which solves the problem of difficult correspondence between input and output, simplifies many steps, and improves prediction efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0027] Figure 1 A schematic diagram illustrating the rotation angle of a picture of a method for digital recognition of a temperature instrument based on CNN-LSTM in an embodiment of the present application;
[0028] Figure 2 A schematic diagram of the network structure of a method for digital recognition of temperature instruments based on CNN-LSTM in an embodiment of the present application;
[0029] Figure 3 A schematic diagram of the calculation of the convolution layer of a method for digital recognition of temperature instruments based on CNN-LSTM in an embodiment of the present application;
[0030] Figure 4 This is a schematic diagram of the output of the maximum pooling layer of a method for temperature instrument digital recognition based on CNN-LSTM in an embodiment of the present application;
[0031] Figure 5 A schematic diagram of the structure of a basic unit of a long short-term memory network in an embodiment of the present application;
[0032] Figure 6 This is a schematic diagram of the mapping calculation process of a method for temperature instrument digital recognition based on CNN-LSTM in an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to make the technical means, creative features, objectives and effects achieved by this application easy to understand, this application is further explained below in conjunction with specific implementation methods.
[0034] On the one hand, a method for digital recognition of temperature instruments based on CNN-LSTM, the method comprising:
[0035] First, obtain the temperature meter indication picture; take a certain number of temperature meter indication pictures at industrial sites and organize them into a temperature indication picture library. In this embodiment, a total of 2000 unprocessed temperature meter indication pictures and indication labels of temperature meter indication pictures are collected.
[0036] The thermometer indication image is graphically preprocessed to obtain a binary indication image; the thermometer indication image in the temperature indication image library is graphically preprocessed so that the thermometer indication image is finally converted into a binary image with a fixed angle and size, containing only the reading part, that is, a black and white image. The preprocessed image is easier to extract features and train in the AI model. Then all the binary indication images are divided into a training set and a test set according to a certain ratio. The ratio can be set to 8:2, which is not specifically limited in this embodiment.
[0037] In some embodiments, the step of performing graphics preprocessing on the temperature meter indication image to obtain a binary indication image includes:
[0038] Hough transform is used to detect the straight lines whose angle with the vertical direction θ is less than a threshold value. The threshold value can be set to 30°, which is not limited in this embodiment. The mean value of all θ of the family of straight lines is calculated. And rotate the image Get the corrected image. Figure 1 As shown, the horizontal axis x represents the length of the processed image, the vertical axis y represents the width of the processed image, and r is the distance from any fixed point in the image to the straight line.
[0039] According to Hough transformation, the temperature meter digital image is rotated, and the rotated image is cut to obtain a digital image; the digital image is an image that ensures that the displayed numbers are complete and has the smallest area.
[0040] After the indication image is binarized, an opening operation is performed to obtain the indication binary image. The binarization process includes: assuming a threshold value p, the gray value of each pixel in the image is u i , the conversion relationship is as follows:
[0041]
[0042] The opening operation of an image is to first perform an erosion operation to remove the boundary noise in the image and shrink the outside to the inside; then perform an expansion operation to merge the intervals inside the numbers to make the model easier to recognize.
[0043] Secondly, according to the convolutional neural network (CNN), the image features of the binary image of the indication are determined; the convolutional neural network (CNN) can automatically extract certain features of the input image so as to subsequently input it into the long-short term memory (LSTM) network for digital recognition.
[0044] In some embodiments, Figure 2 As shown in Figure 1, the structure of a convolutional neural network includes a convolutional layer and a maximum pooling layer. The convolutional layer (Conv) is a hidden layer that uses a convolution kernel to extract features. Figure 3 As shown, the convolution kernel is a square matrix. Assuming the convolution kernel is 3*3, starting from the upper left corner, the convolution kernel corresponds to the 3*3 matrix range of the data, and then multiply and add to get a value. In this order, the operation is performed once for every other pixel, and 9 values are obtained. The matrix formed by these nine values is called an activation map.
[0045] The Max Pooling layer is a hidden layer used to reduce the parameters of the convolutional layer. Figure 4 As shown in the figure, a square matrix of a certain size is used to slide from the upper left corner of the matrix output by the pooling layer with a certain step length, and the maximum value of the matrix in the window is selected as the output. The specific parameter settings in the CNN module are detailed in the table below:
[0046]
[0047] Then, according to the long short-term memory network (LSTM) in the recurrent neural network, digital recognition is performed on the image features to obtain probability data.
[0048] In some embodiments, Figure 2 As shown, the step of performing digital recognition on the image features according to the long short-term memory network in the recurrent neural network to obtain probability data includes: a bidirectional long short-term memory network structure performs forward calculation and reverse calculation on the image features, outputs intermediate information, and obtains probability data.
[0049] Long short-term memory network (LSTM) is a special structure in recurrent neural network (RNN). Compared with recurrent neural network (RNN), the implementation of long short-term memory network (LSTM) not only depends on the previous time step and current input, but also takes into account more previous information. Figure 5 As shown, C t-1 represents the cell memory state at time t-1, C t represents the cell memory state at time t, ht-1 represents the output information at time t-1, h t represents the output information at time t, x t Represents the input information at time t, σ represents the sigmoid function, and tanh represents the tanh function.
[0050] The hidden layer of the bidirectional LSTM structure needs to store two values, and the same sequence is calculated from the front to the back and from the back to the front. For each time t, the output is jointly determined by the two unidirectional LSTMs. The specific parameter settings of the bidirectional LSTM module are detailed in the table below:
[0051]
[0052] Finally, the probability data is input into a Softmax activation function to obtain an output sequence; the output sequence is decoded according to a Connectionist Temporal Classifier (CTC) to determine a digital string of the temperature reading.
[0053] The training set data is input into the model for training. The loss function is a function used to measure the deviation between the predicted value and the actual value. The loss function calculates the deviation between the predicted value and the actual value, and updates the parameters in the neural network according to the deviation value to continuously optimize the neural network model. Figure 2 As shown in the figure, the loss function is set to CTC Loss, the optimizer is Adam, and the initial learning rate is set to 0.001. The neural network is trained using the loss function. After 200 epochs, the loss function of the model tends to converge. The test set data is input into the model for prediction, and the output value obtained by the Softmax layer is decoded into the predicted label value using CTC.
[0054] CTC outputs each possible output and the conditional probability of each possible output. CTC can be used to solve the problem that it is difficult to correspond one-to-one between the input sequence and the output sequence. Given an input x, CTC outputs each possible output and the conditional probability of each possible output. For example, each output of a recurrent neural network (RNN) must correspond to each position in a character image. It is too much work to do such labeling manually, and the number of characters in the image is different, the font style is different, and the size is different, resulting in the output not necessarily corresponding to each character one-to-one.
[0055] CTC can transform the problem into an optimization problem of solving the maximum conditional probability of the output sequence. The solution formula is:
[0056]
[0057]
[0058] Where l is the real output string sequence, π is the output string sequence of the model, the subscript πt represents the index corresponding to the element selected in the output string sequence of the model at time step t, B is the mapping that converts π to the real output, T is the total time, x is the input, and y is the output.
[0059] In some embodiments, the search method used by the connection timing classifier (CTC) is beam search. Figure 6 As shown, assuming that the specified mapping B=3, the three characters with the highest probability are selected in the first time step, and then the three characters with the highest probability are also selected in the second time step. The two-by-two combinations, that is, the probabilities are multiplied, can be combined into 9 sequences. These sequences will get some identical outputs after B conversion. The sequences with the same output are merged. For example, there are 3 sequences that can be converted into a. Merge them, that is, add the probabilities together, calculate the three sequences with the highest probability, and then continue to merge with the characters of the next time step in the same way.
[0060] On the other hand, a device for digital recognition of temperature instruments based on CNN-LSTM, the device comprising:
[0061] An acquisition unit, used for acquiring a temperature meter display image;
[0062] A processing unit, used for performing graphic preprocessing on the temperature meter indication image to obtain a binary indication image;
[0063] A determination unit, for determining the image features of the binary image according to a convolutional neural network;
[0064] A recognition unit, which is used to digitally recognize the features of the picture according to the long short-term memory network in the recurrent neural network to obtain probability data;
[0065] The output unit is used to input the probability data into the Softmax activation function to obtain an output sequence; the decoding unit is used to decode the output sequence according to the connection timing classifier to determine the temperature reading digital string.
[0066] It can be seen from the above technical solutions that the present application provides a method and device for digital recognition of temperature instruments based on CNN-LSTM. The method adopts convolutional neural network (CNN) combined with long short-term memory network (LSTM) in recurrent neural network (RNN) for modeling, so that the image data in the input model does not need to be subjected to cumbersome preprocessing processes such as excessive cutting, and the indication image can be directly used as the overall input model for prediction, which greatly simplifies the preprocessing process of reading recognition. Among them, the long short-term memory network (LSTM) part adopts a bidirectional long short-term memory network, and considers past and future information at the same time, so that the prediction result performance is relatively better. The connection time series classifier (CTC) is used to decode the output sequence, which solves the problem that the input and output are difficult to correspond, simplifies many steps, and improves the prediction efficiency.
[0067] The embodiments of the present application are described in detail above, but the contents are only preferred embodiments of the present application and cannot be considered to limit the scope of implementation of the present application. All equivalent changes and improvements made within the scope of the present application should still fall within the scope of the patent coverage of the present application.
Claims
1. A method for digital recognition of temperature instruments based on CNN-LSTM, characterized in that: The method comprises: Get the temperature meter display picture; Performing graphics preprocessing on the temperature meter indication image to obtain a binary indication image; According to the Hough transform, the temperature meter numerical image is rotated, and the rotated image is cut to obtain a numerical image; After binarization processing is performed on the indication picture, an opening operation is performed to obtain a binary indication picture; Determine the image features of the binary image according to the convolutional neural network; According to the long short-term memory network in the recurrent neural network, digital recognition is performed on the image features to obtain probability data, including: The bidirectional long short-term memory network structure performs forward and reverse calculations on the image features, outputs intermediate information, and obtains the probability data; The probability data is input into a Softmax activation function to obtain an output sequence; the output sequence is decoded according to a connection timing classifier to determine a temperature reading digital string.
2. The method for digital recognition of temperature instruments based on CNN-LSTM according to claim 1 is characterized in that: The structure of a convolutional neural network consists of a convolutional layer and a maximum pooling layer.
3. The method for digital recognition of temperature instruments based on CNN-LSTM according to claim 1 is characterized in that: The search method adopted by the connection timing classifier is beam search.
4. A device for digital recognition of temperature instruments based on CNN-LSTM, characterized in that: The device comprises: An acquisition unit, used for acquiring a temperature meter display image; A processing unit, used for performing graphic preprocessing on the temperature meter indication image to obtain a binary indication image; A determination unit, used to determine the image features of the binary image according to a convolutional neural network; The recognition unit is used to perform digital recognition on the image features according to the long short-term memory network in the recurrent neural network to obtain probability data, including: The bidirectional long short-term memory network structure performs forward and reverse calculations on the image features, outputs intermediate information, and obtains the probability data; The output unit is used to input the probability data into the Softmax activation function to obtain an output sequence; the decoding unit is used to decode the output sequence according to the connection timing classifier to determine the temperature reading digital string.
