Method, apparatus, equipment and medium for generating standard templates for electricity meter code interruption display

By combining image registration and convolutional neural networks, standard templates for meter code breakage screens are automatically generated, solving the problems of low efficiency and high cost in existing technologies, and realizing efficient and low-cost template production and detection.

CN117173223BActive Publication Date: 2025-10-31HANGZHOU DECHUANG ELECTRONICS +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311125040.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-01
Publication Date
2025-10-31
Estimated Expiration
2043-09-01

AI Technical Summary

Technical Problem

In the existing technology, the secondary production of standard templates for meter code breakage screens is inefficient and costly, and cannot adapt to the subtle differences between different manufacturers and batches, resulting in low efficiency and poor economic benefits for manual inspection.

Method used

A method combining image registration algorithm and convolutional neural network is adopted. By acquiring the target image of the fault code screen of the meter under test and the reference standard template, the label information is projected onto the target image using perspective transformation matrix, and character segmentation is performed based on character box position information to automatically generate the standard template.

Benefits of technology

It enables the automated generation of standard templates, improves the efficiency of secondary production, reduces labor costs, and ensures the standardization and testing efficiency of templates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117173223B_ABST
    Figure CN117173223B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and medium for generating a standard template for a meter code breakage display, relating to the field of image processing. The method includes: acquiring a first target image of the meter code breakage display to be tested and a reference standard template of a reference meter code breakage display corresponding to the meter code breakage display; wherein the reference standard template includes a source image and label information; registering the first target image and the source image based on an image registration algorithm to obtain a perspective transformation matrix; projecting the label information onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information; and performing character segmentation on the second target image based on the character frame position information in the projected label information to obtain character images and corresponding character names, so as to generate and save the standard template for the meter code breakage display to be tested. This method can improve the efficiency and standardization of secondary production of standard templates and reduce production costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing, and in particular to a method, apparatus, device, and medium for generating standard templates for electricity meter code breakage displays. Background Technology

[0002] The character display screen is a crucial component of smart meters, showcasing user electricity consumption information and grid status. Therefore, its inspection is a vital part of smart meter quality control. During meter manufacturing, improper operation by personnel can sometimes cause issues such as incomplete or blurred character display on the character display screen, leading to incorrect electricity consumption information. Therefore, rigorous character display defect testing of the character display screen is necessary before using the meter.

[0003] Current defect detection methods are mainly divided into manual inspection and automatic inspection. Manual inspection is slow, inefficient, consumes a lot of human resources, and has low economic benefits, and has been gradually phased out. Automatic inspection currently uses template matching, which involves creating standard templates for all characters on the broken code display, comparing the image of the character to be tested with the standard templates, calculating the similarity between the two images, and setting a threshold. Only when the similarity exceeds the threshold is the character considered defect-free. Therefore, the prerequisite for defect detection on broken code displays in electricity meters is the creation of a standard template for the meter. Currently, the main methods for creating standard templates are manual production and semi-automatic generation. However, even for meters of the same type and model, and all conforming to the same national standard, there are still slight differences between meters produced by different manufacturers and in different batches. Therefore, the created templates cannot be completely universal, and a second template must be created for each batch of meters, i.e., remade. This method of starting from scratch is inefficient and costly.

[0004] In summary, improving the efficiency and standardization of secondary production of standard templates, and reducing production costs are problems that need to be solved in this field. Summary of the Invention

[0005] In view of this, the purpose of this invention is to provide a method, apparatus, equipment, and medium for generating standard templates for electricity meter code breakage displays, which can improve the efficiency and standardization of secondary production of standard templates and reduce production costs. The specific solution is as follows:

[0006] In the first aspect, this application discloses a method for generating a standard template for a meter's fault code display, including:

[0007] Acquire the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test; wherein, the reference standard template includes the source image and label information;

[0008] The first target image and the source image are registered based on an image registration algorithm to obtain a perspective transformation matrix;

[0009] The label information is projected onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information;

[0010] Based on the character frame position information in the projected label information, the second target image is segmented to obtain a character image and the corresponding character name;

[0011] A standard template for the broken code screen of the meter under test is generated and saved based on the projected label information, the character image, and the character name.

[0012] Optionally, acquiring the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test includes:

[0013] Acquire the first target image of the broken code screen of the meter under test;

[0014] The electricity meter with the same type and layout as the test interruption screen and which displays normally is identified as the reference electricity meter interruption screen, and the reference standard template of the reference electricity meter interruption screen is obtained.

[0015] Optionally, the step of registering the first target image and the source image based on the image registration algorithm to obtain a perspective transformation matrix includes:

[0016] The first target image and the source image are determined as input images, and a three-dimensional tensor of the input image is obtained based on a convolutional neural network; wherein, the convolutional neural network contains several feature detection functions;

[0017] The corresponding feature descriptor is obtained based on the three-dimensional tensor, and several feature maps of the input image are obtained based on the convolutional neural network in order to determine the feature points;

[0018] The feature points are clustered using the KNN algorithm to obtain highly significant clustering results. The highly significant clustering results are then matched using the RANSAC algorithm to obtain final matched feature point pairs. Finally, the perspective transformation matrix of the final matched feature point pairs is calculated using the RANSAC algorithm.

[0019] Optionally, the step of obtaining the corresponding feature descriptor based on the three-dimensional tensor and acquiring several feature maps of the input image based on the convolutional neural network to determine feature points includes:

[0020] The corresponding feature descriptor is obtained based on the three-dimensional tensor, and several feature maps of the input image are obtained based on the convolutional neural network.

[0021] The feature descriptor is normalized to obtain a normalized feature descriptor;

[0022] Each gray value of the normalized feature descriptor is calculated using the respective feature detection functions, and the largest target gray value is determined from the gray values. It is then determined whether the target gray value is a local maximum in the corresponding feature map. If so, the feature descriptor is determined as a feature point.

[0023] Optionally, the step of projecting the label information onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information includes:

[0024] The center point coordinates and top-left corner coordinates of the character box in the source image are calculated based on the label information. The center point coordinates and top-left corner coordinates are then projected onto the first target image using the perspective transformation matrix to obtain the projected center point coordinates and top-left corner coordinates.

[0025] The coordinates of the center point and the coordinates of the top left corner after projection are converted into projection label information in a preset standard format to obtain a second target image containing the projection label information.

[0026] Optionally, the step of projecting the center point coordinates and the upper left corner coordinates onto the first target image using the perspective transformation matrix to obtain the projected center point coordinates and the projected upper left corner coordinates includes:

[0027] Obtain the first product of the perspective transformation matrix and the center point coordinates, and the second product of the perspective transformation matrix and the top left corner coordinates, and determine the first product and the second product as the center point coordinates and the top left corner coordinates after projection, respectively.

[0028] Secondly, this application discloses a standard template generation device for an electricity meter code interruption screen, comprising:

[0029] The template acquisition module is used to acquire the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test; wherein, the reference standard template includes the source image and label information;

[0030] The image registration module is used to register the first target image and the source image based on an image registration algorithm to obtain a perspective transformation matrix;

[0031] The label projection module is used to project the label information onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information;

[0032] The image segmentation module is used to segment the second target image based on the character frame position information in the projected label information to obtain a character image and the corresponding character name;

[0033] The template generation module is used to generate and save a standard template for the broken code screen of the meter under test based on the projected label information, the character image and the character name.

[0034] Thirdly, this application discloses an electronic device, including:

[0035] Memory, used to store computer programs;

[0036] A processor is used to execute the computer program to implement the steps of the aforementioned method for generating a standard template for a broken code display of an electricity meter.

[0037] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the aforementioned disclosed standard template generation method for electricity meter code break screens.

[0038] The beneficial effects of this application are as follows: A first target image of the fault code display screen of the meter under test and a reference standard template of the fault code display screen of a reference meter corresponding to the fault code display screen of the meter under test are obtained; wherein, the reference standard template includes a source image and label information; the first target image and the source image are registered based on an image registration algorithm to obtain a perspective transformation matrix; the label information is projected onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information; the second target image is segmented based on the character frame position information in the projected label information to obtain a character image and a corresponding character name; a standard template of the fault code display screen of the meter under test is generated and saved based on the projected label information, the character image, and the character name. Therefore, after obtaining the first target image of the fault code display of the meter under test and the reference standard template of the corresponding fault code display of the reference meter under test, this application can automatically project the tag information onto the first target image to obtain a second target image containing the projected tag information. Then, based on the character frame position information in the projected tag information, the application can automatically obtain the character image and the corresponding character name after character segmentation of the second target image. In this way, a standard template of the fault code display of the meter under test can be generated based on the projected tag information, character image and character name, and the standard template can be saved. Because this application automatically generates the standard template, it does not require a lot of manual labor, so it can improve the efficiency and standardization of secondary production of the standard template and reduce the production cost. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0040] Figure 1 This application discloses a flowchart of a method for generating a standard template for a meter code break screen.

[0041] Figure 2 This application discloses a specific example of an electrical representation after character annotation.

[0042] Figure 3 This is a schematic diagram of a specific standard template for a broken code screen disclosed in this application;

[0043] Figure 4 This application discloses a flowchart of a specific method for generating a standard template for a broken code display screen of an electricity meter.

[0044] Figure 5A flowchart illustrating another specific method for generating a standard template for a broken code display screen for electricity meters disclosed in this application;

[0045] Figure 6 This is a schematic diagram of a standard template generation device for a broken code display of an electricity meter, as disclosed in this application.

[0046] Figure 7 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation

[0047] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0048] Current defect detection methods are mainly divided into manual inspection and automatic inspection. Manual inspection is slow, inefficient, consumes a lot of human resources, and has low economic benefits, and has been gradually phased out. Automatic inspection currently uses template matching, which involves creating standard templates for all characters on the broken code display, comparing the image of the character to be tested with the standard templates, calculating the similarity between the two images, and setting a threshold. Only when the similarity exceeds the threshold is the character considered defect-free. Therefore, the prerequisite for defect detection on broken code displays in electricity meters is the creation of a standard template for the meter. Currently, the main methods for creating standard templates are manual production and semi-automatic generation. However, even for meters of the same type and model, and all conforming to the same national standard, there are still slight differences between meters produced by different manufacturers and in different batches. Therefore, the created templates cannot be completely universal, and a second template must be created for each batch of meters, i.e., remade. This method of starting from scratch is inefficient and costly.

[0049] Therefore, this application provides a standard template generation scheme for electricity meter code break screens, which can improve the efficiency and standardization of secondary production of standard templates and reduce production costs.

[0050] See Figure 1 As shown in the figure, this application discloses a standard template generation device for electricity meter code break screens, including:

[0051] Step S11: Obtain the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test; wherein, the reference standard template includes the source image and label information.

[0052] In this embodiment, the step of acquiring the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test includes: acquiring the first target image of the broken code screen of the meter under test; identifying the broken code screen of the meter that is the same as the broken code screen of the meter under test in terms of type and layout and displays normally as the reference broken code screen, and acquiring the reference standard template of the reference broken code screen. Electricity meter code break screens are categorized into single-phase and three-phase types, with each type further divided into version 13 and version 20. Therefore, when acquiring the first target image of the code break screen of the meter under test, it is necessary to determine the type and version of the code break screen. A code break screen of the meter under test that is of the same type and version and displays normally is designated as the reference code break screen. For example, if the code break screen of the meter under test is single-phase and version 13, then the reference code break screen should also be single-phase and version 13. A fixed camera with a resolution of 2 megapixels and an imaging height of 0.5m is used to vertically image the normally displaying reference code break screen to obtain the meter image of the reference code break screen. In this embodiment, the type and version of the code break screen of the meter under test are not restricted, as long as the type and version of the reference code break screen are consistent.

[0053] The process of creating a reference standard template includes: using the Labelimg tool to annotate the broken code screen area of ​​the electricity meter image with characters, obtaining the corresponding source image and label information containing character category information, normalized x-coordinate of the character box center point, normalized y-coordinate of the character box center point, normalized character box width, and normalized character box height. It can be understood that the reference standard template for the broken code screen is known; the annotation process is simply obtaining the reference standard template. In other words, only one reference standard template needs to be created, and subsequent standard templates for the broken code screen of the electricity meter under test can be directly obtained using this template. The specific annotation method is as follows: for example... Figure 2 The diagram shows a specific example of a labeled electronic representation. A rectangle is used to select the characters; this is called a character box. The character boxes are named after the characters; for example, "L x" nc y nc w n h n The format saves the tag information, where L represents the character category information of the referenced fragment screen, and x... nc This represents the normalized X and Y coordinates of the center point of the character box in the reference broken screen. nc This represents the normalized Y-coordinate and w-coordinate of the center point of the character box in the reference broken screen. n This indicates the normalized character box width and h of the reference broken screen. n This indicates the normalized character box height of the reference broken screen.

[0054] Step S12: Register the first target image and the source image based on the image registration algorithm to obtain the perspective transformation matrix.

[0055] The process of creating a standard template for the broken code screen under test is the template migration process, which involves migrating the standard template of the reference broken code screen to the broken code screen under test. In other words, the label information of the reference broken code screen is projected onto the broken code screen under test. Therefore, it is necessary to obtain the projection transformation relationship, that is, to register the first target image and the source image based on the image registration algorithm to obtain the perspective transformation matrix.

[0056] Step S13: Project the label information onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information.

[0057] In this embodiment, the perspective transformation matrix is ​​used to transform the label information "L x nc y nc w n h n "Converted to the "L x' of the screen under test" nc y′ nc w′ n h′ n The label information, which includes "character category information of the reference broken code screen, X coordinate of the normalized character box center point of the reference broken code screen, Y coordinate of the normalized character box center point of the reference broken code screen, normalized character box width of the reference broken code screen, and normalized character box height of the reference broken code screen", will be converted into projected label information containing "character category information of the broken code screen to be tested, X coordinate of the normalized character box center point of the broken code screen to be tested, Y coordinate of the normalized character box center point of the broken code screen to be tested, normalized character box width of the broken code screen to be tested, and normalized character box height of the broken code screen to be tested".

[0058] Step S14: Perform character segmentation on the second target image based on the character frame position information in the projected label information to obtain a character image and the corresponding character name.

[0059] The "X coordinate of the center point of the normalized character frame of the screen to be tested, Y coordinate of the center point of the normalized character frame of the screen to be tested, width of the normalized character frame of the screen to be tested, and height of the normalized character frame of the screen to be tested" in the label information after projection are the character frame position information. Based on the character frame position information, the second target image is segmented to obtain several character images and corresponding character names.

[0060] Step S15: Generate and save a standard template for the broken code screen of the meter under test based on the projected label information, the character image and the character name.

[0061] Understandably, the standard template for the meter under test's code display consists of projected label information, character images, and character names, for example... Figure 3 The diagram shows a specific standard template for a fault code display. The character type information in the tag information after projection represents the type and version of the fault code display to be tested. When storing the standard template of the fault code display of the meter under test according to type and version, the character images of each character in the standard template can be stored according to character name.

[0062] The beneficial effects of this application are as follows: A first target image of the fault code display screen of the meter under test and a reference standard template of the fault code display screen of a reference meter corresponding to the fault code display screen of the meter under test are obtained; wherein, the reference standard template includes a source image and label information; the first target image and the source image are registered based on an image registration algorithm to obtain a perspective transformation matrix; the label information is projected onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information; the second target image is segmented based on the character frame position information in the projected label information to obtain a character image and a corresponding character name; a standard template of the fault code display screen of the meter under test is generated and saved based on the projected label information, the character image, and the character name. Therefore, after obtaining the first target image of the fault code display of the meter under test and the reference standard template of the corresponding fault code display of the reference meter under test, this application can automatically project the tag information onto the first target image to obtain a second target image containing the projected tag information. Then, based on the character frame position information in the projected tag information, the application can automatically obtain the character image and the corresponding character name after character segmentation of the second target image. In this way, a standard template of the fault code display of the meter under test can be generated based on the projected tag information, character image and character name, and the standard template can be saved. Because this application automatically generates the standard template, it does not require a lot of manual labor, so it can improve the efficiency and standardization of secondary production of the standard template and reduce the production cost.

[0063] See Figure 4 As shown in the figure, this application discloses a specific standard template generation device for electricity meter code interruption screens, including:

[0064] Step S21: Obtain the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test; wherein, the reference standard template includes the source image and label information.

[0065] Step S22: Determine the first target image and the source image as input images, and obtain the three-dimensional tensor of the input image based on a convolutional neural network; wherein the convolutional neural network contains several feature detection functions.

[0066] The first target image and the source image are determined as input image I, and a Convolutional Neural Network (CNN) is applied. Obtain the three-dimensional tensor F of the input image I, where, h×w represents the spatial resolution of the feature map, and n represents the number of channels in a convolutional neural network. It can be viewed as a feature extraction function Feature extraction function It includes several different feature detection functions. A three-dimensional tensor F consists of n feature maps.

[0067] Step S23: Obtain the corresponding feature descriptor based on the three-dimensional tensor, and obtain several feature maps of the input image based on the convolutional neural network in order to determine the feature points.

[0068] In this embodiment, the step of obtaining the corresponding feature descriptor based on the three-dimensional tensor and acquiring several feature maps of the input image based on the convolutional neural network to determine feature points includes: obtaining the corresponding feature descriptor based on the three-dimensional tensor and acquiring several feature maps of the input image based on the convolutional neural network; normalizing the feature descriptor to obtain a normalized feature descriptor; calculating each gray value of the normalized feature descriptor using each of the feature detection functions, determining the largest target gray value from the gray values, and determining whether the target gray value is a local maximum in the corresponding feature map. If so, the feature descriptor is determined as a feature point. The specific process for determining feature points is as follows:

[0069] 1) Obtain the corresponding feature descriptor d based on the three-dimensional tensor F. ij , where d ij =F ij , i = 1, ..., h; j = 1, ..., w, the feature descriptor is a feature description vector, which is composed of the elements at position (i, j) of the feature map of each layer of the three-dimensional tensor F.

[0070] 2) Based on convolutional neural networks Obtain several feature maps D of the input image I k , where D k =F ::k , Convolutional Neural Networks It can be viewed as a feature extraction function Feature extraction function It includes several different feature detection functions. Each feature detection function The two-dimensional feature map D is obtained by calculating the input image I. k .

[0071] It is important to note that the feature descriptor d is obtained. ij and feature map D k These are two different perspectives, meaning the feature descriptor d was acquired simultaneously. ij and feature map D k .

[0072] 3) For feature descriptor d ij Normalization is performed to obtain normalized feature descriptors. For example, using the L2 norm for normalization:

[0073] 4) Calculate the gray values ​​of the normalized feature descriptors using various feature detection functions, identify the largest target gray value from among these gray values, and determine whether the target gray value is a local maximum in the corresponding feature map. If so, the feature descriptor is identified as a feature point. It is understandable that there will be several feature maps, each containing several pixels, i.e., several normalized feature descriptors. The specific process for determining feature points is as follows:

[0074] First, it is necessary to calculate the optimal feature detection function for each normalized feature descriptor. This involves using each feature detection function to calculate the gray values ​​of the current normalized feature descriptor, and then selecting the largest gray value from all the gray values ​​of the current normalized feature descriptor as the target gray value. The corresponding feature detection function is the optimal feature detection function for the current normalized feature descriptor. In this way, the optimal feature detection function and target gray value for each normalized feature descriptor can be obtained.

[0075] Secondly, it is necessary to determine whether each normalized feature descriptor is a feature point based on the target gray value. That is, to determine whether the target gray value of the current normalized feature descriptor is the local maximum value of the feature map in which it is located. If it is, then the current normalized feature descriptor is a feature point; otherwise, the current normalized feature descriptor is not a feature point. In this way, we can determine whether each normalized feature descriptor is a feature point in order to obtain all the feature points.

[0076] In existing technologies, sparse matching generally employs a method of first detecting feature points and then describing them. That is, feature points are first obtained through a feature detector (the extracted feature points are sparse), and then feature descriptors are obtained based on the pixels surrounding the feature points. Since directly using a feature detector only utilizes shallow image information, it may fail to accurately extract feature points or extract incorrect feature points for low-texture areas of the image or for repetitive scenes (such as repeated characters).

[0077] In this embodiment, a feature map is calculated from the source image using a CNN. Feature points are detected based on the deep information of the feature map and the extracted descriptors. The detected feature points are pixels with different descriptors in local areas. This is a dense extraction method, where each feature point has its own unique feature descriptor (even in repetitive scenes), thus facilitating image matching.

[0078] Step S24: Cluster the feature points using the KNN algorithm to obtain highly significant clustering results, and match the highly significant clustering results using the RANSAC algorithm to obtain the final matched feature point pairs. Then, use the RANSAC algorithm to calculate the perspective transformation matrix of the final matched feature point pairs.

[0079] In this embodiment, the feature points are first coarsely matched using the KNN algorithm (K-Nearest Neighbor), and the highly significant matching results are retained. The coarse matching process involves clustering, retaining highly significant matching results, and removing feature points that cannot be clustered. Then, the highly significant matching results are finely matched using the RANSAC algorithm (Random Sample Consensus) to obtain the final matched feature point pairs. Finally, the optimal single mapping transformation matrix H, i.e., the perspective transformation matrix H, is calculated using the RANSAC method for the final matched feature point pairs.

[0080] Step S25: Project the label information onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information.

[0081] Step S26: Perform character segmentation on the second target image based on the character frame position information in the projected label information to obtain a character image and the corresponding character name.

[0082] Step S27: Generate and save a standard template for the broken code screen of the meter under test based on the projected label information, the character image and the character name.

[0083] As can be seen, this application simultaneously extracts feature descriptors and feature maps, improving the registration performance and accuracy of meter code break screen images. It also has higher adaptability to different on-site lighting conditions and stronger versatility. The new feature point matching method based on KNN+RANSAC can extract all obvious feature points as much as possible, while avoiding the extraction of feature points caused by noise or inconspicuous feature points, resulting in better results.

[0084] See Figure 5 As shown in the embodiment of this application, another specific standard template generation device for electricity meter code interruption screens is disclosed, including:

[0085] Step S31: Obtain the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test; wherein, the reference standard template includes the source image and label information.

[0086] Let the source image resolution be w×h, and the label information be "L x nc y nc w n h n The format is "the character category information of the reference broken code screen, the X coordinate of the center point of the normalized character box of the reference broken code screen, the Y coordinate of the center point of the normalized character box of the reference broken code screen, the width of the normalized character box of the reference broken code screen, and the height of the normalized character box of the reference broken code screen".

[0087] Step S32: Register the first target image and the source image based on the image registration algorithm to obtain the perspective transformation matrix.

[0088] Step S33: Calculate the center point coordinates and top left corner coordinates of the character box in the source image based on the label information, and use the perspective transformation matrix to project the center point coordinates and top left corner coordinates onto the first target image to obtain the projected center point coordinates and top left corner coordinates.

[0089] In this embodiment, the step of projecting the center point coordinates and the top-left corner coordinates onto the first target image using the perspective transformation matrix to obtain the projected center point coordinates and the projected top-left corner coordinates includes: obtaining the first product of the perspective transformation matrix and the center point coordinates and the second product of the perspective transformation matrix and the top-left corner coordinates, and determining the first product and the second product as the projected center point coordinates and the projected top-left corner coordinates, respectively. The specific projection process is as follows:

[0090] 1) Calculate the coordinates (x, y) of the center point of the rectangular character box in the source image. c y c ) and the coordinates of the top left corner (x ay a ), where x c =x nc ×w,y c =y nc ×h,

[0091] 2) Obtain the first product (x′) of the perspective transformation matrix and the center point coordinates. c y′ c ) and the second product (x′) of the perspective transformation matrix and the coordinates of the top left corner. a y′ a The first and second products are then used to determine the coordinates (x′) of the center point after projection. c y′ c ), the coordinates of the top left corner after projection (x′) a y′ a ).

[0092] The transformation process can be viewed as first projecting the two-dimensional coordinates (x, y) onto a three-dimensional coordinate system, and then converting them back to two-dimensional coordinates (x′, y′):

[0093]

[0094] In the formula, a1, a2, a3, b1, b2, b3, c1, c2, and c3 are elements of the perspective transformation matrix, representing constants. X, Y, and Z are only intermediate values ​​in the calculation. They can be understood as projecting the two-dimensional coordinates (x, y) onto the three-dimensional coordinates (X, Y, Z) in the three-dimensional coordinate system, and using the Z value to convert the three-dimensional coordinates into two-dimensional coordinates.

[0095]

[0096] Step S34: Convert the coordinates of the center point and the coordinates of the upper left corner after projection into projection label information in a preset standard format to obtain a second target image containing the projection label information.

[0097] The coordinates (x′) of the center point of the resulting rectangular character box in the target image (w′×h′) are determined. c y′ c ) and the coordinates of the top left corner (x′) a y′ a Convert to standard format character tags: Lx′ nc y′ nc w′ n h′ nSpecifically, this involves "the character category information of the screen to be tested, the normalized X-coordinate of the center point of the character frame of the screen to be tested, the normalized Y-coordinate of the center point of the character frame of the screen to be tested, the normalized width of the character frame of the screen to be tested, and the normalized height of the character frame of the screen to be tested," to obtain the projected label information and a second target image containing the projected label information. It is important to note that the character category information L remains unchanged.

[0098] Step S35: Perform character segmentation on the second target image based on the character frame position information in the projected label information to obtain a character image and the corresponding character name.

[0099] Step S36: Generate and save a standard template for the broken code screen of the meter under test based on the projected label information, the character image and the character name.

[0100] As can be seen, this application automatically generates standard templates, thus reducing the standard template production time from 20 minutes for manual production to less than 1 minute for automatic generation. The output standard template for meter code breakage screen is of comparable quality to that of manual production, meeting the requirements for online testing, greatly improving the efficiency of meter defect detection and saving human resources.

[0101] See Figure 6 As shown in the figure, this application discloses a standard template generation device for electricity meter code break screens, including:

[0102] The template acquisition module 11 is used to acquire the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test; wherein, the reference standard template includes the source image and label information;

[0103] Image registration module 12 is used to register the first target image and the source image based on an image registration algorithm to obtain a perspective transformation matrix;

[0104] The label projection module 13 is used to project the label information onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information;

[0105] Image segmentation module 14 is used to segment the second target image based on the character frame position information in the projected label information to obtain a character image and the corresponding character name;

[0106] The template generation module 15 is used to generate and save a standard template for the broken code screen of the meter under test based on the projected label information, the character image and the character name.

[0107] The beneficial effects of this application are as follows: A first target image of the fault code display screen of the meter under test and a reference standard template of the fault code display screen of a reference meter corresponding to the fault code display screen of the meter under test are obtained; wherein, the reference standard template includes a source image and label information; the first target image and the source image are registered based on an image registration algorithm to obtain a perspective transformation matrix; the label information is projected onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information; the second target image is segmented based on the character frame position information in the projected label information to obtain a character image and a corresponding character name; a standard template of the fault code display screen of the meter under test is generated and saved based on the projected label information, the character image, and the character name. Therefore, after obtaining the first target image of the fault code display of the meter under test and the reference standard template of the corresponding fault code display of the reference meter under test, this application can automatically project the tag information onto the first target image to obtain a second target image containing the projected tag information. Then, based on the character frame position information in the projected tag information, the application can automatically obtain the character image and the corresponding character name after character segmentation of the second target image. In this way, a standard template of the fault code display of the meter under test can be generated based on the projected tag information, character image and character name, and the standard template can be saved. Because this application automatically generates the standard template, it does not require a lot of manual labor, so it can improve the efficiency and standardization of secondary production of the standard template and reduce the production cost.

[0108] Furthermore, embodiments of this application also provide an electronic device. Figure 7 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.

[0109] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the standard template generation method for the electricity meter code break screen disclosed in any of the foregoing embodiments.

[0110] In this embodiment, the power supply 23 is used to provide operating voltage for various hardware devices on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0111] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0112] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored on it include operating system 221, computer program 222 and data 223, etc., and the storage method can be temporary storage or permanent storage.

[0113] The operating system 221 manages and controls the various hardware devices and computer programs 222 on the electronic device to enable the processor 21 to perform calculations and processing on the massive amounts of data 223 in the memory 22. The operating system can be Windows, Unix, Linux, etc. The computer program 222, in addition to including a computer program capable of performing the standard template generation method for the meter fault code screen disclosed in any of the foregoing embodiments, may further include computer programs capable of performing other specific tasks. The data 223 may include data received by the electronic device from external devices, as well as data collected by its own input / output interface 25.

[0114] Furthermore, this application also discloses a computer-readable storage medium storing a computer program. When the computer program is loaded and executed by a processor, it implements the method steps performed during the generation process of the standard template of the electricity meter code interruption screen disclosed in any of the foregoing embodiments.

[0115] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0116] The above provides a detailed description of the standard template generation method, apparatus, equipment, and medium for a meter code break screen provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for generating a standard template for a meter's broken code display, characterized in that, include: Acquire the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test; wherein, the reference standard template includes the source image and label information; The first target image and the source image are registered based on an image registration algorithm to obtain a perspective transformation matrix; The label information is projected onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information; Based on the character frame position information in the projected label information, the second target image is segmented to obtain a character image and the corresponding character name; wherein, the character frame position information includes the normalized X coordinate of the character frame center point of the screen to be tested, the normalized Y coordinate of the character frame center point of the screen to be tested, the normalized character frame width of the screen to be tested, and the normalized character frame height of the screen to be tested. A standard template for the broken code screen of the meter under test is generated and saved based on the projected label information, the character image and the character name. The image registration algorithm is used to register the first target image and the source image to obtain a perspective transformation matrix, including: The first target image and the source image are determined as input images. A three-dimensional tensor of the input image is obtained based on a convolutional neural network. The corresponding feature descriptor is obtained based on the three-dimensional tensor, and several feature maps of the input image are obtained based on the convolutional neural network to determine feature points. The feature points are clustered using the KNN algorithm to obtain highly significant clustering results. The highly significant clustering results are matched using the RANSAC algorithm to obtain final matching feature point pairs. The perspective transformation matrix of the final matching feature point pairs is then calculated using the RANSAC algorithm. The process of obtaining the corresponding feature descriptor based on the three-dimensional tensor and acquiring several feature maps of the input image based on the convolutional neural network to determine feature points includes: The corresponding feature descriptor is obtained based on the three-dimensional tensor, and several feature maps of the input image are obtained based on the convolutional neural network; the feature descriptor is normalized to obtain a normalized feature descriptor; each gray value of the normalized feature descriptor is calculated using each of the feature detection functions, and the largest target gray value is determined from each gray value. It is then determined whether the target gray value is a local maximum in the corresponding feature map. If so, the feature descriptor is determined as a feature point.

2. The method for generating a standard template for a meter code break screen according to claim 1, characterized in that, The process of acquiring the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test includes: Acquire the first target image of the broken code screen of the meter under test; The electricity meter with the same type and layout as the test interruption screen and which displays normally is identified as the reference electricity meter interruption screen, and the reference standard template of the reference electricity meter interruption screen is obtained.

3. The method for generating a standard template for a meter code break screen according to claim 1, characterized in that, The convolutional neural network contains several feature detection functions.

4. The method for generating a standard template for a meter code break screen according to claim 1, characterized in that, The step of projecting the label information onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information includes: The center point coordinates and top-left corner coordinates of the character box in the source image are calculated based on the label information. The center point coordinates and top-left corner coordinates are then projected onto the first target image using the perspective transformation matrix to obtain the projected center point coordinates and top-left corner coordinates. The coordinates of the center point and the coordinates of the top left corner after projection are converted into projection label information in a preset standard format to obtain a second target image containing the projection label information.

5. The method for generating a standard template for a meter code break screen according to claim 4, characterized in that, The step of projecting the center point coordinates and the top-left corner coordinates onto the first target image using the perspective transformation matrix to obtain the projected center point coordinates and the projected top-left corner coordinates includes: Obtain the first product of the perspective transformation matrix and the center point coordinates, and the second product of the perspective transformation matrix and the top left corner coordinates, and determine the first product and the second product as the center point coordinates and the top left corner coordinates after projection, respectively.

6. A standard template generation device for an electricity meter code break screen, characterized in that, include: The template acquisition module is used to acquire the first target image of the broken code screen of the meter under test and the reference standard template of the broken code screen of the reference meter corresponding to the broken code screen of the meter under test; wherein, the reference standard template includes the source image and label information; The image registration module is used to register the first target image and the source image based on an image registration algorithm to obtain a perspective transformation matrix; The label projection module is used to project the label information onto the first target image using the perspective transformation matrix to obtain a second target image containing the projected label information; The image segmentation module is used to segment the second target image based on the character frame position information in the projected label information to obtain a character image and the corresponding character name; wherein, the character frame position information includes the normalized X coordinate of the character frame center point of the screen to be tested, the normalized Y coordinate of the character frame center point of the screen to be tested, the normalized character frame width of the screen to be tested, and the normalized character frame height of the screen to be tested. The template generation module is used to generate and save a standard template for the broken code screen of the meter under test based on the projected label information, the character image and the character name; The image registration module is specifically used for: The first target image and the source image are determined as input images. A three-dimensional tensor of the input image is obtained based on a convolutional neural network. The corresponding feature descriptor is obtained based on the three-dimensional tensor, and several feature maps of the input image are obtained based on the convolutional neural network to determine feature points. The feature points are clustered using the KNN algorithm to obtain highly significant clustering results. The highly significant clustering results are matched using the RANSAC algorithm to obtain final matching feature point pairs. The perspective transformation matrix of the final matching feature point pairs is then calculated using the RANSAC algorithm. The image registration module is specifically used for: The corresponding feature descriptor is obtained based on the three-dimensional tensor, and several feature maps of the input image are obtained based on the convolutional neural network; the feature descriptor is normalized to obtain a normalized feature descriptor; each gray value of the normalized feature descriptor is calculated using each of the feature detection functions, and the largest target gray value is determined from each gray value. It is then determined whether the target gray value is a local maximum in the corresponding feature map. If so, the feature descriptor is determined as a feature point.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor is configured to execute the computer program to implement the steps of the standard template generation method for the electricity meter code break screen as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein, when the computer programs are executed by a processor, they implement the steps of the standard template generation method for the electricity meter code break screen as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Self-adaptive method and system for rapidly generating OCR (optical character recognition) training sample

    CN106778730A

  • Method for detecting illlegal pornographic video

    KR102166392B1