A method, apparatus and electronic device for identifying a watch hand

By using target detection models and image processing algorithms, the problem of automatic identification of multi-dial instruments was solved, achieving efficient and automated identification of multi-dial instruments and improving the versatility and reusability of pointer recognition.

CN118172779BActive Publication Date: 2026-03-03WEINUO TIME BEIJING TECH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-12
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing pointer recognition methods cannot recognize multi-dial instruments, resulting in poor versatility and reusability.

Method used

The target detection model is used to obtain the position coordinates of each dial in the dial image, the target image is cropped, and the rotation angle of the hands is calculated by template matching, k-means clustering and binarization. Finally, the reading of the hands in the dial is calculated.

Benefits of technology

It enables automatic identification of multi-dial instruments, improves the versatility and reusability of the pointer identification method, covers more common scenarios, and reduces the tediousness and time cost of manual operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118172779B_ABST
    Figure CN118172779B_ABST
Patent Text Reader

Abstract

The application discloses a method for identifying a pointer. The method comprises the following steps: acquiring a dial image of a pointer instrument to be identified; inputting the dial image into a preset target detection model; acquiring a target image output by the target detection model; calculating a rotation angle of a pointer in each target image; and calculating a reading of the pointer in a dial corresponding to each target image according to the rotation angle of the pointer in each target image. The method provided by the application can realize automatic identification of multiple dial instruments, and is applicable to any instrument with a non-fixed sub-dial position, thereby solving the defect that the prior art can only identify a single dial, improving the universality and reusability of the pointer identification method, and covering more general scenarios. The application also discloses a device, an electronic device and a storage medium for implementing the method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, and electronic device for clock pointer recognition. Background Technology

[0002] Pointer-type meters have advantages such as simple structure, convenient maintenance, high reliability, low price, and waterproof, freeze-proof, and dustproof properties, making them widely used in various industries, such as water and power. The inventors discovered that most current methods for identifying the pointers of pointer-type meters are based on a single dial. For multi-dial meters, such as… Figure 1 and Figure 2 The multi-dial water meter shown cannot be identified by existing meter needle identification methods and can only rely on manual verification. This means that existing meter needle identification methods have problems with poor versatility and reusability. Summary of the Invention

[0003] This invention provides a method, apparatus, and electronic device for identifying watch hands, which solves the problems of poor universality and reusability in existing watch hand identification methods.

[0004] The specific technical solution is as follows:

[0005] In a first aspect, embodiments of the present invention provide a method for identifying dial indicator needles, comprising the following steps:

[0006] Acquire the dial image of the pointer-type instrument to be identified;

[0007] The dial image is input into a preset target detection model;

[0008] Obtain the target image output by the target detection model;

[0009] For each target image, the rotation angle of the hands in each target image is calculated;

[0010] Based on the rotation angle of the hands in each target image, the reading of the hands on the dial corresponding to each target image is calculated.

[0011] Optionally, the target detection model is used for:

[0012] Obtain the position coordinates of each dial in the dial image;

[0013] Based on the position coordinates of each dial, obtain the image corresponding to each dial in the dial image, use it as the target image, and output the target image.

[0014] Optionally, the step of obtaining the position coordinates of each dial in the dial image includes:

[0015] The dial image of the pointer-type instrument to be identified is detected to determine the position coordinates of each dial in the dial image;

[0016] Obtain the position coordinates of each dial in the dial image, and store the position coordinates of each dial in the dial image into a preset configuration file.

[0017] Optionally, the step of obtaining the image corresponding to each watch face in the watch face image based on the position coordinates of each watch face, using it as the target image, and outputting the target image includes:

[0018] The position coordinates of each dial in the dial image are obtained from the configuration file;

[0019] Based on the position coordinates of each dial in the dial image, the dial image of the pointer instrument to be identified is cropped to obtain the image corresponding to each dial, which is then used as the target image and output.

[0020] Optionally, before the step of inputting the dial image into a preset target detection model, the method further includes:

[0021] Obtain the initial object detection model;

[0022] The training samples with object detection box labels are input into the initial object detection model to obtain the target images corresponding to each training sample output by the initial object detection model.

[0023] Based on the output of the initial target detection model and the labels of the training samples, the loss value is calculated using a preset loss function;

[0024] Based on the loss value, the parameters in the initial target detection model are adjusted to obtain the target detection model.

[0025] Optionally, the step of calculating the rotation angle of the hands in each target image includes:

[0026] For each target image, a template dial image corresponding to the target image is selected from the preset template dial image;

[0027] The target image is matched with the template dial image corresponding to the target image; wherein, a template dial image contains only one dial, and the template dial image is a dial image of a single dial;

[0028] Based on the matching degree, a region in the target image that matches the template dial image is selected as the region to be filtered.

[0029] The target region is selected from the region to be filtered using a preset algorithm;

[0030] The fitting angle is the angle by which the pointer rotates clockwise from the 0-degree position around the rotation center of the template dial image to the current position of the pointer in the target area.

[0031] Optionally, the step of filtering the target region from the region to be filtered using a preset algorithm includes:

[0032] Using the center point of the region to be screened as the center and a preset length as the radius, a clustering region is extracted from the region to be screened and used as the sample point for the k-means clustering algorithm for clustering.

[0033] The regions to be screened are binarized based on the clustering results;

[0034] The inscribed circle of the region to be screened after binarization is determined as the target region.

[0035] Secondly, embodiments of the present invention provide a device for identifying watch hands, the device comprising:

[0036] The first acquisition module is used to acquire the dial image of the pointer-type instrument to be identified;

[0037] The input module is used to input the dial image into a preset target detection model;

[0038] The second acquisition module is used to acquire the target image output by the target detection model;

[0039] An angle calculation module is used to calculate the rotation angle of the hands in each target image for each target image;

[0040] The reading calculation module is used to calculate the reading of the dial corresponding to each target image based on the rotation angle of the dial in each target image.

[0041] Optionally, the target detection model is used for:

[0042] Obtain the position coordinates of each dial in the dial image;

[0043] Based on the position coordinates of each dial, obtain the image corresponding to each dial in the dial image, use it as the target image, and output the target image.

[0044] Optionally, the target detection model is specifically used for:

[0045] The dial image of the pointer-type instrument to be identified is detected to determine the position coordinates of each dial in the dial image;

[0046] Obtain the position coordinates of each dial in the dial image, and store the position coordinates of each dial in the dial image into a preset configuration file.

[0047] Optionally, the target detection model is specifically used for:

[0048] The position coordinates of each dial in the dial image are obtained from the configuration file;

[0049] Based on the position coordinates of each dial in the dial image, the dial image of the pointer instrument to be identified is cropped to obtain the image corresponding to each dial, which is then used as the target image and output.

[0050] Optionally, the apparatus further includes: a training module, the training module being used for:

[0051] Obtain the initial object detection model;

[0052] The training samples with object detection box labels are input into the initial object detection model to obtain the target images corresponding to each training sample output by the initial object detection model.

[0053] Based on the output of the initial target detection model and the labels of the training samples, the loss value is calculated using a preset loss function;

[0054] Based on the loss value, the parameters in the initial target detection model are adjusted to obtain the target detection model.

[0055] Optionally, the angle calculation module is specifically used for:

[0056] For each target image, a template dial image corresponding to the target image is selected from the preset template dial image;

[0057] The target image is matched with the template dial image corresponding to the target image; wherein, a template dial image contains only one dial, and the template dial image is a dial image of a single dial;

[0058] Based on the matching degree, a region in the target image that matches the template dial image is selected as the region to be filtered.

[0059] The target region is selected from the region to be filtered using a preset algorithm;

[0060] The fitting angle is the angle by which the pointer rotates clockwise from the 0-degree position around the rotation center of the template dial image to the current position of the pointer in the target area.

[0061] Optionally, the angle calculation module is specifically used for:

[0062] Using the center point of the region to be screened as the center and a preset length as the radius, a clustering region is extracted from the region to be screened and used as the sample point for the k-means clustering algorithm for clustering.

[0063] The regions to be screened are binarized based on the clustering results;

[0064] The inscribed circle of the region to be screened after binarization is determined as the target region.

[0065] Thirdly, embodiments of the present invention also provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0066] The memory is used to store computer programs;

[0067] When the processor executes the program stored in the memory, it implements the method steps for pointer recognition described in the first aspect above.

[0068] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method steps for pointer identification described in the first aspect.

[0069] The hand recognition method provided in this invention can acquire an image of the dial of a pointer-type instrument to be recognized; input the dial image into a preset target detection model; acquire the target image output by the target detection model; calculate the rotation angle of the hand in each target image; and calculate the reading of the hand on the dial corresponding to each target image based on the rotation angle of the hand in each target image. Therefore, the method provided in this invention can automatically recognize multi-dial instruments and is applicable to any instrument with non-fixed sub-dial positions. This solves the deficiency of existing technologies that can only recognize a single dial, improves the versatility and reusability of hand recognition methods, and can cover more general scenarios.

[0070] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings.

[0071] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0072] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0073] Figure 1 This is a schematic diagram of a multi-dial water meter;

[0074] Figure 2 This is another schematic diagram of a multi-dial water meter;

[0075] Figure 3 This is a schematic flowchart of a method for identifying dial pointers provided in an embodiment of the present invention;

[0076] Figure 4 This is another schematic flowchart of the dial indicator recognition method provided in an embodiment of the present invention;

[0077] Figure 5 A schematic diagram of a device for identifying dial pointers provided in an embodiment of the present invention;

[0078] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0079] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0080] Figure 3 This is a schematic flowchart of a method for identifying dial pointers provided in an embodiment of the present invention; as shown below. Figure 3 As shown, the method includes:

[0081] S301: Acquire the dial image of the pointer-type instrument to be identified;

[0082] In one specific embodiment, a machine vision product, namely an image acquisition device, can be used to capture an image of the dial of the pointer instrument to be identified, and convert the captured dial image into an image signal and transmit it to the target detection model.

[0083] In practical applications, pointer-type instruments can be pointer-type water meters.

[0084] S302: Input the dial image into the preset target detection model;

[0085] In one specific embodiment, the target detection model is used for:

[0086] Obtain the position coordinates of each dial in the dial image;

[0087] Based on the position coordinates of each dial, obtain the image corresponding to each dial in the dial image, use it as the target image, and output the target image.

[0088] Specifically, the steps for obtaining the position coordinates of each dial in the dial image may include:

[0089] The dial image of the pointer-type instrument to be identified is detected to determine the position coordinates of each dial in the dial image;

[0090] Obtain the position coordinates of each dial in the dial image and store the position coordinates of each dial in the dial image to a preset configuration file.

[0091] Specifically, the steps of obtaining the image corresponding to each watch face in the watch face image based on the position coordinates of each watch face, using it as the target image, and outputting the target image may include:

[0092] Retrieve the position coordinates of each dial in the dial image from the configuration file;

[0093] Based on the position coordinates of each dial in the dial image, the dial image of the pointer instrument to be identified is cropped to obtain the image corresponding to each dial, which is then used as the target image and output.

[0094] In practical applications, before the step of inputting the dial image into the preset target detection model, the following steps are also included:

[0095] Obtain the initial object detection model;

[0096] The training samples with object detection box labels are input into the initial object detection model to obtain the target images corresponding to each training sample output by the initial object detection model.

[0097] Based on the output of the initial object detection model and the labels of the training samples, the loss value is calculated using a preset loss function;

[0098] Based on the loss value, adjust the parameters in the initial target detection model to obtain the target detection model.

[0099] The target detection box label can be a label set for each target image in the dial image of a pointer instrument.

[0100] In a specific embodiment, the object detection model can be the YOLOv5 (You Only Look Once version 5) object detection model. YOLOv5 is a single-stage object detection algorithm that can be used to find all targets or objects of interest in an image, determine the category and location of the targets or objects. In this embodiment of the invention, the purpose of object detection is to find all the dials in the image and obtain the position coordinates of each dial. The YOLOv5 network structure consists of three parts: the backbone network, the neck structure, and the head structure. The backbone is responsible for feature extraction; the neck is responsible for feature fusion; and the head contains three detection heads: a small target detection head, a medium target detection head, and a large target detection head, which are responsible for outputting detection information.

[0101] S303: Obtain the target image output by the target detection model;

[0102] In this embodiment of the invention, the target image is an image of each dial in the dial image of the pointer instrument to be identified. For example, if the dial image of the pointer instrument to be identified has only one dial, then the target image is the image of that dial; if the dial image of the pointer instrument to be identified has one main dial and multiple sub-dials, then the target image is the corresponding image of the main dial and the corresponding images of each sub-dial.

[0103] S304: For each target image, calculate the rotation angle of the hands in each target image;

[0104] Specifically, the step of calculating the rotation angle of the hands in each target image can include:

[0105] For each target image, a template dial image corresponding to the target image is selected from the preset template dial images;

[0106] Match the target image with the corresponding template dial image; wherein, a template dial image contains only one dial, and the template dial image is a dial image of one dial.

[0107] Based on the matching degree, select a region in the target image that matches the template dial image as the region to be filtered;

[0108] The target region is selected from the region to be filtered using a preset algorithm;

[0109] The fitting angle is the angle by which the pointer rotates clockwise from the 0-degree position around the rotation center of the template dial image to the current position of the pointer in the target area.

[0110] Specifically, the steps of filtering the target region from the region to be filtered using a preset algorithm may include:

[0111] Using the center point of the region to be screened as the center and a radius of 0.6 cm, a clustering region is extracted from the region to be screened and used as the sample point for the k-means clustering algorithm for clustering.

[0112] The regions to be screened are binarized based on the clustering results.

[0113] The inscribed circle of the region to be screened after binarization is determined as the target region.

[0114] S305: Calculate the reading of the dial corresponding to each target image based on the rotation angle of the dial pointer in each target image.

[0115] In a specific embodiment, the reading of the pointer on the dial can be calculated using the angle method based on the scale distribution on the pointer-type instrument panel, the starting position of the pointer, the current position of the pointer, and the rotation angle of the pointer.

[0116] Depend on Figure 3 As can be seen, the pointer recognition method provided in this embodiment of the invention can acquire an image of the dial of a pointer-type instrument to be recognized; input the dial image into a preset target detection model; acquire the target image output by the target detection model; calculate the rotation angle of the pointer in each target image; and calculate the reading of the pointer on the dial corresponding to each target image based on the rotation angle of the pointer in each target image. Therefore, the method provided in this embodiment of the invention can automatically recognize multi-dial instruments and is applicable to any instrument with non-fixed sub-dial positions. Thus, it solves the deficiency of existing technologies that can only recognize a single dial, improves the versatility and reusability of pointer recognition methods, and can cover more general scenarios.

[0117] The following practical example will be used to further illustrate the method provided by the embodiments of the present invention in more detail.

[0118] In this embodiment, the pointer-type meter is a pointer-type water meter. The object detection model is the YOLOv5 object detection model. In this embodiment, the YOLOv5 object detection model can be obtained through the following process: First, tens of thousands of dial images of different types, specifications, and sizes are collected. The object detection boxes are labeled on the acquired dial images using labelImg (a visual image labeling tool), resulting in a dataset. This dataset is then divided into a training set and a validation set. The parameters of the YOLOv5 algorithm are configured to obtain an initial YOLOv5 object detection model. The training set is input into the initial YOLOv5 object detection model to train it, resulting in a trained object detection model. Then, the validation set is input into the trained object detection model to validate it. The validated object detection model is used as the target object detection model to be used.

[0119] See Figure 4 The specific steps of the method provided in this embodiment are as follows:

[0120] S401: Use machine vision products to acquire the dial image of the pointer-type instrument to be identified;

[0121] Specifically, machine vision products can be used to capture images of the dial of the pointer-type instrument to be identified, and the captured dial images can be converted into image signals and transmitted to the target detection model.

[0122] S402: Input the dial image into the preset target detection model;

[0123] In this embodiment, the target detection model is the YOLOv5 target detection model. This target detection model is used to: detect the dial image of the analog instrument to be identified, determine the position coordinates of each dial in the dial image; obtain the position coordinates of each dial in the dial image, and store the position coordinates of each dial in the dial image into a preset configuration file; obtain the position coordinates of each dial in the dial image from the configuration file; then, based on the position coordinates of each dial in the dial image, crop the dial image of the analog instrument to be identified to obtain the image corresponding to each dial, which is used as the target image, and output the target image.

[0124] S403: Obtain the target image output by the target detection model;

[0125] The target image is the image of each dial in the dial image of the pointer instrument to be identified. For example: if the dial image of the pointer instrument to be identified has only one dial, then the target image is the image of that dial; if the dial image of the pointer instrument to be identified has one main dial and multiple sub-dials, then the target image is the corresponding image of the main dial and the corresponding images of each sub-dial.

[0126] S404: For each target image, select a template dial image corresponding to the target image from the preset template dial image;

[0127] In practical applications, there are sometimes issues where the size of the target image obtained by cropping the image captured by the camera using the target detection model is inconsistent with the size of the preset template dial image. The method provided in this embodiment of the invention can also scale the template dial image within a preset range so that the size of the template dial image is the same as the size of the target image. This can improve the matching accuracy in the subsequent matching process between the target image and the template dial image corresponding to the target image.

[0128] S405: Match the target image with the template dial image corresponding to the target image;

[0129] One of the template dial images contains only one dial, and the template dial image is a dial image of one dial.

[0130] In one specific embodiment, the template matching algorithm in OpenCV (Open Source Computer Vision Library) can be used to match the target image with the corresponding template dial image. OpenCV is a cross-platform open-source software library for computer vision processing that supports numerous algorithms related to computer vision and machine learning. OpenCV can be used to develop real-time image processing, computer vision, and pattern recognition programs.

[0131] In this embodiment, the template matching algorithm in OpenCV can be used to find the position of the dial corresponding to the template dial image in the target image. Of course, if the template dial image is selected relatively accurately, the matching result between the target image and the template dial image will be better. Therefore, when selecting the template dial image corresponding to the target image, multiple matching can be performed to select the template dial image that best matches the target image from a preset template dial image library.

[0132] S406: Based on the matching degree, select a region in the target image that matches the template dial image as the region to be filtered;

[0133] Specifically, one could select the region in the target image that has the highest matching degree with the template dial image as the region to be filtered.

[0134] S407: Using the center point of the region to be filtered as the center and the preset length as the radius, extract a clustering region from the region to be filtered and use it as the sample point for the k-means clustering algorithm for clustering;

[0135] Specifically, a clustering region can be extracted from the center of the region to be filtered, with a radius of 0.6 cm. This extracted region serves as the sample point for the k-means clustering algorithm (where "means" refers to the task of calculating the average of data or finding centers). The k-means clustering algorithm identifies a certain number of centers within the dataset, where each center represents the arithmetic mean of all data points in a specific cluster. The k-means clustering algorithm focuses on the location of each object in space, attempting to make objects of each category as close as possible, while keeping objects of different categories as far apart as possible.

[0136] S408: Binarize the region to be screened based on the clustering results;

[0137] Binarization is one of the simplest methods for image segmentation. Binarization converts a grayscale image into a binary image. Pixels with grayscale values ​​greater than a certain threshold are set to their maximum grayscale value (255), and pixels with grayscale values ​​less than this threshold are set to their minimum grayscale value (0), thus achieving binarization.

[0138] Image binarization involves setting the grayscale value of each pixel in an image to either 0 or 255. For example, a threshold is set, and for each pixel in the image, its grayscale value is compared to the threshold. If a pixel's grayscale value is greater than or equal to the threshold, its grayscale value is set to 255; otherwise, if its grayscale value is less than the threshold, its grayscale value is set to 0. This results in an image that appears to be only black and white.

[0139] In this embodiment, the clustering results calculated using the k-means clustering algorithm are binarized into the image corresponding to the region to be screened, resulting in a binarized image of the region. For example, if the clustering result is 2, the median of the clustering results is calculated and used as a threshold. For each pixel in the image, the gray value of each pixel is compared with the threshold. If the gray value of a pixel is greater than or equal to the threshold, the gray value of that pixel is set to 255; otherwise, if the gray value of a pixel is less than the threshold, the gray value of that pixel is set to 0, thus obtaining the binarized image of the region to be screened.

[0140] S409: Determine the inscribed circle portion of the binarized region to be filtered as the target region;

[0141] Specifically, one could retain only the inscribed circle of the region to be selected after binarization, and delete the useless regions outside the inscribed circle. This can effectively avoid the negative impact of useless regions on subsequent needle fitting.

[0142] S410: The angle by which the pointer rotates clockwise from the 0-degree position around the rotation center of the template dial image to the current position of the pointer in the target area;

[0143] Specifically, the rotation center of the template dial image can be selected, and the clock hand can be fitted, which is to simulate the clock hand. First, a straight line is fitted. Using the method of rotating a virtual straight line, assuming a straight line rotates clockwise around the center from the 0-degree position, when the pixel overlap between the fitted pointer and the real pointer, that is, the clock hand in the target area, is the highest, it indicates that the straight line has rotated to the position currently pointed to by the clock hand in the target area. Record this angle, which is the rotation angle of the clock hand in the target image.

[0144] S411: Calculate the reading of the dial corresponding to each target image based on the rotation angle of the dial in each target image.

[0145] Of course, after calculating the reading of the dial corresponding to each target image, the reading of the dial corresponding to each target image can also be displayed on the screen for the user to read or use.

[0146] In a specific embodiment, the reading of the pointer on the dial can be calculated using the angle method based on the scale distribution on the pointer dial, the starting position of the pointer, the current position of the pointer, and the rotation angle of the pointer.

[0147] Depend on Figure 4 As can be seen, the method provided by this invention can acquire the dial image of a pointer-type instrument to be identified using machine vision products, upload the acquired dial image to a preset target detection model, obtain the target image using the target detection model, and then calculate the rotation angle of the pointer in the target image using template matching, k-means binarization, and line fitting. Based on the rotation angle, the reading of the pointer in the corresponding dial of the target image is calculated, thereby achieving automatic identification of the dial instrument. The method provided by this invention is applicable not only to single-dial instruments but also to multi-dial instruments, thus solving the deficiency of existing technologies that can only identify a single dial, improving the versatility and reusability of pointer identification methods, and covering more general scenarios.

[0148] In addition, since machine vision products have advantages such as low fatigue, high precision, high degree of automation and high work efficiency, the automatic acquisition of dial images through machine vision technology, the uploading of the acquired dial images to the target detection model, the acquisition of target images by the target detection model, and the automatic identification of the reading of the dial needles by template matching, k-means binarization and line fitting can free meter readers from tedious, inefficient and repetitive work, and greatly save labor and time costs.

[0149] and Figure 3 Corresponding to the illustrated embodiments, this invention also provides a device for identifying watch hands. For example... Figure 5 As shown, the device includes: a first acquisition module 501, an input module 502, a second acquisition module 503, an angle calculation module 504, and a reading calculation module 505, wherein...

[0150] The first acquisition module is used to acquire the dial image of the pointer-type instrument to be identified;

[0151] The input module is used to input the dial image into the preset target detection model;

[0152] The second acquisition module is used to acquire the target image output by the target detection model;

[0153] Angle calculation module is used to calculate the rotation angle of the hands in each target image.

[0154] The reading calculation module is used to calculate the reading of the dial corresponding to each target image based on the rotation angle of the dial pointer in each target image.

[0155] Optionally, the object detection model is used for:

[0156] Obtain the position coordinates of each dial in the dial image;

[0157] Based on the position coordinates of each dial, obtain the image corresponding to each dial in the dial image, use it as the target image, and output the target image.

[0158] Optionally, the object detection model is specifically used for:

[0159] The dial image of the pointer-type instrument to be identified is detected to determine the position coordinates of each dial in the dial image;

[0160] Obtain the position coordinates of each dial in the dial image and store the position coordinates of each dial in the dial image to a preset configuration file.

[0161] Optionally, the object detection model is specifically used for:

[0162] Retrieve the position coordinates of each dial in the dial image from the configuration file;

[0163] Based on the position coordinates of each dial in the dial image, the dial image of the pointer instrument to be identified is cropped to obtain the image corresponding to each dial, which is then used as the target image and output.

[0164] Optionally, the device further includes a training module, which is used for:

[0165] Obtain the initial object detection model;

[0166] The training samples with object detection box labels are input into the initial object detection model to obtain the target images corresponding to each training sample output by the initial object detection model.

[0167] Based on the output of the initial object detection model and the labels of the training samples, the loss value is calculated using a preset loss function;

[0168] Based on the loss value, adjust the parameters in the initial target detection model to obtain the target detection model.

[0169] Optional, angle calculation module 504, specifically used for:

[0170] For each target image, a template dial image corresponding to the target image is selected from the preset template dial images;

[0171] Match the target image with the corresponding template dial image; wherein, a template dial image contains only one dial, and the template dial image is a dial image of one dial.

[0172] Based on the matching degree, select a region in the target image that matches the template dial image as the region to be filtered;

[0173] The target region is selected from the region to be filtered using a preset algorithm;

[0174] The fitting angle is the angle by which the pointer rotates clockwise from the 0-degree position around the rotation center of the template dial image to the current position of the pointer in the target area.

[0175] Optional, angle calculation module 504, specifically used for:

[0176] Using the center point of the region to be screened as the center and a preset length as the radius, a clustering region is extracted from the region to be screened and used as the sample points for the k-means clustering algorithm for clustering.

[0177] The regions to be screened are binarized based on the clustering results.

[0178] The inscribed circle of the region to be screened after binarization is determined as the target region.

[0179] Depend on Figure 5As can be seen, the device for pointer recognition provided in this embodiment of the invention can acquire an image of the dial of a pointer-type instrument to be recognized; input the dial image into a preset target detection model; acquire the target image output by the target detection model; calculate the rotation angle of the pointer in each target image; and calculate the reading of the pointer on the dial corresponding to each target image based on the rotation angle of the pointer in each target image. Therefore, the device provided in this embodiment of the invention can automatically recognize multi-dial instruments and is applicable to any instrument with non-fixed sub-dial positions. Thus, it solves the deficiency of existing technologies that can only recognize a single dial, improves the versatility and reusability of pointer recognition methods, and can cover more general scenarios.

[0180] and Figure 3 Corresponding to the embodiments shown, this invention also provides an electronic device, see [link to previous document]. Figure 6 It includes a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602 and the memory 603 communicate with each other through the communication bus 604.

[0181] Memory 603 is used to store computer programs;

[0182] The processor 601 is used to execute the program stored in the memory to implement the method steps for identifying any of the dial pointers in the above embodiments.

[0183] The electronic device provided in this invention can acquire an image of the dial of a pointer-type instrument to be identified; input the dial image into a preset target detection model; acquire the target image output by the target detection model; calculate the rotation angle of the hands in each target image; and calculate the reading of the hands on the dial corresponding to each target image based on the rotation angle of the hands in each target image. Therefore, the electronic device provided in this invention can automatically identify multi-dial instruments and is applicable to any instrument with non-fixed sub-dial positions. This solves the problem of existing technologies that can only identify a single dial, improves the versatility and reusability of the hand recognition method, and can cover more general scenarios.

[0184] and Figure 3 Corresponding to the embodiments shown, this embodiment of the invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method steps for identifying any of the pointers in the above embodiments.

[0185] The storage medium provided in this embodiment of the invention can acquire the dial image of a pointer-type instrument to be identified; input the dial image into a preset target detection model; acquire the target image output by the target detection model; calculate the rotation angle of the pointer in each target image; and calculate the reading of the pointer on the dial corresponding to each target image based on the rotation angle of the pointer in each target image. Therefore, by applying the storage medium provided in this embodiment of the invention, automatic identification of multi-dial instruments can be achieved, and it is applicable to any instrument with non-fixed sub-dial positions. Thus, it solves the deficiency of existing technologies that can only identify a single dial, improves the versatility and reusability of pointer identification methods, and can cover more general scenarios.

[0186] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.

[0187] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0188] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0189] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0190] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A method of identifying a watch hand, characterized in that, The method comprises the following steps: obtaining a dial image of a to-be-recognized analog instrument; inputting the dial image into a preset target detection model; obtaining a target image output by the target detection model; for each target image, calculating a rotation angle of a pointer in the target image; according to the rotation angle of the pointer in each target image, calculating a reading of the pointer in the dial corresponding to each target image; the step of calculating the rotation angle of the pointer in each target image comprises: for each target image, selecting a template dial image corresponding to the target image from preset template dial images; matching the target image with the template dial image corresponding to the target image; wherein each template dial image contains only one dial, and each template dial image is a dial image of one dial; according to the matching degree, selecting an area in the target image that matches the template dial image as a to-be-screened area; using a preset algorithm to screen a target area from the to-be-screened area; fitting the rotation angle of the pointer from a 0-degree position clockwise around the rotation center of the template dial image to the current position of the pointer in the target area; the step of calculating the reading of the pointer in the dial corresponding to each target image according to the rotation angle of the pointer in each target image comprises: based on the scale distribution in the dial of the analog instrument, according to the starting position of the pointer, the current position of the pointer and the rotation angle of the pointer, using the angle method to calculate the reading of the pointer in the dial; the target detection model is used to: obtain the position coordinates of each dial in the dial image; according to the position coordinates of each dial, obtain the image corresponding to each dial in the dial image as a target image, and output the target image.

2. The method of claim 1, wherein, the step of obtaining the position coordinates of each dial in the dial image comprises: detecting the dial image of the to-be-recognized analog instrument to determine the position coordinates of each dial in the dial image; obtaining the position coordinates of each dial in the dial image and storing the position coordinates of each dial in the dial image in a preset configuration file.

3. The method of claim 2, wherein, the step of obtaining the image corresponding to each dial in the dial image as a target image according to the position coordinates of each dial comprises: respectively obtaining the position coordinates of each dial in the dial image from the configuration file; according to the position coordinates of each dial in the dial image, cropping the dial image of the to-be-recognized analog instrument to obtain the image corresponding to each dial as a target image, and outputting the target image.

4. The method of claim 1, wherein, before the step of inputting the dial image into the preset target detection model, the method further comprises: obtaining an initial target detection model; inputting a training sample with a target detection frame label into the initial target detection model to obtain a target image corresponding to each training sample output by the initial target detection model; according to the output result of the initial target detection model and the label of the training sample, calculating a loss value using a preset loss function; According to the loss value, parameters in the initial target detection model are adjusted to obtain the target detection model.

5. The method of claim 4, wherein, The step of screening the target region from the to-be-screened region by using a preset algorithm comprises: A clustering region is intercepted from the to-be-screened region with the center point of the to-be-screened region as the center and a preset length as the radius, as a sample point of the k-means clustering algorithm, and clustering is performed; The to-be-screened region is binarized according to the clustering result; An inscribed circle part of the to-be-screened region after the binarization is determined as the target region.

6. An apparatus for identifying a watch hand, characterized in that The device comprises: The first acquisition module is configured to acquire a dial image of a to-be-identified pointer instrument; The input module is configured to input the dial image into a preset target detection model; The second acquisition module is configured to acquire a target image output by the target detection model; The angle calculation module is configured to calculate a rotation angle of a pointer in each target image; The reading calculation module is configured to calculate a reading of the pointer in the dial corresponding to each target image according to the rotation angle of the pointer in each target image; The step of calculating the rotation angle of the pointer in each target image comprises: For each target image, a template dial image corresponding to the target image is selected from preset template dial images; The target image and the template dial image corresponding to the target image are matched; wherein, each template dial image comprises only one dial, and each template dial image is a dial image of one dial; According to the matching degree, one region in the target image that matches the template dial image is selected as a to-be-screened region; A target region is screened from the to-be-screened region by using a preset algorithm; The angle of the fitted pointer rotating from a 0-degree position clockwise around the rotation center of the template dial image to the current position of the pointer in the target region is calculated; The step of calculating the reading of the pointer in the dial corresponding to each target image according to the rotation angle of the pointer in each target image comprises: based on the scale distribution in the pointer dial, the reading of the pointer in the dial is calculated by using the angle method according to the starting position of the pointer, the current position of the pointer, and the rotation angle of the pointer. The target detection model is configured to: Obtain position coordinates of each dial in the dial image; According to the position coordinates of each dial, an image corresponding to each dial in the dial image is obtained as a target image, and the target image is output.

7. An electronic device, comprising: The device comprises a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is configured to store a computer program; The processor is configured to execute the program stored in the memory to implement the method steps of any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps of any one of claims 1-5.

Citation Information

Patent Citations

  • Pointer type instrument reading identification method and device, electronic equipment and storage medium

    CN115393838A