Instrument reading method and device, storage medium

By identifying key points in the instrument image and directly reading the pointer position and scale value, the problem of low accuracy in pointer instrument data reading is solved, and accurate data reading of elliptical images is realized.

CN117351229BActive Publication Date: 2024-12-03RICHFIT INFORMATION TECH +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311247558.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-25
Publication Date
2024-12-03
Estimated Expiration
2043-09-25

AI Technical Summary

Technical Problem

In the prior art, when reading pointer instrument data, the camera takes a side upward image to cause the image to be elliptical, and the pointer may be offset during the correction process, resulting in low data accuracy.

Method used

By acquiring the instrument image, determine the key points of the pointer position and scale value, use these key points to directly read the numerical values ​​indicated by the pointer, avoiding the image correction process, and using the key point extraction model and deep learning algorithm to identify the pointer and scale of the instrument.

Benefits of technology

Improve the accuracy of the reading of instrument data, avoid image correction errors caused by shooting angles, and directly read accurate data from elliptical images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117351229B_ABST
    Figure CN117351229B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for reading an instrument, and a storage medium, and belongs to the field of computer technology. The method includes: after acquiring a first image containing an instrument to be read, a plurality of first key points for characterizing the position of a pointer in the instrument, and a plurality of second key points for characterizing a plurality of scale values ​​of the instrument can be determined in the first image. In this way, even if the instrument in the first image is elliptical due to shooting reasons, it is not necessary to correct the elliptical instrument in the first image into a circular instrument. The value indicated by the pointer in the instrument can be directly read according to the plurality of first key points and the plurality of second key points determined in the first image, and the value is the instrument data. In this way, the accuracy of the instrument data read can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for reading an instrument, and a storage medium. Background Art

[0002] With the development of science and technology, more and more industries are moving towards automation. The operating status of many equipment is mainly displayed by pointer instruments, such as voltmeters, ammeters, temperature gauges or oil pressure gauges.

[0003] Currently, it is necessary to shoot the pointer instrument with a camera to obtain an image containing the instrument. Then the instrument data in the image can be read through the digital image processing algorithm and the segmentation algorithm. Among them, the digital image processing algorithm is used to pre-process the image containing the instrument, for example, to perform denoising and correction on the image; the segmentation algorithm is used to segment the pre-processed image to obtain the instrument pointer and instrument scale, and then the instrument data can be read according to the position of the pointer.

[0004] However, if the camera shoots the instrument from the side, the instrument in the obtained image is usually elliptical. Therefore, it is necessary to correct the elliptical instrument in the image to a circular instrument before performing subsequent image segmentation. During the correction process of the image containing the instrument, the pointer of the instrument in the image may be offset, resulting in low accuracy of the instrument data subsequently read. Summary of the invention

[0005] The embodiment of the present application provides a meter reading method and device, and a storage medium. The problem of low accuracy of the meter data read can be solved. The technical solution is as follows:

[0006] In one aspect, a method for reading an instrument is provided, the method comprising:

[0007] acquiring a first image including a meter to be read;

[0008] Based on the first image, determining a plurality of first key points and a plurality of second key points in the instrument, wherein the plurality of first key points are used to represent a pointer position in the instrument; and the plurality of second key points are used to represent a plurality of scale values ​​of the instrument;

[0009] Based on the plurality of first key points and the plurality of second key points, the value indicated by the pointer in the instrument is read.

[0010] Optionally, the plurality of first key points include: a tip point of the pointer and a center point of a dial in the instrument; and based on the plurality of first key points and the plurality of second key points, reading a value indicated by the pointer in the instrument comprises:

[0011] Detect whether there is a target second key point among the plurality of second key points that coincides with the straight line where the pointer line is located, wherein the pointer line is a line between the tip point and the center point;

[0012] If the target second key point exists among the plurality of second key points, reading the value indicated by the pointer in the instrument based on the target second key point;

[0013] If the target second key point does not exist in the plurality of second key points, determining two second key points adjacent to the tip point in the plurality of second key points;

[0014] Based on the tip point and the two second key points, the value indicated by the pointer in the instrument is read.

[0015] Optionally, the two second key points are respectively: a first scale point and a second scale point; based on the tip point and the two second key points, reading the value indicated by the pointer in the instrument comprises:

[0016] Determine a first angle between a first scale line and a second scale line, wherein the first scale line is a line between the first scale point and the center point, and the second scale line is a line between the second scale point and the center point;

[0017] Determine a second angle between the pointer line and the first scale line;

[0018] Based on the second angle and the first angle, and the scale values ​​represented by the first scale point and the second scale point, a value indicated by the pointer in the instrument is determined.

[0019] Optionally, determining a plurality of first key points and a plurality of second key points in the instrument based on the first image includes:

[0020] determining an outer contour of the instrument in the first image;

[0021] Based on the outer contour of the instrument, removing the background image other than the instrument in the first image to obtain a second image;

[0022] The second image is input into the key point extraction model to obtain a plurality of first key points and a plurality of second key points in the instrument output by the key point extraction model.

[0023] Optionally, before inputting the second image into a key point extraction model to obtain a plurality of first key points and a plurality of second key points in the instrument output by the key point extraction model, the method further includes:

[0024] Performing a first training process multiple times on the first initial extraction model to obtain the key point extraction model;

[0025] Wherein, each of the first training processes includes:

[0026] Inputting a sample instrument image into the first initial extraction model to obtain a plurality of key points output by the first initial extraction model;

[0027] Based on the multiple key points output by the first initial extraction model and the multiple label key points corresponding to the sample instrument image, the model parameters of the first initial extraction model are adjusted.

[0028] Optionally, before performing the first training process multiple times on the first initial extraction model, the method further includes:

[0029] Acquire multiple initial sample images containing instruments;

[0030] Determine the outer contour of the instrument in each of the initial sample images;

[0031] Based on the outer contour of the instrument in each of the initial sample images, remove the background image other than the instrument in the initial sample image to obtain a plurality of sample instrument images corresponding to the plurality of initial sample images one by one;

[0032] Based on the pointer position and multiple scale values ​​in the instrument in each of the sample instrument images, multiple label key points corresponding to the sample instrument image are determined.

[0033] In another aspect, a device for reading a meter is provided, the device comprising:

[0034] A determination module, configured to determine, based on the first image, a plurality of first key points and a plurality of second key points in the instrument, wherein the plurality of first key points are used to represent a pointer position in the instrument; and the plurality of second key points are used to represent a plurality of scale values ​​of the instrument;

[0035] A reading module is used to read the value indicated by the pointer in the instrument based on the multiple first key points and the multiple second key points.

[0036] Optionally, the plurality of first key points include: the tip point of the pointer and the center point of the dial in the instrument; the reading module includes:

[0037] A detection unit, used to detect whether there is a target second key point among the plurality of second key points that coincides with the straight line where the pointer line is located, wherein the pointer line is a line between the tip point and the center point;

[0038] a first reading unit, configured to read a value indicated by a pointer in the instrument based on the target second key point if the target second key point exists among the plurality of second key points;

[0039] A first determining unit, configured to determine two second key points adjacent to the tip point from among the plurality of second key points if the target second key point does not exist in the plurality of second key points;

[0040] The second reading unit is used to read the value indicated by the pointer in the instrument based on the tip point and the two second key points.

[0041] Optionally, the two second key points are respectively: a first scale point and a second scale point; and the reading unit is used to:

[0042] Determine a first angle between a first scale line and a second scale line, wherein the first scale line is a line between the first scale point and the center point, and the second scale line is a line between the second scale point and the center point;

[0043] Determine a second angle between the pointer line and the first scale line;

[0044] Based on the second angle and the first angle, and the scale values ​​represented by the first scale point and the second scale point, a value indicated by the pointer in the instrument is determined.

[0045] On the other hand, a computer storage medium is provided, in which at least one instruction, at least one program, code set or instruction set is stored, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by a processor to implement the instrument reading method as described above.

[0046] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0047] After acquiring a first image containing an instrument to be read, a plurality of first key points for representing the position of a pointer in the instrument and a plurality of second key points for representing a plurality of scale values ​​of the instrument can be determined in the first image. In this way, even if the instrument in the first image is elliptical due to shooting reasons, it is not necessary to correct the elliptical instrument in the first image into a circular instrument. The value indicated by the pointer in the instrument can be directly read according to the plurality of first key points and the plurality of second key points determined in the first image, and the value is the instrument data. In this way, the accuracy of the instrument data read can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0049] Figure 1 is a flow chart of a method for reading an instrument provided in an embodiment of the present application;

[0050] Figure 2 is a flow chart of another instrument reading method provided in an embodiment of the present application;

[0051] Figure 3 It is a schematic diagram of key points of an instrument provided in an embodiment of the present application;

[0052] Figure 4 It is a schematic diagram of key points of another instrument provided in an embodiment of the present application;

[0053] Figure 5 This is a schematic diagram of key points of another instrument provided in an embodiment of the present application;

[0054] Figure 6 This is a schematic diagram of key points of another instrument provided in an embodiment of the present application;

[0055] Figure 7 is a block diagram of a meter reading device provided in an embodiment of the present application;

[0056] Figure 8 is a structural block diagram of a reading module provided in an embodiment of the present application;

[0057] Fig. 9 It is a structural block diagram of a determination module provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0059] Please refer to Figure 1 , Figure 1 1 is a flow chart of a meter reading method provided in an embodiment of the present application. The meter reading method is applied in a computer device. The meter reading method may include:

[0060] Step 101: Acquire a first image containing a meter to be read.

[0061] Step 102: Based on the first image, determine a plurality of first key points and a plurality of second key points in the instrument.

[0062] Here, a plurality of first key points are used to represent the pointer position in the instrument, and a plurality of second key points are used to represent a plurality of scale values ​​of the instrument.

[0063] Step 103: Based on the multiple first key points and the multiple second key points, read the value indicated by the pointer in the instrument.

[0064] In summary, the meter reading method provided in the embodiment of the present application can determine multiple first key points used to characterize the position of the pointer in the meter and multiple second key points used to characterize the multiple scale values ​​of the meter in the first image after acquiring the first image containing the meter to be read. In this way, even if the meter in the first image is elliptical due to shooting reasons, there is no need to correct the elliptical meter in the first image to a circular meter. The value indicated by the pointer in the meter can be directly read according to the multiple first key points and multiple second key points determined in the first image, and the value is the meter data. In this way, the accuracy of the meter data read can be effectively improved.

[0065] Please refer to Figure 2 , Figure 2 1 is a flow chart of another instrument reading method provided in an embodiment of the present application. The instrument reading method is applied to a computer device. The instrument reading method may also include:

[0066] Step 201: Acquire a first image containing a meter to be read.

[0067] In an embodiment of the present application, a computer device may acquire a first image including a meter to be read. For example, a camera may be used to shoot the meter to be read to obtain a first image including the meter to be read. Afterwards, the camera may send the first image to the computer device, so that the computer device may acquire the first image.

[0068] Optionally, the instrument to be read may be: a voltmeter, an ammeter, a temperature meter or an oil pressure meter, etc. These instruments are usually set up in a production workshop, and these instruments are used to monitor environmental information. To this end, the computer device needs to periodically obtain a first image containing the instrument to be read, so that the subsequent computer device can read the instrument data to determine whether the environmental information monitored by the instrument is abnormal. For example, the camera can take a picture of the instrument to be read at regular intervals, and after obtaining the first image containing the instrument to be read, it can be directly sent to the computer device, so that the computing device can obtain the first image containing the instrument to be read at regular intervals.

[0069] Step 202: Determine the outer contour of the instrument in the first image.

[0070] In an embodiment of the present application, the computer device may determine the outer contour of the instrument in the first image.

[0071] Optionally, after acquiring the first image containing the instrument, the computer device may preprocess the first image first, and then determine the outer contour of the instrument in the preprocessed first image. For example, preprocessing the first image may include: performing image denoising, image enhancement, and resizing on the first image. Among them, the image denoising is used to eliminate noise interference in the first image, thereby improving the quality of the first image. The image enhancement is used to increase the contrast of the first image to make the first image clearer. The resizing is used to adjust the size of the first image so that the outer contour of the instrument in the first image can be identified more quickly later.

[0072] In one possible implementation, determining the outer contour of the instrument in the first image may include: inputting the first image into an outer contour extraction model, and obtaining the first image output by the outer contour extraction model and including the outer contour of the instrument. In this way, the computer device can use the outer contour extraction model to quickly and accurately identify the outer contour of the instrument in the first image.

[0073] In the present application, before inputting the first image into the outer contour extraction model and obtaining the first image output by the outer contour extraction model containing the outer contour of the instrument, the computer device also needs to obtain the outer contour extraction model. Optionally, the outer contour extraction model can be an artificial intelligence (AI) model obtained by learning and training using a deep learning algorithm. Here, the computer device needs to perform a second training process on the second initial extraction model multiple times to obtain the outer contour extraction model.

[0074] For example, each second training process may include:

[0075] Step A1: input an initial sample image into the second initial extraction model to obtain a contour sample image output by the second initial extraction model that contains the outer contour of the instrument.

[0076] Step B1: adjusting the model parameters of the second initial extraction model based on the outer contour in the contour sample image output by the second initial extraction model and the label outer contour corresponding to the initial sample image.

[0077] In the present application, the similarity between the outer contour in the contour sample image output by the second initial extraction model and the outer contour of the label corresponding to the initial sample image can be compared, and the model parameters of the second initial extraction model can be adjusted according to the comparison result. It should be noted that as the number of training times increases, the similarity between the outer contour in the contour sample image output by the second initial extraction model and the outer contour of the label corresponding to the initial sample image becomes higher and higher.

[0078] It should also be noted that, when executing the second initial extraction model for multiple times of the second training process, if the cutoff condition is met, the second initial extraction model after the last second training process is executed can be determined as the outer contour extraction model.

[0079] Optionally, the cutoff condition may include: executing the second training process for a specified number of times; or, when the second training process is executed n times in succession, the similarity between the outer contour in the contour sample image output by the second initial extraction model each time and the label outer contour corresponding to the initial sample image is greater than a similarity threshold, where n is an integer greater than 1.

[0080] In an embodiment of the present application, before performing multiple second training processes on the second initial extraction model, the computer device also needs to obtain multiple initial sample images containing instruments, and a label outer contour corresponding to each initial sample image, where the label outer contour is the outer contour of the instrument in the corresponding initial sample image.

[0081] It should be noted that, during the multiple second training processes for the second initial extraction model, each initial sample image acquired by the computer device needs to be input into the second initial extraction model at least twice.

[0082] Step 203: Based on the outer contour of the instrument, remove the background image except the instrument in the first image to obtain a second image.

[0083] In an embodiment of the present application, after the computer device determines the outer contour of the instrument in the first image, the computer device may remove the background image other than the instrument in the first image based on the outer contour of the instrument to obtain the second image.

[0084] For example, the computer device can determine the position information of the outer contour of the instrument in the first image, and segment the background image outside the outer contour of the instrument according to the position information of the outer contour of the instrument, so as to remove the second image of the background image. That is, the second image only contains the image of the instrument. In this way, the instrument data can be read more accurately according to the second image later.

[0085] Step 204: input the second image into the key point extraction model to obtain a plurality of first key points and a plurality of second key points in the instrument output by the key point extraction model.

[0086] In an embodiment of the present application, after acquiring the second image, the computer device can input the second image into a key point extraction model to obtain multiple first key points and multiple second key points in the instrument output by the key point extraction model.

[0087] Among them, please refer to Figure 3 , Figure 3 This is a schematic diagram of the key points of an instrument provided in an embodiment of the present application. Among them, multiple first key points b are used to characterize the position of the pointer in the instrument. For example, multiple first key points b may include: the tip point b1 of the pointer and the center point b2 of the dial in the instrument. The position of the pointer in the instrument can be determined by the tip point b1 of the pointer and the center point b2 of the dial in the instrument. Multiple second key points a are used to characterize multiple scale values ​​in the instrument. Here, multiple second key points a can correspond one-to-one to multiple scale values ​​in the instrument, so that each second key point a can characterize a corresponding scale value in the instrument.

[0088] In the present application, the key point extraction model is used to extract multiple first key points and multiple second key points in the instrument according to the second image. Since the multiple first key points are used to characterize the pointer position in the instrument, and the multiple second key points are used to characterize the multiple scale values ​​in the instrument, the first key points and the second key points extracted by the key point extraction model can characterize the instrument in the second image. In this way, the instrument data can be read directly based on these key points.

[0089] In an embodiment of the present application, before inputting the second image into the key point extraction model to obtain a plurality of first key points and a plurality of second key points in the instrument output by the key point extraction model, the computer device also needs to obtain the key point extraction model. Optionally, the key point extraction model can be an AI model obtained by learning and training using a deep learning algorithm. For example, the key point extraction model can include a context instance decoupling network and a high-resolution network.

[0090] It should be noted that the context instance decoupling network is used to decouple the instrument in the second image into multiple instance-aware feature maps, and each feature map can be used to determine multiple first key points and multiple second key points in the instrument. The context instance decoupling network can isolate the interference of the instrument and the background and explore context clues on a larger scale. The high-resolution network is used to generate rich high-resolution representations of the multiple first key points and multiple second key points in the determined second image, thereby improving the accuracy of the key point information in the determined instrument. The AI ​​model obtained by combining the training of the context instance decoupling network and the high-resolution network can more accurately identify the information of the key points.

[0091] Here, the computer device needs to perform multiple first training processes on the first initial extraction model to obtain a key point extraction model. For example, each first training process may include:

[0092] Step A2: input a sample instrument image into the first initial extraction model to obtain a plurality of key points output by the first initial extraction model.

[0093] Here, some of the multiple key points output by the first initial model are used to represent the position of the pointer in the instrument, and another part of the key points are used to represent multiple scale values ​​of the instrument.

[0094] Step B2: adjusting the model parameters of the first initial extraction model based on the multiple key points output by the first initial extraction model and the multiple label key points corresponding to the sample instrument image.

[0095] In the embodiment of the present application, the multiple key points output by the first initial extraction model correspond one-to-one to the multiple label key points corresponding to the sample instrument image. The similarity between each key point output by the first initial extraction model and the corresponding label key point can be compared, and the model parameters of the first initial extraction model can be adjusted according to the comparison result. It should be noted that as the number of training times increases, the similarity between the multiple key points output by the first initial extraction model and the corresponding multiple label key points becomes higher and higher.

[0096] It should also be noted that, when executing the first training process multiple times on the first initial extraction model, if the cutoff condition is met, the first initial extraction model after the last first training process is executed can be determined as the key point extraction model.

[0097] Optionally, the cutoff condition may include: executing the first training process for a specified number of times; or, when the first training process is executed m times in succession, the similarity between the multiple key points output by the first initial extraction model and the corresponding multiple label key points is greater than a similarity threshold each time, where m is an integer greater than 1.

[0098] In the embodiment of the present application, before performing the first training process multiple times on the first initial extraction model, the computer device also needs to obtain multiple sample instrument images as training samples, and needs to obtain multiple label key points corresponding to each sample instrument image as training labels. Here, the method for the computer device to obtain multiple sample instrument images and the corresponding multiple label key points may include:

[0099] Step A3: Acquire multiple initial sample images containing instruments.

[0100] Here, the camera can shoot a variety of different instruments to obtain a plurality of initial sample images containing the instruments. Afterwards, the camera can send these initial sample images to the computer device, so that the computer device can obtain the plurality of initial sample images containing the instruments.

[0101] Step B3: determine the outer contour of the instrument in each initial sample image.

[0102] This step may refer to the above-mentioned step 202, and will not be described in detail in this application.

[0103] Step C3: based on the outer contour of the instrument in each initial sample image, remove the background image other than the instrument in the initial sample image to obtain a plurality of sample instrument images corresponding to the plurality of initial sample images.

[0104] This step can refer to the above step 203, and the present application will not repeat it here. It should be noted that after removing the background image except the instrument in an initial sample image, a sample instrument image can be obtained.

[0105] Step D3: Based on the pointer position and multiple scale values ​​in the instrument in each sample instrument image, determine multiple label key points corresponding to the sample instrument image.

[0106] For example, after receiving the marking operation on the pointer position and the marking operation on multiple scale values ​​triggered by the operator, the computer device can determine multiple label key points corresponding to the sample instrument image.

[0107] It should be noted that, in the process of performing multiple first trainings on the first initial extraction model, each initial sample instrument image acquired by the computer device needs to be input into the first initial extraction model at least twice.

[0108] Step 205: Detect whether there is a target second key point among the multiple second key points that coincides with the straight line where the pointer connection line is located.

[0109] In the embodiment of the present application, after the computer device obtains a plurality of first key points and a plurality of second key points, the computer device can detect whether there is a target second key point among the plurality of second key points that coincides with the straight line where the pointer connection line is located. The pointer connection line is a line between the tip point of the pointer and the center point of the dial.

[0110] For example, if the computer device detects that there is a target second key point that coincides with the straight line where the pointer line is located among the multiple second key points, step 206 is executed. If the computer device detects that there is no target second key point that coincides with the straight line where the pointer line is located among the multiple second key points, step 207 is executed.

[0111] In the present application, after the computer device obtains multiple first key points and multiple second key points, the computer device can obtain the position information of each first key point and each second key point. In this way, the computer device can determine the position information of the pointer line based on the position information of the tip point of the pointer and the center point of the dial, and then determine whether there is a target second key point that coincides with the straight line where the pointer line is located among the multiple second key points based on the position information of each second key point.

[0112] For example, see Figure 4 , Figure 4 206 is a schematic diagram of another key point of an instrument provided in an embodiment of the present application. Assuming that a second key point a3 is distributed on the straight line where the pointer connecting line L1 between the tip point b1 of the pointer and the center point b2 of the dial is located, then the second key point a3 is the target second key point. At this time, step 206 can be executed.

[0113] Please refer to Figure 5 , Figure 5 It is another key point schematic diagram of an instrument provided by an embodiment of the present application. Assuming that each second key point a is not on the straight line where the pointer connecting line L1 between the tip point b1 of the pointer and the center point b2 of the dial is located, step 207 is executed.

[0114] Step 206: If there is a target second key point among the plurality of second key points, read the value indicated by the pointer in the instrument based on the target second key point.

[0115] In an embodiment of the present application, if the computer device detects that there is a target second key point among multiple second key points that coincides with the straight line where the pointer connection line is located, the computer device can read the value indicated by the pointer in the instrument based on the target second key point.

[0116] For example, the computer device may determine the scale value represented by the second key point of the target as the value indicated by the pointer in the instrument, and the value is the current instrument data of the instrument.

[0117] Step 207: If the target second key point does not exist in the plurality of second key points, two second key points adjacent to the tip point are determined in the plurality of second key points.

[0118] In an embodiment of the present application, if the computer device detects that there is no target second key point that coincides with the straight line where the pointer connection line is located among the multiple second key points, the computer device can determine two second key points adjacent to the tip point among the multiple second key points. Here, the two second key points adjacent to the tip point among the multiple second key points can be: a first scale point and a second scale point, respectively.

[0119] For example, after obtaining multiple first key points and multiple second key points, the computer device can obtain the position information of each first key point and each second key point. In this way, the computer device can determine the first scale point and the second scale point adjacent to the tip point based on the position information of the tip point of the pointer and the position information of each second key point.

[0120] For example, Figure 5 As shown, assuming that, among the multiple second key points a, the second key point a1 and the second key point a2 are located on both sides of the tip point b1 of the pointer, the second key point a1 can be used as the first scale point, and the second key point a2 can be used as the second scale point.

[0121] Step 208: Based on the tip point and two second key points adjacent to the tip point, read the value indicated by the pointer in the instrument.

[0122] In an embodiment of the present application, after the computer device determines two second key points adjacent to the tip point among multiple second key points, the computer device can read the value indicated by the pointer in the instrument based on the tip point and the two second key points adjacent to the tip point.

[0123] In the present application, since the two second key points adjacent to the tip point are the first scale point and the second scale point, respectively, the computer device can read the value indicated by the pointer in the instrument according to the tip point of the pointer, the first scale point and the second scale point. For example, the computer device reads the value indicated by the pointer in the instrument according to the tip point of the pointer, the first scale point and the second scale point, which may include:

[0124] Step A4: determine a first angle between the first scale line and the second scale line.

[0125] The first scale line is a line between the first scale point and the center point of the dial, and the second scale line is a line between the second scale point and the center point of the dial.

[0126] In an embodiment of the present application, the computer device can determine the position of the first scale line between the first scale point and the center point of the dial, and the position of the second scale line between the second scale point and the center point of the dial based on the position information of the first scale point, the second scale point and the center point of the dial, and then determine the angle between the first scale line and the second scale line.

[0127] For examples, please refer to Figure 6 , Figure 6 This is a schematic diagram of key points of another instrument provided by an embodiment of the present application. The computer device can first determine the position of the first scale line L2 based on the position information of the first scale point a1 and the center point b2 of the dial, and then determine the position of the second scale line L3 based on the position information of the second scale point a2 and the center point b2 of the dial. In this way, the computer device can determine the first angle θ1 between the first scale line L2 and the second scale line L3 based on the positions of the two.

[0128] Step B4: determine the second angle between the pointer line and the first scale line.

[0129] For example, Figure 6 As shown, the computer device can determine the position of the pointer line L1 based on the position information of the pointer tip point b1 and the center point b2 of the dial. In this way, the computer device can determine the second angle θ2 between the position of the pointer line L1 and the position of the first scale line L2.

[0130] Step C4: Determine the value indicated by the pointer in the instrument based on the second angle and the first angle, and the scale values ​​represented by the first scale point and the second scale point.

[0131] In an embodiment of the present application, the computer device can determine the value indicated by the pointer in the instrument based on the second angle and the first angle, and the scale values ​​represented by the first scale point and the second scale point.

[0132] In one possible implementation, when the scale value represented by the first scale point is greater than the scale value represented by the second scale point, the computer device may first calculate a first ratio between the second angle and the first angle, and then calculate a first difference between the scale value represented by the first scale point and the scale value represented by the second scale point. After that, the computer device may use the product of the first difference and the first ratio as a first ratio value. Finally, the computer device may use the difference between the scale value represented by the first scale point and the first ratio value as the value indicated by the pointer in the instrument, which value is the current instrument data of the instrument.

[0133] For example, if the scale value represented by the first scale point is 0.6, the scale value represented by the second scale point is 0.4, the first angle is 20 degrees, and the second angle is 5 degrees, then the first ratio between the second angle and the first angle is 1 / 4. The first difference between the scale value represented by the first scale point and the scale value represented by the second scale point is 0.2, so the first ratio obtained by multiplying the first difference and the first ratio is 0.05. Finally, the difference between the scale value 0.6 represented by the first scale point and the first ratio 0.05 is 0.55, which is the current instrument data of the instrument.

[0134] In another possible implementation, when the scale value represented by the first scale point is smaller than the scale value represented by the second scale point, the computer device may first calculate the second ratio between the second angle and the first angle, and then calculate the second difference between the scale value represented by the second scale point and the scale value represented by the first scale point. After that, the computer device may use the product of the second difference and the second ratio as the second ratio. Finally, the computer device may use the sum of the scale value represented by the first scale point and the second ratio as the value indicated by the pointer in the instrument, which value is the current instrument data of the instrument.

[0135] For example, if the scale value represented by the first scale point is 0.4, the scale value represented by the second scale point is 0.6, the first angle is 20 degrees, and the second angle is 5 degrees, then the second ratio between the second angle and the first angle is 1 / 4. The second difference between the scale value represented by the first scale point and the scale value represented by the second scale point is 0.2, so the second ratio obtained by multiplying the second difference and the second ratio is 0.05. Finally, the sum of the scale value 0.4 represented by the first scale point and the second ratio 0.05 is 0.45, which is the current instrument data of the instrument.

[0136] It should be noted that the order of the steps of the instrument reading method provided in the embodiment of the present application can be appropriately adjusted, and the steps can be increased or decreased accordingly according to the circumstances. Any technician familiar with the technical field can easily think of the changed methods within the technical scope disclosed in the present application, and they should be covered within the scope of protection of the present application, so they will not be repeated here.

[0137] In summary, the meter reading method provided in the embodiment of the present application can determine multiple first key points used to characterize the position of the pointer in the meter and multiple second key points used to characterize the multiple scale values ​​of the meter in the first image after acquiring the first image containing the meter to be read. In this way, even if the meter in the first image is elliptical due to shooting reasons, there is no need to correct the elliptical meter in the first image to a circular meter. The value indicated by the pointer in the meter can be directly read according to the multiple first key points and multiple second key points determined in the first image, and the value is the meter data. In this way, the accuracy of the meter data read can be effectively improved.

[0138] The present application also provides a device for reading an instrument. Figure 7 , Figure 7 300 is a block diagram of a meter reading device provided in an embodiment of the present application. The meter reading device 300 may be integrated in a computer device, and the meter reading device 300 may include:

[0139] The acquisition module 301 is used to acquire a first image including a meter to be read.

[0140] The determination module 302 is used to determine a plurality of first key points and a plurality of second key points in the instrument based on the first image, wherein the plurality of first key points are used to represent the pointer position in the instrument; and the plurality of second key points are used to represent the plurality of scale values ​​of the instrument.

[0141] The reading module 303 is used to read the value indicated by the pointer in the instrument based on the multiple first key points and the multiple second key points.

[0142] In summary, the instrument reading device provided in the embodiment of the present application can determine in the first image a plurality of first key points for characterizing the position of the pointer in the instrument, and a plurality of second key points for characterizing the plurality of scale values ​​of the instrument, after acquiring a first image containing the instrument to be read. In this way, even if the instrument in the first image is elliptical due to shooting reasons, there is no need to correct the elliptical instrument in the first image to a circular instrument. The value indicated by the pointer in the instrument can be directly read based on the plurality of first key points and the plurality of second key points determined in the first image, and the value is the instrument data. In this way, the accuracy of the instrument data read can be effectively improved.

[0143] Optional, such as Figure 8 As shown, Figure 8 303 is a structural block diagram of a reading module provided in an embodiment of the present application. The reading module 303 may include:

[0144] The detection unit 3031 is used to detect whether there is a target second key point among the multiple second key points that coincides with the straight line where the pointer line is located, and the pointer line is a line between the tip point and the center point.

[0145] The first reading unit 3032 is used to read the value indicated by the pointer in the instrument based on the target second key point if there is a target second key point among the multiple second key points.

[0146] The first determining unit 3033 is used to determine two second key points adjacent to the tip point among the multiple second key points if the target second key point does not exist among the multiple second key points.

[0147] The second reading unit 3034 is used to read the value indicated by the pointer in the instrument based on the tip point and the two second key points.

[0148] Optionally, the second reading unit 3034 is used to determine a first angle between a first scale line and a second scale line, where the first scale line is a line between a first scale point and a center point, and the second scale line is a line between a second scale point and a center point; determine a second angle between the pointer line and the first scale line; and determine the value indicated by the pointer in the instrument based on the second angle and the first angle, and the scale values ​​represented by the first scale point and the second scale point.

[0149] Optional, such as Fig. 9 As shown, Fig. 9 302 is a structural block diagram of a determination module provided in an embodiment of the present application. The determination module 302 may include:

[0150] The second determining unit 3021 is used to determine the outer contour of the instrument in the first image.

[0151] The removal unit 3022 is used to remove the background image other than the instrument in the first image based on the outer contour of the instrument to obtain the second image.

[0152] The first acquisition unit 3023 is used to input the second image into the key point extraction model to obtain a plurality of first key points and a plurality of second key points in the instrument output by the key point extraction model.

[0153] Optionally, the meter reading device 300 may further include: a first training module, used to: perform a first training process multiple times on the first initial extraction model to obtain a key point extraction model.

[0154] Among them, each first training process includes: inputting a sample instrument image into the first initial extraction model to obtain multiple key points output by the first initial extraction model; adjusting the model parameters of the first initial extraction model based on the multiple key points output by the first initial extraction model and the multiple label key points corresponding to the sample instrument image.

[0155] Optionally, the reading device 300 of the meter may further include:

[0156] The second acquisition module is used to acquire a plurality of initial images containing instruments.

[0157] The second determining module is used to determine the outer contour of the instrument in each initial image.

[0158] The second acquisition module is used to remove the background image other than the instrument in the initial image based on the outer contour of the instrument in each initial image, so as to obtain multiple sample instrument images corresponding to the multiple initial images.

[0159] The second determination module is used to determine a plurality of label key points corresponding to the sample instrument image based on the pointer position and a plurality of scale values ​​in the instrument in each sample instrument image.

[0160] In summary, the instrument reading device provided in the embodiment of the present application can determine in the first image a plurality of first key points for characterizing the position of the pointer in the instrument, and a plurality of second key points for characterizing the plurality of scale values ​​of the instrument, after acquiring a first image containing the instrument to be read. In this way, even if the instrument in the first image is elliptical due to shooting reasons, there is no need to correct the elliptical instrument in the first image to a circular instrument. The value indicated by the pointer in the instrument can be directly read based on the plurality of first key points and the plurality of second key points determined in the first image, and the value is the instrument data. In this way, the accuracy of the instrument data read can be effectively improved.

[0161] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0162] The present application also provides a computer device. The computer device may include: a processor and a memory. The memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement Figure 1 or Figure 2 Shown is the method for reading the meter.

[0163] The present application also provides a computer storage medium. The computer storage medium stores at least one instruction, at least one program, code set or instruction set, which is loaded and executed by a processor to implement Figure 1 or Figure 2 A method of reading seismic data from an instrument is shown.

[0164] In the present application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The term "plurality" refers to two or more than two, unless otherwise clearly defined.

[0165] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0166] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for reading an instrument, characterized in that: The method comprises: The second initial extraction model is subjected to multiple second training processes to obtain an outer contour extraction model; wherein each second training process includes: inputting an initial sample image into the second initial extraction model to obtain an outline sample image output by the second initial extraction model containing the outer contour of the instrument; adjusting the model parameters of the second initial extraction model based on the outer contour in the outline sample image output by the second initial extraction model and the label outer contour corresponding to the initial sample image; Acquire a plurality of initial sample images including the instrument; Input each of the initial sample images into the outer contour extraction model, so that the outer contour extraction model outputs a corresponding initial sample image containing the outer contour of the instrument; Determine the outer contour of the instrument in each of the initial sample images; Based on the outer contour of the instrument in each of the initial sample images, remove the background image other than the instrument in the initial sample image to obtain a plurality of sample instrument images corresponding to the plurality of initial sample images one by one; Based on the pointer position and multiple scale values ​​in the instrument in each of the sample instrument images, determining multiple label key points corresponding to the sample instrument image; Performing a first training process multiple times on the first initial extraction model to obtain a key point extraction model; wherein each of the first training processes includes: inputting a sample instrument image into the first initial extraction model to obtain a plurality of key points output by the first initial extraction model; adjusting model parameters of the first initial extraction model based on the plurality of key points output by the first initial extraction model and a plurality of label key points corresponding to the sample instrument image; acquiring a first image including a meter to be read; Inputting the first image into the outer contour extraction model to obtain a first image output by the outer contour extraction model that includes the outer contour of the instrument; Based on the outer contour of the instrument, removing the background image other than the instrument in the first image to obtain a second image; Inputting the second image into the key point extraction model, obtaining a plurality of first key points and a plurality of second key points in the instrument output by the key point extraction model, wherein the plurality of first key points are used to represent the pointer position in the instrument; and the plurality of second key points are used to represent a plurality of scale values ​​of the instrument; Based on the plurality of first key points and the plurality of second key points, the value indicated by the pointer in the instrument is read.

2. The method according to claim 1, characterized in that The plurality of first key points include: the tip of the pointer and the center of the dial in the instrument; based on the plurality of first key points and the plurality of second key points, reading the value indicated by the pointer in the instrument includes: Detect whether there is a target second key point among the plurality of second key points that coincides with the straight line where the pointer line is located, wherein the pointer line is a line between the tip point and the center point; If the target second key point exists among the plurality of second key points, reading the value indicated by the pointer in the instrument based on the target second key point; If the target second key point does not exist in the plurality of second key points, determining two second key points adjacent to the tip point in the plurality of second key points; Based on the tip point and the two second key points, the value indicated by the pointer in the instrument is read.

3. The method according to claim 2, characterized in that The two second key points are respectively: a first scale point and a second scale point; Based on the tip point and the two second key points, reading the value indicated by the pointer in the instrument comprises: Determine a first angle between a first scale line and a second scale line, wherein the first scale line is a line between the first scale point and the center point, and the second scale line is a line between the second scale point and the center point; Determine a second angle between the pointer line and the first scale line; Based on the second angle and the first angle, and the scale values ​​represented by the first scale point and the second scale point, a value indicated by the pointer in the instrument is determined.

4. A meter reading device, characterized in that: The device comprises: A module for performing multiple second training processes on the second initial extraction model to obtain an outer contour extraction model; wherein each second training process includes: inputting an initial sample image into the second initial extraction model to obtain an outline sample image output by the second initial extraction model containing the outer contour of the instrument; adjusting the model parameters of the second initial extraction model based on the outer contour in the outline sample image output by the second initial extraction model and the label outer contour corresponding to the initial sample image; A second acquisition module, used for acquiring a plurality of initial sample images including the instrument; A module for inputting each of the initial sample images into the outer contour extraction model, so as to output a corresponding initial sample image containing the outer contour of the instrument through the outer contour extraction model; A second determination module, used to determine the outer contour of the instrument in each of the initial sample images; A module for removing the background image other than the instrument in the initial sample image based on the outer contour of the instrument in each of the initial sample images, so as to obtain a plurality of the sample instrument images corresponding to the plurality of initial sample images one by one; A module for determining a plurality of label key points corresponding to the sample instrument image based on a pointer position and a plurality of scale values ​​in the instrument in each of the sample instrument images; A first training module is used to perform a first training process on the first initial extraction model for multiple times to obtain a key point extraction model; wherein each first training process includes: inputting a sample instrument image into the first initial extraction model to obtain a plurality of key points output by the first initial extraction model; and adjusting model parameters of the first initial extraction model based on the plurality of key points output by the first initial extraction model and a plurality of label key points corresponding to the sample instrument image; An acquisition module, used for acquiring a first image including a meter to be read; A determination module, used for inputting the first image into an outer contour extraction model to obtain a first image output by the outer contour extraction model containing the outer contour of the instrument; removing the background image other than the instrument in the first image based on the outer contour of the instrument to obtain a second image; inputting the second image into a key point extraction model to obtain a plurality of first key points and a plurality of second key points in the instrument output by the key point extraction model, wherein the plurality of first key points are used to represent the pointer position in the instrument; and the plurality of second key points are used to represent a plurality of scale values ​​of the instrument; A reading module is used to read the value indicated by the pointer in the instrument based on the multiple first key points and the multiple second key points.

5. The device according to claim 4, characterized in that The plurality of first key points include: the tip of the pointer and the center of the dial in the instrument; the reading module includes: A detection unit, used to detect whether there is a target second key point among the plurality of second key points that coincides with the straight line where the pointer line is located, wherein the pointer line is a line between the tip point and the center point; a first reading unit, configured to read a value indicated by a pointer in the instrument based on the target second key point if the target second key point exists among the plurality of second key points; A first determining unit, configured to determine two second key points adjacent to the tip point from among the plurality of second key points if the target second key point does not exist in the plurality of second key points; The second reading unit is used to read the value indicated by the pointer in the instrument based on the tip point and the two second key points.

6. The device according to claim 5, characterized in that The two second key points are respectively: a first scale point and a second scale point; the reading unit is used for: Determine a first angle between a first scale line and a second scale line, wherein the first scale line is a line between the first scale point and the center point, and the second scale line is a line between the second scale point and the center point; Determine a second angle between the pointer line and the first scale line; Based on the second angle and the first angle, and the scale values ​​represented by the first scale point and the second scale point, a value indicated by the pointer in the instrument is determined.

7. A computer storage medium, characterized in that: The computer storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the instrument reading method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Image processing method for reading pointer type instrument indication value

    CN101650198A

  • SF6 instrument image reading method based on HRNet network model

    CN111582071A

  • Intelligent instrument reading method and device based on key point identification, equipment and medium

    CN116188960A

  • Meter identification method and apparatus, and electronic device and storage medium

    WO2023060574A1