Pointer type precision pressure gauge identification method based on artificial intelligence technology
Through the combination of YOLOv5 and U2Net, the problem of large reading error and low efficiency of pointer pressure gauge is solved, and high-precision and fast automatic reading recognition is achieved.
Patent Information
- Application Number
- CN202510400359.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-11
AI Technical Summary
Traditional manual reading methods lead to large errors in pointer pressure gauge readings and low efficiency. The existing deep learning models lack recognition accuracy in complex environments and cannot meet the needs of high-precision verification.
The pressure gauge area is detected by YOLOv5 neural network, combined with the Hough transform correction tilt dial, the improved U2Net model is used for pointer and scale segmentation, and the reading is calculated through polar coordinate expansion and scale mapping algorithm.
It realizes efficient and accurate pointer pressure gauge reading recognition in complex environments, with an error of less than ±0.1% FS, adapting to multi-scene needs.
Smart Images

Figure CN120299011A_ABST
Abstract
Description
[0002] The present invention studies an automatic indication recognition method for a pointer-type precision pressure gauge. This method collects the dial image through an industrial camera, and uses the YOLOv5 target detection network to quickly locate the pressure gauge area; combines the Hough transform to detect the dial contour, and corrects the tilted dial through perspective transformation to achieve geometric correction; uses an improved U2Net model to perform double-mask segmentation on the dial and the pointer, and combines the polar coordinate expansion technology to convert the annular dial into a linear image; finally, based on one-dimensional data interpolation, dynamic threshold detection, and scale mapping algorithms, the pointer position is accurately calculated and the indication value is output. The present invention solves the problems of low efficiency, large error in traditional manual reading, and weak anti-interference ability of existing algorithms, can effectively adapt to complex lighting, background interference, and dial tilt scenarios, significantly improves the efficiency and accuracy of automatic reading of instruments, and provides a reliable solution for high-precision detection of industrial instruments. Technical Field
[0003] The present invention relates to the technical fields of computer vision and instrument detection, and specifically relates to a dial detection method combining deep learning models and image processing technologies, which is particularly suitable for automatic reading scenarios of circular dials such as industrial instruments and pressure gauges. Background Art
[0004] A pointer-type pressure gauge is a pressure measurement instrument based on the principle of elastic deformation. Its core converts the medium pressure into mechanical displacement through elastic elements (such as Bourdon tubes, diaphragms, or bellows) to achieve indication. When the measured medium acts on the elastic element, the deformation amount generated by the element has a linear relationship with the pressure value. This deformation is amplified by transmission mechanisms such as gear sets and connecting rods, and then drives the pointer to deflect on the annular scale dial to indicate the pressure. Thanks to its mechanical stability, anti-electromagnetic interference, and resistance to extreme environments, such instruments are widely used in industrial process control, energy equipment monitoring, and other fields, but need to be periodically calibrated to ensure the accuracy of the indication.
[0005] There are significant technical bottlenecks in the traditional calibration process:
[0006] 1. Manual reading error: The current standard requires the operator to visually align the pointer with the tangent of the scale line (the three-point alignment principle). In actual implementation, it is easily affected by viewing angle deviation, scale resolution limitation, and the operator's subjective judgment, resulting in a reading volatility of more than ±0.5% FS;
[0007] 2. Efficiency restriction: The manual point-by-point recording method is time-consuming and laborious, and cannot meet the industrial requirements of parallel calibration of multiple instruments and high-frequency data acquisition;
[0008] Traditional automatic instrument reading algorithms are based on classical image processing techniques and rely on methods such as edge detection and template matching. However, they have the following inherent defects: they cannot effectively solve problems such as uneven illumination, complex background interference, instrument tilt imaging, image blurring, and scale changes, and require complex preprocessing processes. In recent years, deep learning techniques have shown great potential in the field of computer vision. By constructing multi-layer neural networks to achieve non-linear feature mapping, they can autonomously learn complex patterns and improve robustness. However, existing deep learning models still face technical challenges such as insufficient accuracy in dial distortion correction and difficulty in sub-pixel positioning of pointers in the identification of pointer-type instrument readings. There is an urgent need for targeted algorithm optimization to meet the engineering requirements of high-precision verification. Summary of the Invention
[0009] The purpose of the present invention is to provide a pointer-type pressure gauge identification method with both high efficiency and high-precision recognition capabilities, which can adapt to the recognition needs in multi-scene environments. Through the scale mapping algorithm, digital reading calculation is realized, effectively improving the accuracy and processing efficiency of pressure gauge reading identification in different environments. To achieve the above purpose, the following technical solutions are proposed.
[0010] A method and device for intelligent identification of pressure gauge pointers, including the following steps:
[0011] Step 1, train the YOLOv5 neural network to realize the detection and classification of the pointer-type pressure gauge to be identified;
[0012] Step 2, use the Hough transform to detect the dial contour and perform geometric correction on the tilted dial based on perspective transformation;
[0013] Step 3, train the U2Net neural network to segment the pointer and scale information of the pressure gauge;
[0014] Step 4, taking the corrected center as the pole, perform non-linear polar coordinate expansion on the segmented information;
[0015] Step 5, use the scale mapping algorithm to calculate the pointer reading.
[0016] For further improvement and perfection of the aforementioned method for intelligent identification of pressure gauge pointers, in Steps 1 and 3, the process of manual annotation of model training materials is also included. The selected annotation tool is LabelMe. In Step 1, the annotation tool uses a rectangular box to mark the instrument area and label the category label; in Step 3, the scale line and pointer contour area are accurately marked through a closed polygon, and the scale and pointer semantic labels are respectively assigned. The above annotation information is saved as an XML file, and the XML is respectively converted into TXT and JSON dataset files through conversion functions, and the datasets are placed in the specified paths of the two networks to complete the training of the model.
[0017] For further improvement or perfection of the above-mentioned intelligent identification method and device for pressure gauge pointers, in step 1, a lightweight YOLOv5 model is used as the object detector, the input image is 640×640, and when the detected confidence threshold is greater than 0.7, it is determined as a valid pressure gauge target; if there are multiple types of pointer pressure gauges, each pressure gauge needs to be classified and each instrument needs to be traversed and identified.
[0018] For further improvement and perfection of the above-mentioned intelligent identification method and device for pressure gauge pointers, in step 2, the Hough transform is used to perform the Hough gradient method circle detection within the ROI region output by YOLOv5, the dial contour is detected and the ellipse information is obtained. For the tilted dial, perspective transformation is used for geometric correction. By the least squares method, the edge point set of the dial is fitted to obtain the tilt angle θ of the major axis of the ellipse, and the four pole axis points (x′1, y′1), … (x′4, y′4) of the target circle are generated. The homography matrix H is calculated, and the H matrix is applied to perform perspective correction on the tilted dial, with the angle error Δθ ≤ ±0.1°.
[0019] For further improvement and perfection of the above-mentioned intelligent identification method and device for pointer pressure gauge pointers, when segmenting the scale and the pointer in step 3, by introducing a spatial attention mechanism into the improved U2Net model, pixel-level separation between the dial area and the pointer area is realized, and a single-pixel-level pointer center line is generated through the skeleton extraction algorithm, laying a foundation for subsequent sub-pixel positioning.
[0020] For further improvement and perfection of the above-mentioned intelligent identification method and device for pressure gauge pointers, with the corrected center of the circle obtained in step 2 as the pole and the annular region r ∈ [0.5R, R] as the radial range, where R is the radius of the corrected circle, the reverse mapping from polar coordinates to Cartesian coordinates is performed, the points within the ring are transformed through polar coordinates to obtain linear coordinate information, and vertical projection analysis is performed on the unfolded linear image to extract the peak positions of the scale lines. The center positions of the scale lines are determined through Gaussian fitting, and a scale physical value mapping table is established.
[0021] For further improvement and perfection of the above-mentioned intelligent identification method and device for pressure gauge pointers, after steps 3 and 4, based on the polar coordinate expansion result, the relative position information of each scale and the pointer can be obtained. Through the scale physical value mapping table, the indicated values of two adjacent scales of the pointer can be known. Let the range be Range and the abscissa of the pointer be x p , and the abscissas corresponding to adjacent scales i and i + 1 are x i and x i+1 , and n is the total number of scales, then the indicated value calculation is:
[0022]
[0023] This algorithm supports piecewise interpolation calculation with non-uniform scales, minimizing the linearization error caused by circular arc distortion to the greatest extent.
[0024] Its beneficial effects are as follows:
[0025] The present invention proposes an intelligent recognition method and device for pressure gauge pointers. By using different neural networks for instrument detection and pointer scale segmentation respectively, using the YOLOv5 object detection algorithm to locate the instrument area helps to exclude background interference and improve the subsequent processing effect; using the U2Net semantic segmentation algorithm to accurately segment the pointer and scale, and using the scale mapping algorithm to calculate the reading reduces the error introduced by the traditional ratio method. After testing, the recognition accuracy has been greatly improved. This method has strong adaptability, can meet the requirements in different scenarios, and can achieve efficient and accurate recognition of analog pressure gauges; this method demonstrates the great potential of deep learning technology in solving practical problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The following drawings show specific examples of the technical solutions of the present invention, which are used to explain the content, principle and effects of the present invention.
[0027] Unless otherwise specified or defined, in different drawings, the same reference numerals represent the same or similar technical features, and for the same or similar technical features, different reference numerals may also be used for representation.
[0028] Figure 1 is a flowchart of the indication recognition method for an analog pressure gauge disclosed in an embodiment of the present invention;
[0029] Figure 2 is an effect example diagram of pointer scale segmentation of the indication recognition method for an analog pressure gauge disclosed in an embodiment of the present invention;
[0030] Figure 3 is an example diagram of scale segmentation information in the channel of an analog pressure gauge disclosed in an embodiment of the present invention;
[0031] Figure 4 is an example diagram of pointer segmentation information in the channel of an analog pressure gauge disclosed in an embodiment of the present invention;
[0032] Figure 5 is a schematic diagram of converting an analog pressure gauge disclosed in an embodiment of the present invention into a one-dimensional array; DETAILED IMPLEMENTATION MANNER
[0033] To facilitate the understanding of the present invention, the specific embodiments of the present invention will be described in more detail below with reference to the accompanying drawings of the specification.
[0034] Unless otherwise specified or defined, all technical and scientific terms used herein shall have the same meaning as commonly understood by those skilled in the technical field to which this invention pertains. In the context of implementing the technical solution of the present invention in a realistic scenario, all technical and scientific terms used herein may also have meanings corresponding to the implementation of the technical solution of the present invention. The "first, second..." used herein is only for differentiating names and does not represent a specific quantity or order. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0035] Unless otherwise specified or defined, the "said" and "this" used herein refer to the technical features and content mentioned or described before the corresponding position. The technical feature or technical content may be the same as or similar to the technical feature or technical content it mentions.
[0036] Undoubtedly, technical content or technical features that are contrary to the purpose of the present invention or are significantly contradictory should be excluded. The present invention will be described in detail below in conjunction with specific embodiments.
[0037] The main process for the identification of pointer pressure gauges is as Figure 1 shown.
[0038] Step 1: Detection and classification of the dial based on lightweight YOLOv5.
[0039] The specific implementation process of the embodiment is as follows:
[0040] In this step, the detection and classification of the dial target are realized through the YOLOv5 convolutional neural network. First, the LabelMe annotation tool is used to annotate the pressure gauge image. The rectangular frame is used to accurately calibrate the dial area, and multi-level classification labels are assigned. The annotation information is stored in TXT format, including the target position coordinates and classification metadata, to construct a multi-dimensional training dataset. When training, the lightweight structure of YOLOv5s is selected. This version is the YOLOv5 variant with the simplest number of neurons, and the network parameters can be adjusted according to actual needs. The input image is input into the network after normalization processing, and the detection box coordinates and confidence are output. The confidence threshold is set to 0.7 to filter out low-confidence targets. If multiple dials are detected, they are sorted in descending order of confidence, and the types are distinguished by combining the classification labels. The ROI area is generated and the minimum bounding rectangle is recorded to provide initial parameters for subsequent geometric correction. The performance of the model is evaluated by the class mean average precision, precision, and recall rate, and finally, high-precision dial positioning and type recognition are achieved.
[0041] Step 2: Use the Hough transform and perspective geometric correction to correct the tilted dial.
[0042] The specific implementation process of the embodiment is as follows:
[0043] Within the ROI region output in step 1, first, a binary edge map is extracted through Canny edge detection. Based on the principle of the Hough gradient method, for each edge point, along the gradient direction, according to the geometric relationship x c = x i + rcosθ, y c = y i + rsinθ, candidate circle centers are searched, where the radius r is limited to 40% - 60% of the short side length of the ROI. Through a three-dimensional voting accumulator, the support degrees of each (r, x c , y c ) combination are statistically calculated, and the peak parameters are selected as the detection results. This method effectively reduces background interference through gradient direction constraint and radius range limitation.
[0044] For the detected set of elliptical edge points, the least squares method is used to fit the elliptical equation Ax 2 + Bxy + Cy 2 + Dx + Ey + F = 0. By calculating the major axis tilt angle θ = 0.5arctan(B / (A - C)), the tilt direction of the dial is determined. Based on the pole correspondence relationship between the ellipse and the circle, the homography matrix H is solved using the direct linear transformation (DLT), and the tilted dial is corrected to a perfect circle through perspective transformation, ensuring that the angular error Δθ ≤ 0.1°, providing an accurate reference for pointer angle measurement.
[0045] Step 3, pixel-level segmentation based on the improved U2Net.
[0046] The specific implementation process of the embodiment is as follows:
[0047] In this step, the improved U2Net network is used to achieve high-precision segmentation of the dial components. This network embeds a spatial attention module in the encoder-decoder architecture, and strengthens the extraction ability of the pointer and scale contours through a multi-scale feature fusion mechanism. The training data is constructed using the LabelMe annotation tool, and the annotation content includes: the closed area of the dial, the center line of the pointer with a single-pixel width, and the rectangular scale area. All annotation information is converted into a standardized JSON format for network training. After normalization preprocessing, the input image is uniformly scaled to a resolution of 416×416. The network output contains mask data with two channels: the dial mask is binarized by setting a threshold of 0.5 to extract the effective area of the scale line; the pointer mask combines morphological closing operations to optimize topological connectivity, effectively eliminating image breaks and noise interference. Finally, for the optimized pointer mask, a skeleton extraction algorithm is applied to generate a center axis with a single-pixel width, accurately representing the spatial orientation of the pointer main axis, providing sub-pixel-level input data for subsequent angle calculation. The complete recognition effect for the pointer-type pressure gauge is as Figure 2As shown above. So far, the entire process of constructing and training the dataset for the semantic segmentation model has been completed, and the model has the ability to stably identify instrument pointers and scales.
[0048] Step 4: Based on the scale and pointer position information obtained in Step 3, determine the circular interval containing the scale and pointer, and convert the circular scale pointer into a linear scale pointer through polar coordinate transformation and then convert it into a one-dimensional array. Figure 3 、 Figure 4 are the original masked pixel images of the scale and pointer obtained through Step 3 respectively. Figure 5 is the linear image of the one-dimensional array of the converted scale pointer.
[0049] The specific implementation process of the embodiment is described as follows:
[0050] This step is based on the pointer and scale position information obtained in Step 3 to determine the boundary of the circular region containing the scale and pointer. Map the circularly distributed elements into a linear one-dimensional signal through polar coordinate transformation. The specific implementation process is as follows: Use the center coordinate (x c , y c ) of the dial corrected in Step 2 as the pole, set the outer diameter as R (the maximum radius), and at the same time set the inner diameter to 0.5R to exclude the central interference area. Adopt the polar coordinate transformation formula:
[0051] x = x c -rsinθ
[0052] y = y c +rcosθ
[0053] Perform radial stratified sampling, where r ∈ (0.5R, R) and θ ∈ (0, 2π). During sampling, maintain a resolution of 0.1° in the angular direction to achieve uniform coverage in the 360° range. In the radial direction, sample with a step size of 1 pixel. The configuration of sampling every 0.1° in the angular direction can achieve 3600 angular sampling points (360° / 0.1°). Obtain the pixel values of the masked area through the bilinear interpolation algorithm, and convert the original circular region into a linearly expanded image with a width of 3600 pixels (corresponding to the angular resolution) and a height of (R - 0.5R) pixels. Finally, perform integral projection operation on the linear image along the radial direction, and generate a one-dimensional projection array by accumulating the masked pixel intensity values corresponding to each angle. Figure 5 This is the conversion result. In this projection result, the blue discrete peaks correspond to the central angles of the scale lines, and the yellow discrete peaks represent the central angles of the pointers, significantly enhancing the detection robustness through spatial dimension compression.
[0054] Step 5: Use scale mapping to calculate the indicated value reading of the pointer.
[0055] The specific implementation process of the embodiment is described as follows:
[0056] This step calculates the pressure gauge reading based on the one-dimensional projection data generated in step 4. In the array containing the scale pointer information, as Figure 5 shown, first, perform linear interpolation on the projection data to increase the angular resolution to 64,000 sampling points. Use the adaptive threshold detection method to determine the scale interval and record the midpoint angle. For pointer signal detection, identify the continuous high-response region through the sliding window algorithm and extract the midpoint angle as the pointer pointing angle. To address the problem of non-uniform scale distribution, combine the adjacent scale angle intervals and the instrument range parameters, and use the piecewise interpolation formula to achieve dynamic non-linear compensation. The non-linear interpolation calculation uses the following formula:
[0057]
[0058] In the formula, through the phase difference compensation of adjacent scales x i and x i+1 , combined with the instrument range Range and the total number of scales n, this algorithm supports piecewise interpolation compensation for non-uniform scales, achieving an error accuracy of ±0.1% FS, fully meeting the industrial inspection standard accuracy requirements.
[0059] The purpose of the above embodiments is to exemplarily reproduce and deduce the technical solution of the present invention, and to completely describe the technical solution, purpose and effect of the present invention. Its purpose is to enable the public to understand the disclosed content of the present invention more thoroughly and comprehensively, and does not limit the protection scope of the present invention.
[0060] The above embodiments are not an exhaustive list based on the present invention. In addition, there may be multiple other embodiments not listed. Any substitution and improvement made without violating the concept of the present invention fall within the protection scope of the present invention.
Claims
1. An automatic indication recognition method for a pointer-type precision pressure gauge, characterized in that, It includes the following steps: Step 1: Based on the YOLOv5 object detection network model, detect and classify the pressure gauge dial in the image to be recognized, and obtain the region of interest (ROI) of the dial; Step 2: Use the Hough transform to detect the dial contour in the ROI region, and perform geometric correction on the inclined dial through perspective transformation to obtain a circular dial; Step 3: Adopt an improved U2Net neural network model to perform pixel-level segmentation on the corrected dial, and generate a pointer mask and a scale mask; Step 4: Taking the center of the corrected dial as the pole, perform polar coordinate expansion on the pointer mask and the scale mask, and convert the annular distribution into linear one-dimensional data; Step 5: Based on the one-dimensional data, combine the scale mapping algorithm to calculate the coordinates of the pointer scale, and realize the dynamic compensation of non-uniform scales through the piecewise interpolation formula, and finally output the pressure indication value.
2. The method for automatically identifying the indication value of the pointer type precision pressure gauge according to claim 1, wherein In Steps 1 and 3, the model training data is generated by an artificial annotation tool, specifically including: in Step 1, the instrument area is annotated with a rectangular box and a class label is assigned; in Step 3, the scale lines and the pointer contour are annotated with a closed polygon, and a scale and a pointer semantic label are assigned respectively; the annotated data is converted into a training data set after format conversion.
3. The method for automatically identifying the indication value of the pointer type precision pressure gauge according to claim 1, wherein In Step 1, the YOLOv5 model has a lightweight structure, the input image resolution is 640×640, and the detection confidence threshold is set to 0.7; if there are multiple dial targets, they are sorted in descending order of confidence and processed separately after classification.
4. The method for automatically identifying the indication value of the pointer type precision pressure gauge according to claim 1, characterized in that, In Step 2, the Hough transform detects the dial contour through gradient direction constraint and radius range limitation, uses the least squares method to fit the ellipse equation to calculate the tilt angle θ, and performs perspective correction through the homography matrix H, with the angle error Δθ≤±0.1°.
5. The method for automatically identifying the indication value of the pointer-type precision pressure gauge according to claim 1, wherein In Step 3, the improved U2Net model introduces a spatial attention mechanism, and generates a single-pixel-level pointer center line through a skeleton extraction algorithm for sub-pixel-level positioning.
6. The method for automatically identifying the indication value of the pointer type precision pressure gauge according to claim 1, characterized in that, In Step 4, during polar coordinate expansion, taking the center of the dial as the pole, the radial range of the annular region is from an inner diameter of 0.5R to an outer diameter of R, the angular resolution is 0.1°, and a linearly expanded image is generated through bilinear interpolation.
7. The method for automatically identifying the indication value of the pointer type precision pressure gauge according to claim 1, characterized in that, In Step 5, the scale mapping algorithm uses the following formula to calculate the indication value: Among them, x p is the abscissa of the pointer, x i and x i+1 are the abscissas of adjacent scales, Range is the measuring range, and n is the total number of scales.
8. The method for automatically identifying the indication value of the pointer-type precision pressure gauge according to claim 1, characterized in that, It includes: An image acquisition module for obtaining a pressure gauge image through an industrial camera; An object detection module for locating the dial area based on the YOLOv5 model; A geometric correction module for performing the Hough transform and perspective transformation to correct the inclined dial; A segmentation module for generating a pointer and scale mask based on the improved U2Net model; A polar coordinate conversion module for converting the annular distribution data into a linear one-dimensional signal; A reading calculation module for outputting the final indication value through the scale mapping algorithm.
9. The method for automatically identifying the indication value of the pointer type precision pressure gauge according to claim 1, characterized in that, The geometric correction module realizes dial correction through the homography matrix H, and the segmentation module outputs a sub-pixel-level mask including the pointer center line.
10. The method for automatically identifying the indication value of the pointer type precision pressure gauge according to claim 1, characterized in that, The reading calculation module supports piecewise interpolation compensation for non-uniform scales, and the error accuracy reaches ±0.1%FS.