Research on Automatic Recognition of Pointer Meter Reading Based on Deep Learning Algorithm

With the rapid development of computer technology and intelligent high-performance hardware, deep learning algorithm plays an increasingly important role in society. The development of automatic identification method of instrument and instrument based on deep learning can effectively improve the working efficiency of the basic power grid operation and maintenance personnel, avoid personnel approaching the high-risk operation area, and ensure the continuous monitoring of the readings of key instruments all day. In this paper, a recognition algorithm of pointer types circular instrument based on deep learning algorithm is proposed. Gaussian filter and binary method are used to achieve better recognition effect, which lays a good theoretical foundation for further practical application.

of great significance to use technical means to realize automatic reading recognition of pointer instrument and realize continuous monitoring of target meter reading by computer.
With the rapid development of computer vision technology and the rapid upgrading of graphics processor and other hardware in recent years, artificial intelligence technology has been greatly developed. There are many kinds of computer intelligent algorithms about image recognition, which help people realize many convenient and practical recognition functions. However, the research on automatic identification of related instruments in unattended substation is rare, in order to solve the technical difficulties encountered in the actual production process, the research content of this paper mainly focuses on the pointer positioning and fitting of the pointer meter, which is one of the key technologies to realize the reading of the pointer meter. The overall scheme framework of instrument reading is as follows.

Image preprocessing algorithm
To recognize the dial and reading in the original image, the first step is to preprocess the acquired image, including image filtering and gray processing. Image filtering is a process of modifying or enhancing the expression of original image features. It is generally used to emphasize some features in the original image or remove other features inconsistent with the target in the original image. It is an indispensable operation in image preprocessing to suppress the noise of the target image under the condition of keeping the detailed features of the image as much as possible, the quality of its processing effect will directly affect the effectiveness and reliability of subsequent image processing and analysis. Image filtering algorithms generally include mean filtering, median filtering, double edge filtering and so on. Mean filtering, as the name implies, is to replace the original pixel value with the average value of the pixels in the neighborhood around the pixel, which can smooth the image and reduce the sharpness of the original image. But, when filtering out the image noise, it will also filter out the edge information of the image, leading to the elimination of some details of the image, and the filtering effect is poor. Median filtering uses the median value of the pixels in the neighborhood set around the pixels to replace the original pixel value. It is often used to deal with the salt and pepper noise in the image to smooth the noise in the original image.
As one of the most common image noises, Gaussian noise often comes from the environment or electronic sensors. It is a kind of noise whose probability density function is Gaussian distribution, in 3 this paper, we use Gaussian filter to eliminate the influence of Gaussian noise. Gaussian filtering is a kind of linear filtering. The image after Gaussian filtering is relatively smooth and can be used for subsequent recognition. Gaussian filter uses Gaussian kernel to smooth image, and Gaussian kernel is obtained by discretization of two-dimensional Gaussian function, the expression is as follows.
Among them,  means standard deviation, the Gaussian kernels with different standard deviations are also different. The weight coefficient of Gaussian kernel obeys Gaussian distribution, the weight near the center is higher, and the weight far away from the center point decreases rapidly. In the process of Gaussian filtering, the value of  is very important. The smaller the value of standard deviation is, the smaller the coefficient of edge weight of Gaussian kernel is, and the smaller the influence of pixels of neighborhood set around original pixels on pixels. On the other hand, the larger the standard deviation is, the greater the edge weight coefficient of Gaussian kernel is, and the greater the influence of the pixels of the neighborhood set around the original pixels on the pixels, which makes the image too fuzzy and unable to eliminate Gaussian noise. In this paper, Gaussian kernel with standard deviation of 1 and size of 5 * 5 is used for Gaussian filtering, as shown below. The gradient of image features is the most important factor in computer recognition of objects in images. Gradient represents image edge information, which is one of the cores and essential expressions of image. Therefore, in order to reduce the color interference and the amount of calculation, gray processing is also needed when analyzing and recognizing the image based on the traditional morphology method, the image is transformed into a feature image with color space of 1 and numerical range of 0-255, so as to express and analyze the gradient information of the image intuitively. Image gray processing methods generally include component method, maximum value method, average value method and weighted average method. Component method is to decompose the image described by RGB model in color space to generate three different grayscale images, and select the grayscale image according to the actual needs. The maximum value method takes the value corresponding to the highest value of three color components in the image described by RGB model as the gray value, so as to realize the gray level processing of the original image. The average value method takes the average value of three color components of RGB model as the gray value, that is to calculate the gray value directly by arithmetic average of the three color components.
In this paper, the weighted average method is used to process the gray level of the image. The weighted average method is an improvement of the average value method. The average value method can be regarded as a special weighted average method with weight coefficients of 0.333. Based on the characteristics of human eyes' sensitivity to different colors, the weight coefficients of three primary colors are set differently, and the weight coefficients of red, green and blue are set to 0.3, 0.58 and 0.12 respectively, and then the image is processed in gray level. The weighted average algorithm is as follows. Among them, Gray (i, j) represents the pixel value of pixel points after gray processing, R represents the value of red space pixels, G represents the green space pixel value, and B represents the blue space pixel value.

Dial and pointer position determination
Image binarization, also known as threshold segmentation, is to get a binary image with the final value of 0 and 255 through appropriate threshold selection or brightness value transformation of 256 gray level images. The binary image becomes simpler, but it still retains the overall or local characteristics of the image, and can highlight the target contour to a certain extent. The quality of image binarization directly affects the final recognition result. If the wrong strategy is used to binarize the brightness information of the original image, the image feature recognition will be seriously affected, which will cause serious interference and effective utilization to the image feature extraction and analysis of the subsequent algorithm, and then affect the final target detection and positioning fitting. There are many kinds of image binarization methods, which can be divided into global threshold method, local threshold method and dynamic threshold method according to the characteristics of threshold division.
Canny detection is used to further process the preprocessed image, the gradient size and direction of pixels are used to get the edge image according to the set high threshold value, and then a low threshold is set. If there is a point near the breakpoint that is higher than the low threshold, it will be marked as the edge, and finally the edge image will be obtained. Then each pixel (x, y) of the edge image is traversed. Each pixel is taken as the preset center of the circle. The initial value of the search radius R is set to 1, and four points are detected, which are (x-r,y), (x+r,y), (x,y-r), (x,y+r). If no edge points are found near these points, then make r = r + 1 to search again. If all r is not true, then (x, y) is not the center point of the circle. If there are edge points near the four points mentioned above, then we further search for whether there are edge points near the 16 points with r as radius (x, y), they are the points on the circle corresponding to x, x±r/4, x±r/2, x±3r/4 and x±r. If no edge points are found near these points, let r = r + 1 search again until a set of satisfying conditions (x, y, r) is found, and record the parameters of this group of circles. Finally, the circle with the largest radius R is selected as the dial and the center coordinates are obtained as (c_x,c_y).
In the research of traditional pointer instrument automatic recognition, there are many methods to determine the pointer, such as Hough transform algorithm, least square method, Bresenham algorithm and so on. These methods can be used to detect the line of binary image, and finally determine the position of the pointer. Hough transform is a feature extraction technology in image processing. In a parameter space, the local maximum value of cumulative results is calculated to get a set of the specific shape as the result of Hough transform. Hough transform was first proposed by Paul Hough in 1962. The original Hough transform was designed to detect straight lines and curves. The original method required to know the analytical equation of the boundary line of the object, but did not need the prior knowledge about the location of the region. One of the outstanding advantages of this method is robustness of segmentation results, that is, it is not very sensitive to incomplete data or noise. However, it is often impossible to obtain an analytical representation of the boundary. In 1972, it was popularized by Richard Duda & Peter Hart. Classical Hough transform was used to detect straight lines in images. Later, Hough transform was extended to recognize objects of arbitrary shape, mostly circles and ellipses. Hough transform uses the transformation between two coordinate spaces to map a curve or a straight line with the same shape in one space to a point in the other coordinate space to form a peak value, thus transforming the problem of detecting arbitrary shape into the problem of statistical peak value.
After finding the center of the circle (c_x, c_y) above, on the basis of the gray image, the accumulated gray value of each angle within 360 ° is searched, and the center angle is divided into 360 parts, establish a gray array acc_gray[360], acc_gray [i] represents the accumulated gray value of pixels in i direction with (c_x,c_y) as the center of the circle, establish a cumulative pixel array acc_ptr [360], acc_ptr [i] represents the total number of pixels in the direction i of the center angle of (c_x, c_y). Initialize both acc_gray and acc_ptr to 0, traverse every pixel pt in the gray level processed Then calculate the index corresponding to the minimum value of the array ACC, that is, the pointer angle corresponding to the center (c_x,c_y).
angle(c_x,c_y)=argmin i acc [i] In order to eliminate the error caused by the inaccuracy of the center of the circle obtained above, all the points which may be used as the center of the circle are traversed in the small neighborhood of the center of the circle obtained above, and the above algorithm is re-executed. If there is a new center coordinate (c_x', c_y'), the center angle angle (c_x', c_y') corresponding to the new minimum average gray level will be obtained. Compare the average minimum gray level of all these centers, and take the minimum value, which is the average minimum gray value we need to find, and the corresponding center coordinates are (x_best,y_best), the final pointer angle is the angle corresponding to the center coordinate of the circle.
The experimental results using the above algorithm are shown in the figure below.

Conclusions
In this paper, a method of pointer location and fitting for circular instrument based on deep learning algorithm is implemented. Firstly, Gaussian filtering and graying are used to preprocess the original image to eliminate the influence of natural noise on recognition and improve the speed and accuracy of subsequent recognition. Then, an improved Hough transform method is used to identify the position of the dial and pointer. In the image binarization processing, the recognition efficiency is improved by the design of high and low thresholds. Finally, through the method of gray level accumulation and average gray level comparison, a more accurate dial center and pointer positioning is achieved. From the experimental results, we can see that the algorithm designed in this paper can achieve the goal better, and the dial and pointer positioning are more accurate. Although the shadow and angle tilt of the original image will have a certain impact on the recognition results in theory, overall, the algorithm in this paper has good accuracy and stability.