Pointer type instrument reading method and system based on YOLO model
Through the YOLO model and nearest neighbor clustering algorithm, combined with ellipse fitting and houghLines algorithm, the accurate identification of instrument readings without pre-adding dial information is achieved, and the difficulty of identifying inaccurately and data set production in the existing technology is solved. The problem of the problem improves the recognition accuracy and applicability.
Patent Information
- Application Number
- CN202411051193.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-11-22
AI Technical Summary
The existing image meter reading algorithm lacks universality. OCR algorithms have many errors in identifying dial numbers, and complex deep learning algorithms require a large number of data sets for training, which leads to a large amount of workload for training sets and is difficult to implement and apply.
The pointer-type instrument reading method based on the YOLO model is used to detect the scale numbers through nearest neighbor clustering, and the real pointer line is filtered out using ellipse fitting and houghLines algorithm to calculate the readings. The entire recognition process does not require pre-adding dial information, which is highly scalable and applicable In various shooting angles and lighting conditions.
It realizes accurate identification of instrument readings without adding dial information, improves recognition accuracy, and reduces the impact of shooting angle on readings. It is suitable for a variety of dial scenes, simplifies the training process, and reduces the need for data set production.
Smart Images

Figure CN119006865A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent inspection of substations, and in particular to a pointer meter reading method and system based on a YOLO model. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] With the promotion of the construction of unmanned substations in the country, there is an increasing need for intelligent inspection systems to replace traditional manual inspections. An important task in inspections is meter reading, recording the readings of each meter in the station equipment, and reporting any abnormal readings. The intelligent inspection system relies on robots, cameras and other visual front-end devices for image acquisition, and can automatically read the meter images collected to achieve automatic meter reading.
[0004] At present, there are many studies on meter reading algorithms based on images, but the inventors found the following problems:
[0005] (1) Most of them are trained and tested on one or several similar watch faces and are not universal.
[0006] (2) The existing OCR algorithm is not specific enough for digital detection when recognizing dial numbers, which may lead to misrecognition.
[0007] (3) Some papers use complex deep learning algorithms, which require a large number of dial data sets to produce training sets for semantic segmentation. The workload of producing training sets is very large, and it is difficult to apply them in practice. Summary of the invention
[0008] In order to solve the above problems, the present invention proposes a pointer meter reading method and system based on the YOLO model, which can accurately detect the scale numbers and the scales they represent through nearest neighbor clustering. The entire recognition process does not require any dial information to be added in advance. It has strong scalability and can achieve high recognition accuracy when dealing with the influence of shooting angle, lighting, etc.
[0009] In order to achieve the above object, the present invention adopts the following technical solution:
[0010] In a first aspect, the present invention provides a pointer instrument reading method based on a YOLO model, comprising:
[0011] Acquire the instrument image to be detected and perform preprocessing;
[0012] Input the preprocessed instrument image to be detected into the trained object detection YOLO model to obtain the dial numbers;
[0013] The dial numbers are grouped into digital strings using a nearest neighbor clustering algorithm, and the real scales are screened out based on the digital strings using the maximum number of adjacent difference counts;
[0014] Perform ellipse fitting according to the real scale position to obtain the rotation center position of the dial pointer;
[0015] A plurality of straight lines in the preprocessed instrument image to be detected are obtained by using the houghLines algorithm; the plurality of straight lines are filtered according to the length of the straight line and the center position of the fitted ellipse to obtain a real pointer straight line;
[0016] The current actual reading is calculated based on the angular relationship between the pointer straight line and the actual scale position.
[0017] Preferably, the preprocessing includes performing Gaussian denoising, brightness equalization, brightness adjustment, and contrast adjustment on the image.
[0018] Preferably, the training process of the target detection YOLO model is:
[0019] Obtaining instrument image samples, wherein the instrument image samples are randomly generated by rotating, tilting, changing brightness, changing size, and tilting perspective of commonly used digital fonts and simulating dial arrangement;
[0020] Labeling the digital area of each of the instrument image samples to construct a YOLO training data set;
[0021] Use the YOLO training data set to train based on the YOLO pre-trained model to obtain a trained target detection YOLO model.
[0022] Preferably, the method of using the nearest neighbor clustering algorithm to group the dial numbers into a digital string, and filtering out the real scales based on the digital string by using the maximum adjacent difference counts, specifically includes:
[0023] Get all dial numbers;
[0024] Taking the leftmost digit as the reference point, calculating the distance between the reference point and all other digits that have not been calculated; filtering out the digits that are immediately to the right of the reference point in the horizontal and vertical directions based on the horizontal threshold and the vertical threshold; the horizontal threshold is set to the width of the current digit, and the vertical threshold is set to a preset ratio of the height of the current digit;
[0025] Then, using the number immediately adjacent to the right as a reference point, search for the next number immediately adjacent to the right, until no number immediately adjacent to the right can be found;
[0026] Place the reference point and all adjacent numbers into a rectangular frame to form a number string; continue to search for and form other number strings;
[0027] Sort the number strings from small to large based on the angle between the center of the dial and the center of each rectangular frame, calculate the difference between the number strings in adjacent rectangular frames and make statistics;
[0028] The difference that appears the most times is taken as the greatest common divisor of the true scale;
[0029] Filter out the true scale from all number strings according to the greatest common divisor.
[0030] Preferably, performing ellipse fitting according to the real scale position to obtain the rotation center position of the dial pointer specifically includes:
[0031] Get the center point of the real scale rectangle frame to form a dot matrix;
[0032] The dot matrix is input into the opencv fitEllipse function for ellipse fitting to obtain a RotatedRect, including the ellipse center, the major axis, the minor axis, and the angle information of the ellipse; the ellipse center of the RotatedRect is the rotation center position of the dial pointer.
[0033] Preferably, filtering the plurality of straight lines according to the length of the straight line and the center position of the fitted ellipse to obtain the real pointer straight line specifically includes:
[0034] Obtaining the plurality of straight lines, and screening out a preselected straight line passing through the center of the fitted ellipse;
[0035] If the length of the pre-selected straight line meets the set threshold range, it is determined to be a real pointer straight line.
[0036] Preferably, the calculating the current real reading according to the angle relationship between the pointer straight line and the real scale position specifically includes:
[0037] Get the two nearest scale rectangles on the left and right of the pointer line;
[0038] Calculate the angle of the line from the center of each scale rectangle to the rotation center of the pointer, as well as the angle of the pointer line; calculate the current real reading based on the angle relationship. The specific process is as follows:
[0039] AngleDis1=|Angle1-Angle2|;
[0040] ValueDis1 = Value1 - Value2;
[0041] ValueAngleEach=ValueDis1 / AngleDis1;
[0042] AngleDis2=|Angle3-Angle2|;
[0043] Value=AngleDis2×ValueAngleEach+Value2;
[0044] Wherein, Angle1 is the angle between scale value 1 and the center of rotation of the pointer, Angle2 is the angle between scale value 2 and the center of rotation of the pointer, Value1 is the value of scale value 1, Value2 is the value of scale value 2, Angle3 is the angle of the pointer straight line, and Value is the calculated current actual reading.
[0045] In a second aspect, the present invention provides a pointer instrument reading system based on a YOLO model, comprising:
[0046] An image acquisition module is used to acquire the image of the instrument to be detected and perform preprocessing;
[0047] The digital acquisition module is used to input the pre-processed instrument image to be detected into the trained target detection YOLO model to obtain the dial numbers;
[0048] A scale positioning module, used to use a nearest neighbor clustering algorithm to group the dial numbers into a digital string, and to filter out the real scale based on the digital string by using the maximum adjacent difference count;
[0049] The circle center positioning module is used to perform ellipse fitting according to the actual scale position to obtain the rotation center position of the dial pointer;
[0050] The pointer determination module is used to obtain multiple straight lines in the preprocessed instrument image to be detected by using the houghLines algorithm; filter the multiple straight lines according to the length of the straight line and the center position of the fitted ellipse to obtain the real pointer straight line;
[0051] The reading calculation module is used to calculate the current real reading according to the angular relationship between the pointer straight line and the real scale position.
[0052] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in a pointer meter reading method based on a YOLO model described in the first aspect.
[0053] In a fourth aspect, the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps in the pointer meter reading method based on the YOLO model described in the first aspect are implemented.
[0054] Compared with the prior art, the present invention has the following beneficial effects:
[0055] The present invention can accurately locate all areas containing scales through the nearest neighbor clustering algorithm without adding any dial information in advance and when the shooting angle is extremely tilted, and further screen and extract useful scale information for subsequent calculations, and then fit the center of the instrument scale circle, screen the pointer straight line on the dial, and estimate the reading according to the angle relationship between the pointer and the scale. No additional algorithms such as image correction are required to accurately obtain the rotation axis of the pointer, further reducing the influence of the shooting angle on the reading, and greatly improving the accuracy of indication recognition. At the same time, because the YOLO model is trained based on a data set containing multiple digital forms, it is more universal and suitable for a variety of dial reading scenarios.
[0056] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their description are used to explain the present invention but do not constitute a limitation of the present invention.
[0058] Figure 1 A main flow chart of a pointer meter reading method based on a YOLO model provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0059] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0060] Embodiment 1
[0061] like Figure 1 As shown, this embodiment discloses a pointer meter reading method based on the YOLO model, comprising the following steps:
[0062] S1: Acquire the instrument image to be detected and perform preprocessing;
[0063] S2: Input the preprocessed instrument image to be detected into the trained object detection YOLO model to obtain the dial numbers;
[0064] S3: using a nearest neighbor clustering algorithm to group the dial numbers into a digital string, and filtering out the real scales based on the digital string by using the maximum adjacent difference count;
[0065] S4: Perform ellipse fitting according to the real scale position to obtain the rotation center position of the dial pointer;
[0066] S5: using the houghLines algorithm to obtain a plurality of straight lines in the preprocessed instrument image to be detected; filtering the plurality of straight lines according to the length of the straight lines and the center position of the fitted ellipse to obtain a real pointer straight line;
[0067] S6: Calculate the current real reading based on the angular relationship between the pointer straight line and the real scale position.
[0068] In S1, an image of an instrument to be detected is obtained and preprocessed, wherein the preprocessing includes performing Gaussian denoising, brightness equalization, brightness adjustment, and contrast adjustment on the image.
[0069] Given that the current OCR (optical character recognition) algorithm exhibits a problem of insufficient specificity in digital detection when recognizing dial numbers, this leads to the phenomenon of misrecognition in the recognition process. Specifically, when parsing the numbers on the dial, the algorithm may not be able to fully distinguish between numbers of similar shapes or arrangements, thereby mistakenly recognizing one number as another, affecting the accuracy and reliability of recognition. In order to solve the above-mentioned existing problems, this embodiment specifically trains a recognition model for numbers, uses scripts to enhance the data set, and batch generates a large number of digital data sets containing brightness changes, angle tilts, noise interference, etc. for training, which can achieve a higher digital recognition effect.
[0070] In S2, the pre-processed instrument image to be detected is input into the trained object detection YOLO model to obtain the dial numbers. The training process of the object detection YOLO model is:
[0071] S201: Obtaining instrument image samples, wherein the instrument image samples are randomly generated by rotating, tilting, changing brightness, changing size, and tilting perspective of common digital fonts and simulating dial arrangement;
[0072] S202: Labeling the digital area of each of the instrument image samples to construct a YOLO training data set;
[0073] S203: Using the YOLO training data set, training is performed based on the YOLO pre-trained model to obtain a trained target detection YOLO model.
[0074] In S201, the dial recognition and 0-9 number recognition data sets are expanded using scripting languages. The 0-9 number data set can use software to automatically switch common fonts and can be generated by imitating the layout of the dial. The numbers are required to have certain rotation, tilt, brightness change, size change, perspective tilt and other features that imitate the real ones, and the probability of feature existence should not be less than 20%. The value and rectangle information of each number can be automatically recorded as a label at the same time, and the format is based on the format required for YOLO model training.
[0075] The digital data set produced in this embodiment includes 8000 training sets and 2000 verification sets, and the training graphics card is an RTX4070 graphics card.
[0076] The reasoning framework environment of this embodiment is java+opencv+onnxruntime, and it is required to convert the pt format obtained by YOLO model training into the onnxruntime format.
[0077] After obtaining the dial position using the dial target recognition model, the dial should be cropped out from the original image, and the dial should be appropriately enlarged before the dial digital recognition process is performed.
[0078] It should be understood that the YOLO (You Only Look Once) series of models are popular in the field of computer vision due to their efficient target detection capabilities. With the iteration of versions, the YOLO model continues to introduce new technologies and improvements. As the latest version of the series, YOLOv8 further improves detection accuracy and robustness while maintaining high efficiency and speed. Therefore, this embodiment preferably uses the YOLOv8 model.
[0079] In S3, after the dial digits are recognized, the recognition results of all the digits on the dial are obtained. This embodiment uses the nearest neighbor algorithm for clustering, and the readings are calculated after the digit strings are obtained, and the rectangular box is not recalculated for each digit string.
[0080] Calculate the absolute value of the difference between each digital string, count the difference, get the difference with the most times, and filter out the real scale value from all digital strings based on the difference. Specifically include:
[0081] S301: Get all dial numbers;
[0082] S302: Taking the leftmost digit as a reference point, calculating the distance between the reference point and all other digits that have not been calculated; filtering out the digits that are immediately to the right of the reference point in the horizontal and vertical directions based on a horizontal threshold and a vertical threshold; the horizontal threshold is set to the width of the current digit, and the vertical threshold is set to a preset ratio of the height of the current digit;
[0083] S303: Using the number immediately adjacent to the right as a reference point, searching for the next number immediately adjacent to the right, until no number immediately adjacent to the right can be found;
[0084] S304: placing the reference point and all adjacent numbers into a rectangular frame to form a number string; continuing to search for and form other number strings;
[0085] S305: sorting the number strings from small to large based on the angles of the lines connecting the center of the dial and the centers of the rectangular frames, calculating and counting the differences between the number strings in adjacent rectangular frames;
[0086] S306: taking the difference value that appears the most times as the greatest common divisor of the real scale;
[0087] S307: Filter out the real scale from all the number strings according to the greatest common divisor.
[0088] In the instrument panel, the scale values are usually arranged uniformly in an order from small to large along a nearly parallel direction. In order to accurately identify the scale value, this embodiment uses the leftmost number as the reference point, and uses the nearest neighbor algorithm to expand to the right to obtain a digital string, and uses the numbers that appear within the range of the horizontal threshold and the vertical threshold as the adjacent numbers of the reference point, which can effectively reduce the situation of misidentifying non-scale numbers or noise as valid scales, and improve the accuracy of recognition.
[0089] While this embodiment uses the horizontal threshold to filter the numbers that are immediately adjacent to the right, it also considers using the vertical threshold to improve the accuracy of the nearest neighbor number screening. Considering that the numbers on the dial may have errors in the nearest neighbor identification due to factors such as image quality, light changes, and dial wear, this embodiment can exclude those numbers that are too far apart in the vertical direction as the immediate neighbor numbers of the current number by limiting the maximum distance between numbers in the vertical direction, thereby reducing the erroneous identification of distant numbers as part of the same scale number string.
[0090] As an optional implementation, the rightmost digit may be used as a reference point to cluster the digit string from right to left.
[0091] In this embodiment, the vertical threshold is preferably set to 30% of the current digit height.
[0092] In S4, the real scale position is the rectangular frame where the real scale is located. According to the center point of the rectangular frame of all scale values, the opencv fitEllipse algorithm is used to perform ellipse fitting to obtain the center of the ellipse, which is the axis of the pointer rotation. Using ellipse fitting can effectively deal with the influence of problems such as dial tilt and shooting angle.
[0093] Specific:
[0094] S401: Obtain the center point of the scale rectangle frame to form a dot matrix;
[0095] S402: Input the dot matrix into the opencv fitEllipse function to perform ellipse fitting to obtain a RotatedRect, including the ellipse center, the major axis, the minor axis, and the angle information of the ellipse. The ellipse center of the RotatedRect is the rotation center position of the dial pointer.
[0096] Since a large number of existing technologies use complex deep learning algorithms, a large number of dial data sets are required for the preparation of semantic segmentation training sets, resulting in a very large workload for the preparation of training sets and difficulty in implementation. In order to overcome this problem, this embodiment only requires one digital recognition training process, uses ellipse fitting to find the rotation center of the pointer, and can still automatically read the dial when it is tilted or deformed, which has a certain degree of versatility.
[0097] In S5, the opencv houghLines algorithm is used to search for straight lines on the dial, and the straight lines are screened according to the length of the straight line and the center of the fitted ellipse, and the length of the straight line segment is combined to obtain the real pointer. Specifically, it includes:
[0098] S501: Acquire the plurality of straight lines, and select a pre-selected straight line passing through the center of the fitted ellipse;
[0099] S502: If the length of the pre-selected straight line meets the set threshold range, it is determined to be a real pointer straight line.
[0100] The threshold value is set by technicians in this field according to actual conditions.
[0101] In S6, the straight line angle between the center of each scale value rectangle and the center of the ellipse is calculated, the angle of the pointer straight line is calculated, and the two nearest scale values on the right and left sides of the pointer straight line are obtained according to the angle. According to the relationship between the two scale values and the angle and the angle of the pointer straight line, the dial reading at this time is estimated.
[0102] In this embodiment, it is preferred to arrange the digital strings from small to large and from left to right. The specific calculation process is as follows:
[0103] AngleDis1=|Angle1-Angle2|;
[0104] ValueDis1 = Value1 - Value2;
[0105] ValueAngleEach=ValueDis1 / AngleDis1;
[0106] AngleDis2=|Angle3-Angle2|;
[0107] Value=AngleDis2×ValueAngleEach+Value2;
[0108] Among them, Angle1 is the angle between scale value 1 and the center of the ellipse, Angle2 is the angle between scale value 2 and the center of the ellipse, Value1 is the value of scale value 1, Value2 is the value of scale value 2, Angle3 is the angle of the pointer straight line, and Value is the estimated reading value.
[0109] In the scenario where the digital string of this embodiment is arranged from small to large and from left to right, Value1 is greater than Value2, that is, scale value 1 is the nearest scale value to the right of the pointer line, and scale value 2 is the nearest scale value to the left of the pointer line.
[0110] This embodiment can accurately determine the position of each scale on the dial by calculating the straight line angle between the center of the scale value rectangle and the rotation center of the pointer. Further calculating the angle of the pointer straight line and comparing it with the scale angle can more accurately find the scale pointed by the pointer or the position between two scales. This angle-based calculation method is more accurate than direct image recognition or pixel position judgment, especially when the scales are dense or the dial design is complex. Since the angle calculation is not affected by the size, shape or slight rotation of the dial, as long as the position of the scale, ellipse center and pointer can be accurately identified, accurate calculation can be performed. For situations where the image quality is poor (such as blur, uneven lighting) or there is slight deformation of the dial, the angle calculation can also provide relatively stable reading results.
[0111] This specific embodiment, without adding any dial information in advance and with an extreme tilt of the shooting angle, first accurately locates all areas containing scales through the nearest neighbor clustering algorithm and further screens and extracts useful scale information for subsequent calculations, and then uses the point closest to the center of the fitted instrument scale on the pointer line as the basis for subsequent calculation of the reading. No additional algorithms such as image correction are required to accurately obtain the axis of rotation of the pointer, further reducing the impact of the shooting angle on the reading, and greatly improving the accuracy of the oil level gauge indication recognition. At the same time, because the YOLO model is trained based on a data set containing multiple digital forms, it is more universal and suitable for a variety of dial reading scenarios.
[0112] Embodiment 2
[0113] This embodiment provides a pointer meter reading system based on a YOLO model, including:
[0114] An image acquisition module is used to acquire the image of the instrument to be detected and perform preprocessing;
[0115] The digital acquisition module is used to input the pre-processed instrument image to be detected into the trained target detection YOLO model to obtain the dial numbers;
[0116] A scale positioning module, used to use a nearest neighbor clustering algorithm to group the dial numbers into a digital string, and to filter out the real scale based on the digital string by using the maximum adjacent difference count;
[0117] The circle center positioning module is used to perform ellipse fitting according to the actual scale position to obtain the rotation center position of the dial pointer;
[0118] The pointer determination module is used to obtain multiple straight lines in the preprocessed instrument image to be detected by using the houghLines algorithm; filter the multiple straight lines according to the length of the straight line and the center position of the fitted ellipse to obtain the real pointer straight line;
[0119] The reading calculation module is used to calculate the current real reading according to the angular relationship between the pointer straight line and the real scale position.
[0120] Embodiment 3
[0121] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the pointer meter reading method based on the YOLO model as described in the first embodiment are implemented.
[0122] Embodiment 4
[0123] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps in the pointer meter reading method based on the YOLO model as described in the first embodiment are implemented.
[0124] The steps or modules involved in the above embodiments 2 to 4 correspond to those in embodiment 1. For the specific implementation, please refer to the relevant description of embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.
[0125] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A pointer instrument reading method based on the YOLO model, characterized in that: include: Acquire the instrument image to be detected and perform preprocessing; Input the preprocessed instrument image to be detected into the trained object detection YOLO model to obtain the dial numbers; The dial numbers are grouped into digital strings using a nearest neighbor clustering algorithm, and the real scales are screened out based on the digital strings using the maximum number of adjacent difference counts; Perform ellipse fitting according to the real scale position to obtain the rotation center position of the dial pointer; A plurality of straight lines in the preprocessed instrument image to be detected are obtained by using the houghLines algorithm; the plurality of straight lines are filtered according to the length of the straight line and the center position of the fitted ellipse to obtain a real pointer straight line; The current actual reading is calculated based on the angular relationship between the pointer straight line and the actual scale position.
2. A pointer meter reading method based on a YOLO model as claimed in claim 1, characterized in that: The preprocessing includes performing Gaussian denoising, brightness equalization, brightness adjustment, and contrast adjustment on the image.
3. A pointer meter reading method based on a YOLO model as claimed in claim 1, characterized in that: The training process of the target detection YOLO model is: Obtaining instrument image samples, wherein the instrument image samples are randomly generated by rotating, tilting, changing brightness, changing size, and tilting perspective of commonly used digital fonts and simulating dial arrangement; Labeling the digital area of each of the instrument image samples to construct a YOLO training data set; Use the YOLO training data set to train based on the YOLO pre-trained model to obtain a trained target detection YOLO model.
4. A pointer meter reading method based on a YOLO model as claimed in claim 1, characterized in that: The method of using the nearest neighbor clustering algorithm to group the dial numbers into a digital string and filtering out the real scale based on the digital string by using the maximum adjacent difference count specifically includes: Get all dial numbers; Taking the leftmost digit as the reference point, calculating the distance between the reference point and all other digits that have not been calculated; filtering out the digits that are immediately to the right of the reference point in the horizontal and vertical directions based on the horizontal threshold and the vertical threshold; the horizontal threshold is set to the width of the current digit, and the vertical threshold is set to a preset ratio of the height of the current digit; Then, using the number immediately adjacent to the right as a reference point, search for the next number immediately adjacent to the right, until no number immediately adjacent to the right can be found; Place the reference point and all adjacent numbers into a rectangular frame to form a number string; continue to search for and form other number strings; Sort the number strings from small to large based on the angle between the center of the dial and the center of each rectangular frame, calculate the difference between the number strings in adjacent rectangular frames and make statistics; The difference that appears the most times is taken as the greatest common divisor of the true scale; Filter out the true scale from all number strings according to the greatest common divisor.
5. A pointer meter reading method based on a YOLO model as claimed in claim 4, characterized in that: The ellipse fitting is performed according to the real scale position to obtain the rotation center position of the dial pointer, specifically including: Get the center point of the real scale rectangle frame to form a dot matrix; The dot matrix is input into the opencv fitEllipse function for ellipse fitting to obtain a RotatedRect, including the ellipse center, the major axis, the minor axis, and the angle information of the ellipse; the ellipse center of the RotatedRect is the rotation center position of the dial pointer.
6. A pointer meter reading method based on a YOLO model as claimed in claim 1, characterized in that: The filtering of the plurality of straight lines according to the length of the straight line and the center position of the fitted ellipse to obtain the real pointer straight line specifically includes: Obtaining the plurality of straight lines, and screening out a preselected straight line passing through the center of the fitted ellipse; If the length of the pre-selected straight line meets the set threshold range, it is determined to be a real pointer straight line.
7. A pointer meter reading method based on a YOLO model as claimed in claim 4, characterized in that: The calculating of the current real reading according to the angle relationship between the pointer straight line and the real scale position specifically includes: Get the two nearest scale rectangles on the left and right of the pointer line; Calculate the angle of the line from the center of each scale rectangle to the rotation center of the pointer, as well as the angle of the pointer line; calculate the current real reading based on the angle relationship. The specific process is as follows: AngleDis1=|Angle1-Angle2|; ValueDis1 = Value1 - Value2; ValueAngleEach=ValueDis1 / AngleDis1; AngleDis2=|Angle3-Angle2|; Value=AngleDis2×ValueAngleEach+Value2; Wherein, Angle1 is the angle between scale value 1 and the center of rotation of the pointer, Angle2 is the angle between scale value 2 and the center of rotation of the pointer, Value1 is the value of scale value 1, Value2 is the value of scale value 2, Angle3 is the angle of the pointer straight line, and Value is the calculated current actual reading.
8. A pointer instrument reading system based on the YOLO model, characterized in that: include: An image acquisition module is used to acquire the image of the instrument to be detected and perform preprocessing; The digital acquisition module is used to input the pre-processed instrument image to be detected into the trained target detection YOLO model to obtain the dial numbers; A scale positioning module, used to use a nearest neighbor clustering algorithm to group the dial numbers into a digital string, and to filter out the real scale based on the digital string by using the maximum adjacent difference count; The circle center positioning module is used to perform ellipse fitting according to the actual scale position to obtain the rotation center position of the dial pointer; The pointer determination module is used to obtain multiple straight lines in the preprocessed instrument image to be detected by using the houghLines algorithm; filter the multiple straight lines according to the length of the straight line and the center position of the fitted ellipse to obtain the real pointer straight line; The reading calculation module is used to calculate the current real reading according to the angular relationship between the pointer straight line and the real scale position.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in a pointer meter reading method based on a YOLO model as described in any one of claims 1 to 7 are implemented.
10. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the pointer meter reading method based on the YOLO model as described in any one of claims 1-7 are implemented.
