1. Introduction
In most commercial and civil scenarios, pointer meters have been replaced by simpler and more convenient digital meters, but in industrial scenarios with harsh environments, digital meters are often difficult to work normally and cannot effectively monitor the results. Therefore, pointer meters are still widely used in industrial scenarios due to their advantages of stability, strong anti-interference ability, and easy cable installation. However, the problem of reading storage of pointer meters has not been effectively solved, resulting in the existing pointer meters being unable to meet the urgent needs of intelligent development of industrial production. The problem is particularly prominent in fieldwork environments such as sports vehicle systems or oil drilling engineering.
With the development of deep learning, the research on automatic identification of instruments based on deep learning has gradually been carried out. Wan Jilin et al. introduced the Faster R-CNN method to detect the meter and pointer area, and the Dice function of U-Net is constructed to solve the problem of classification imbalance and improve the accuracy and practicability of small targets in complex images [
1]. Aiming at the problem of insufficient generalization of the current detection methods, Ma Bo et al. used adaptively extracted key features as prior knowledge to generate virtual samples to optimize the recognition effect and increase the robustness in complex situations but did not realize the problem of dial correction [
2]. Chen Mengchi et al. used QR codes to locate and correct the perspective transformation, so they were able to overcome the problem of image distortion caused by the inclination of the shooting angle [
3]. Zhou Dengke et al. used generalized least squares to perform ellipse fitting on the key points extracted by the convolutional neural network and realized tilt and rotation correction by using perspective transformation and calculation of the key symmetry point of the central axis of the instrument [
4]. Aiming at the problem of the large number of parameter calculations in deep learning, Li Huihui et al. used the improved MobileNetV2 network mixing combined with Hough detection, compared with ResNet, the result reduces 90.51 percent of the parameters and 92.40 percent of the calculation, which is helpful for further deployment in mobile or embedded devices [
5]. Summarized the traditional scheme, Shen Weidong et al. used the SSD network to locate the position of the instrument in the complex background, and used the multi-scale Retinex algorithm to enhance the HSL color space image. Finally, Canny edge detection 42 and Hough transformation are used to obtain the pointer tilt angle [
6]. Xu Li et al. proposed an iterative maximum inter-class variance algorithm to optimize the pointer extraction under different illuminations and added constraints on the Hough transform to achieve a recognition rate of 95 [
7].
However, the traditional strategies of classic deep learning algorithms in pointer meter recognition are not suitable for the embedding of real-time monitoring systems. Although the detection model has been optimized at present [
8,
9], the image processing such as illumination, rotation correction, and Hough detection algorithm still requires a lot of time and is inefficient. Therefore, the traditional deep learning scheme is still limited in practical applications.
A new strategy of introducing the CSL algorithm into the YOLOv5 framework to detect the rotating target of the meter and the pointer is presented in this paper, which can simplify the detection steps and realize the direct recognition of the angle of the pointer and pointer meter. Binary encoding is used to improve the original encoding method of CSL, and the pre-cache mechanism is introduced into the algorithm to reduce the number of parameters and the calculation of the original algorithm in this strategy, then the accuracy of angle detection is improved and the angle interaction problem existing in the original algorithm is solved. The experimental results show that the scheme is not only less sensitive to light interference, but also can effectively solve the problem of rotation correction. The scheme has strong adaptability to the detection of different instruments, and the detection speed is far faster than the traditional scheme.
4. Circular Smooth Label Algorithm Improvement
4.1. Improvement of Classification Limitations
The classification interval determines the prediction accuracy. As the classification interval decreases, the classification category increases, and the accuracy increases, too. Theoretically, the smaller the classification interval, the better the measurement result. However, in fact, too many classification categories will lead to an increase in the prediction parameters and increase the complexity of classification calculation.
Binary coding [
17] is used to improve the coding of CSL classification and the classification category is represented by binary coding. Taking four categories as an example, the encoded annotation types are shown in
Table 1.
Under binary coding, multi-objective classification can be regarded as a simple binary coding classification problem, but the number of classification types will be limited to . For example, the classification category has 512 classes. The angular interval of the classification is 0.352, the IOU loss deviation is almost negligible and a certain accuracy is added.
Under this classification, the CSL algorithm needs to use 512 parameters to represent angles, but the binary-coded CSL algorithm only needs eight parameters to represent 512 types of angles. During prediction, the angle parameter
Tn, the total angle participation parameter
Pn and the parameter calculation amount
Cn are calculated by the following formulas:
Using YOLOv5 as the piggyback model for this algorithm, The number of prediction boxes (
Anchor_num) is 9. “
Parameter” represents the number of parameters involved in the angle calculation, The number of channels output by the prediction layer is 256, and the convolution kernel size is 3. The prediction layer feature image size includes (76, 76, 256), (38, 38, 256), and (19, 19, 256). The parameters and calculation amount of the CSL algorithm under YOLOv5 and the improved CSL algorithm are shown in
Table 2.
As shown in
Table 2, compared with the target detection in the original regression method, the improved algorithm uses fewer relative to the CSL algorithm in terms of the number of parameters and the amount of computation, which actually reduces the time by about 70 percent in the actual training and testing.
4.2. Improvement of Directional Ambiguity
When making angle predictions, there are often cases where the actual angle differs from the predicted angle by about 180 degrees. This is due to the interaction of the angles. As shown in the figure, the real angle should be angle “b”, but in the CSL algorithm, the angle is limited to −90 degrees to 90 degrees, and the predicted result is angle “a”, which is 180 degrees different.
In
Figure 4, the pointer green “P” points to the upper half area, that is, when the pointer angle is in the range [0, 180), the predicted angle “B” and the actual angle “b” are the same; however, when the pointer red P points to the lower half area, that is, when the pointer angle is in the range [0, −180), the actual angle is “a” but the predicted angle is “A”, and the difference between the two angles is 180 degrees. Therefore, the angle transformation should be introduced.
In
Figure 4, if the pointer angle is in the range [0, 180), the predicted angle B and the actual angle b are the same angle when the pointer green P points to the upper half area. When the pointer red P points to the lower half area, if the pointer angle is in the range [0, −180), the actual angle is a but the predicted angle is A and the difference between the two angles is 180 degrees. In this case, angle transformation is required.
As shown in
Table 3 relative angle predictions, the predicted value is shown by “Pred(a,b)”, “a” represents the predicted dial angle result, “b” represents the predicted pointer angle result, “Error” represents the relative error with the actual angle, and “T/ F” represents the prediction result of the relative angle.
Due to the interactivity of the angle, setting the angle label range between −180 and 180 is not ideal for angle prediction due to the interactivity of angles. Therefore, the idea of frame angle cache is proposed, and the angle of the previous frame image is cached. Thresholds are set to ensure the continuity of angle changes. If the angle jump exceeds the threshold, it can be considered that the predicted angle and the real angle have interactively transformed, and then adjust the forecast angle.
7. Conclusions
A new strategy for an instrument pointer recognition scheme is proposed in this paper, two defects of the CSL algorithm in angle detection are indicated and the 368 algorithm has been improved by using the strategies of binary encoding and threshold contrast preset and cached. The problem of the CSL algorithm is solved, and the results of the algorithm are also verified. The improved CSL algorithm is introduced into the OBB target detection of the YOLOv5 model, then the direct detection of the pointer angle is realized, and the one-step intelligent identification of the pointer-type meter readings is completed. Compared with traditional schemes, the tedious process of image preprocessing is avoided, the effects of light and shadow are overcome, and the rotational correction process to the instrument image is eliminated. Additionally, the problem of the insufficient adaptation ability of Hough detection is also addressed, and the ability of the improved algorithm scheme to detect small target instruments is also greatly improved, which can meet the requirements of industrial production in accuracy and speed. This new strategy has an important application value to the intelligent development of industrial production.