Electricity meter communication card number identification and vertical extraction method and system
By combining object detection and optical character recognition technology, identifying and extracting the electric meter communication card number, the problems of low recognition success rate and poor generalization in the prior art are solved, and higher recognition accuracy and system robustness are achieved.
Patent Information
- Application Number
- CN202510409141.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-04-02
AI Technical Summary
The prior art is difficult to effectively identify and extract the power meter communication card number, especially in the case of changes in typesetting and noise interference, resulting in low recognition success rate and poor generalization.
Combining object detection technology and optical character recognition (OCR) technology, we can crop detection results, locate the reference detection frame with constant characteristics and the remaining detection frames, and extract the card number based on the sorting results.
It significantly improves the recognition success rate of the meter communication card number, reduces the interference of background noise, enhances the robustness and generalization capabilities of the system, and is suitable for improving automation and operation and maintenance efficiency in the power industry.
Smart Images

Figure CN119919943A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of electric meter communication card number recognition, in particular to an electric meter communication card number recognition and vertical extraction method and system. Background Art
[0002] With the rapid development of intelligent technology, the power industry is undergoing a transformation from traditional meter reading methods to low-voltage remote centralized meter reading systems. This new meter reading system uses wireless technology provided by communication operators for data transmission, which has significant advantages such as saving labor costs and improving accuracy. However, in the scenario of new installation and replacement of electric meters, the realization of meter traceability management and remote meter reading based on communication card numbers still requires manual reading of card numbers and manual recording and uploading to the system. This process is not only inefficient, but also has problems such as wrong card number copying, missing copying, and repetitive labor.
[0003] Traditional card recognition methods mainly rely on digital image processing and template matching technology, locating the card position in the image through operations such as grayscale conversion, binarization, edge detection, or features such as shape and color, and then identifying the characters by comparing the similarity of character templates. Although this method works well when facing text with standardized formats and less noise, it needs to constantly update the character template in the case of typesetting changes and noise interference, resulting in poor generalization. The content of the meter communication card varies greatly due to different manufacturers and production batches. In addition, the complex background noise caused by the meter usage environment makes it difficult for traditional methods to meet the generalization requirements for large-scale applications.
[0004] In recent years, optical character recognition (OCR) technology based on deep learning has made significant progress in the field of character recognition and has been widely used in various industries. OCR technology focuses on recognizing text content in images, but usually performs character recognition on the entire image, and complex backgrounds may interfere with the recognition of card numbers. Since the meter communication card number is a tiny target and is more difficult to recognize than other characters, the success rate of directly using OCR technology to obtain the meter communication card number is greatly reduced. In addition, the meter communication card number is usually arranged vertically in segments on the front of the card, and is surrounded by interference from other character content. Therefore, how to correctly extract and reorganize the segmented vertically arranged card number is also a major problem. Summary of the invention
[0005] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0006] In view of the above existing problems, the present invention is proposed.
[0007] Therefore, the present invention provides a method and system for identifying and vertically extracting an electric meter communication card number, which can solve the problems mentioned in the background technology.
[0008] In order to solve the above technical problems, the present invention provides the following technical solutions: In a first aspect, the present invention provides a method for identifying and vertically extracting a communication card number of an electric meter, comprising: cropping a picture according to the coordinates of a first detection frame, and saving the cropped picture to a temporary folder; Performing character recognition on the cropped image using optical character recognition technology, and locating a second detection frame in the cropped image, wherein the second detection frame includes a reference detection frame and other detection frames, the reference detection frame is a detection frame including an invariant feature, the invariant feature is a code representing the country in the card number, locating the second detection frame includes determining the reference detection frame according to the character recognition result, and determining the other detection frames from the other detection frames according to the size relationship and relative position relationship between the other detection frames and the reference detection frame in the cropped image, the other detection frames being detection frames on the cropped image other than the reference detection frame; The second detection frames are sorted, and corresponding card number recognition content is extracted according to the sorting result.
[0009] As a preferred solution of the method for recognizing and vertically extracting the communication card number of an electric meter of the present invention, the method further comprises: cropping the image according to the coordinates of the first detection frame: Build and train an object detection model; Perform target detection on the image through the target detection model, and filter out the detection results with confidence higher than the preset threshold; The coordinates of the first detection frame are determined according to the detection result.
[0010] As a preferred solution of the method for recognizing and vertically extracting the communication card number of an electric meter of the present invention, the establishment and training of the target detection model further comprises: Collect image datasets containing meter communication card numbers; Preprocess the image dataset, including data cleaning and data enhancement; Use annotation tools to annotate the preprocessed images to generate training data; Use the training data to train the object detection model until the model converges.
[0011] As a preferred solution of the method for recognizing and vertically extracting the communication card number of an electric meter of the present invention, the method further comprises: using optical character recognition technology to perform character recognition on the cropped image. Perform text detection on the cropped image and locate the text area; Perform text recognition on the detected text area and convert it into a character sequence.
[0012] As a preferred solution of the method for recognizing and vertically extracting the communication card number of an electric meter of the present invention, wherein: sorting the second detection frame further comprises: Sort all the second detection frames containing the card number in ascending order according to their vertical coordinates; Generate a sorted second detection box index according to the sorting result.
[0013] As a preferred solution of the electric meter communication card number recognition and vertical extraction method of the present invention, wherein: extracting the corresponding card number recognition content according to the sorting result also includes: Extracting the character sequence in each second detection box in turn according to the sorted second detection box indexes; Concatenate the extracted character sequences to generate a complete card number; Format the generated card number and remove extra spaces and symbols.
[0014] In a second aspect, the present invention provides a meter communication card number recognition and vertical extraction system, including a cropping module for cropping a picture according to the first detection frame coordinates and saving the cropped picture to a temporary folder; An identification and positioning module, used to perform character recognition on the cropped image using optical character recognition technology, and to locate the second detection frame; The sorting and recognition module is used to sort the second detection frame and extract the corresponding card number recognition content according to the sorting result.
[0015] In a third aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0016] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when the computer program is executed by a processor.
[0017] Compared with the prior art, the beneficial effects of the present invention are as follows: by combining target detection technology with optical character recognition (OCR) tasks, accurate recognition and extraction of meter communication card numbers are achieved. Specifically, target detection technology is used to constrain the meter communication card, and the detection results are cropped to adapt to the diversity of card content and the positioning area is expanded, thereby significantly improving the success rate of card number positioning and effectively reducing the interference of background noise. In addition, by selecting a reference detection frame with invariant features and screening and locating other related detection frames based on its coordinates, accurate extraction and reorganization of segmented vertically distributed card numbers in tilted images are achieved. This method not only improves the accuracy of information extraction, but also enhances the robustness and generalization ability of the system, which is of great significance for improving the automation level and operation and maintenance efficiency of the power industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0019] Figure 1 It is a schematic diagram of the overall framework of the electric meter communication card number recognition and vertical extraction method.
[0020] Figure 2 Flow chart of the method for identifying and vertically extracting the communication card number of an electric meter Figure 3 This is a schematic diagram of the image cropping process.
[0021] Figure 4 A schematic diagram for defining the coordinate axis direction and vertical distribution.
[0022] Figure 5 Schematic diagram of the segmented vertically distributed character extraction method.
[0023] Figure 6 A schematic diagram of the internal structure of a computer device. DETAILED DESCRIPTION
[0024] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0025] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0026] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0027] Example 1 Reference Figure 1 to Figure 5 , which is the first embodiment of the present invention, provides a method for identifying and vertically extracting a communication card number of an electric meter, which includes: S1. Crop the image according to the coordinates of the first detection frame, and save the cropped image to a temporary folder.
[0028] Furthermore, cropping the image according to the coordinates of the first detection frame further includes: Build and train an object detection model; Furthermore, establishing and training the target detection model also includes: Collect image datasets containing meter communication card numbers; It should be noted that the original image data set is formed by photographing the meter communication card through a photographing device. The preferred shooting location is on-site shooting where the meter is installed, including indoor or outdoor environments. The original image format should be JPG or PNG and contain complete visible card number data. At the same time, the diversity of the data set should be ensured. When taking pictures, the shooting angle and brightness can be appropriately adjusted and different shooting backgrounds can be changed.
[0029] It should be further explained that the original image dataset It can be expressed as: , in, Indicates pictures; and , represents the set of real numbers, and Indicates the width and height of the image. , , Respectively represent the red channel, green channel, and blue channel of the image.
[0030] Preprocess the image dataset, including data cleaning and data enhancement; It should be noted that data cleaning is to remove the wrong pictures in the original pictures. Among them, the wrong pictures refer to the situation where there is occlusion of important areas, reflection of important areas, missing of important areas, and abnormal blur of important areas. The important area is the location containing the communication card number of the meter. The specific data cleaning method is to use manual identification to screen the wrong pictures in the original pictures one by one to improve the sample quality; Data augmentation is to expand the original image in quantity. The premise of the expansion is to ensure that the content of the original image remains unchanged. At the same time, the original image is expanded in quantity by using techniques such as image rotation, random flipping, color change, and adding noise to improve the generalization of the model and solve the problem of imbalance in the number of categories.
[0031] Annotate the preprocessed images using an annotation tool to generate a training data set, wherein the annotation tool includes Labelimg software, and the annotation method is to use a rectangular frame to select a target area, and the further target area is an electric meter communication card in the image; It should be noted that when marking, appropriate classification should be carried out according to the different needs of the meter communication card manufacturers and production batches, so as to facilitate the subsequent identification and extraction of the meter communication card number by category.
[0032] It should be further explained that the training data is divided into training set, validation set and test set in a ratio of 7:2:1 for object detection model training.
[0033] Use the training data to train the object detection model until the model converges.
[0034] It should be noted that in this embodiment, the target detection model adopts the PP-YOLOE+ model, and the training process adopts the method of transfer learning. The PP-YOLOE+ model is trained for target detection tasks using pre-trained weights and annotated meter communication card number data sets until the model converges, and then the optimal model parameter file obtained through training is saved.
[0035] Perform target detection on the image through the target detection model, and filter out the detection results with confidence higher than the preset threshold; It should be noted that the size of the preset threshold should be appropriately adjusted according to the specific test situation to ensure that the position of the meter communication card in the picture can be correctly framed. A too small threshold will result in a large number of erroneous detection frames, while a too large threshold will cause the model to miss the meter communication card. Therefore, it has been verified that the threshold in this embodiment is set to 0.5.
[0036] The coordinates of the first detection frame are determined according to the detection results, wherein the coordinate axes refer to Figure 4 (a) shown.
[0037] It should be noted that the image is cropped according to the coordinates of the first detection frame, and the cropped image is saved in a temporary folder in JPG format. The name of the image saved in the temporary folder should contain the category information of the meter communication card to facilitate subsequent classification extraction, and the name should be unique to prevent saving errors caused by multiple meter communication cards of the same category in one image. Among them, the temporary folder is used to store the cropped image. After executing a complete meter communication card number extraction process, the data in the folder should be cleared to prevent data accumulation from causing disk explosion.
[0038] S2. Using optical character recognition technology to perform character recognition on the cropped image, and locating a second detection frame in the cropped image, wherein optical character recognition (OCR) technology is a process of analyzing and recognizing text on an image to extract text information. The task of OCR includes text detection and text recognition.
[0039] It should be noted that the PaddleOCR architecture of Baidu Paddle used in this embodiment uses the ch_PP-OCRv4_det model for the OCR text detection model, and the ch_PP-OCRv4_rec model for the text recognition model. During the initialization process, the official detection / recognition inference model is loaded, the recognition language is set to Chinese, and the inference device is selected as XPU (XPU / GPU / CPU device can be selected for inference according to the specific situation).
[0040] It should be further explained that vertical distribution means connecting the segmented contents in series on the same straight line. Figure 4 (b) Figure 4 (c) Figure 4 (d) shown.
[0041] Furthermore, performing character recognition on the cropped image using optical character recognition technology also includes performing text detection on the cropped image to locate the text area; Perform text recognition on the detected text area and convert it into a character sequence.
[0042] It should be noted that character recognition includes text detection and text recognition. The purpose of text detection is to locate the text area from the image, while the purpose of text recognition is to convert the detected text area into an actual character sequence.
[0043] Furthermore, the second detection frame includes a reference detection frame and other detection frames, wherein the reference detection frame is a detection frame including an invariant feature, and the invariant feature is a code representing the country in the card number.
[0044] It should be noted that the second detection frame is a set of detection frames obtained by performing text detection on the cropped image, the benchmark detection frame is the detection frame in the set that contains the invariant feature, and the remaining detection frames are all detection frames in the set except the benchmark detection frame. The further invariant feature refers to the code representing the country in the card number. In this embodiment, the invariant feature is set to "8986". After the benchmark detection frame is obtained based on the invariant feature, the coordinates of the four corners of the benchmark detection frame are extracted for positioning.
[0045] Specifically, locating the second detection frame includes determining a reference detection frame according to the character recognition result, and determining other detection frames from other detection frames according to a size relationship and a relative position relationship between other detection frames and the reference detection frame in the cropped image, where the other detection frames are detection frames other than the basic detection frame on the cropped image;
[0046] It should be further explained that the preliminary screening based on the size relationship between other detection frames and the reference detection frame in the cropped image includes: preliminary screening of the detection frames containing the remaining card number fields in other detection frames based on the consistency of size (refer to Figure 5 (a) includes: ①Determine the length of the reference detection frame : , in, Indicates the coordinates of the upper left corner of the reference detection frame. Indicates the coordinates of the upper right corner of the reference detection frame.
[0047] ②Determine the width of the reference detection frame : , in, Indicates the coordinates of the lower left corner of the reference detection frame.
[0048] ③ Calculate the length of the detection frame to be screened according to the above method With width ,in, Indicates The remaining detection boxes, .
[0049] And according to the results of ①②③ above, the second detection box set is iteratively screened: , in, Indicates the length difference threshold; represents the width difference threshold, and its value can be adjusted according to the specific situation. In this embodiment, and Both are set to 20.
[0050] It should be further explained that the secondary screening of the remaining detection frames based on their relative positions to the reference detection frame includes: The judgment is made based on the relative position of the reference detection frame and the other detection frames. Figure 5 (b) is shown in the formula: , in, Indicates The horizontal coordinates of the upper left corners of the remaining detection boxes; The horizontal coordinate of the upper left corner of the reference detection frame; represents the threshold value of the coordinate difference, and its value can be adjusted according to the specific situation. In this embodiment, Set to 50.
[0051] S3. Sort the second detection frames, and extract corresponding card number recognition content according to the sorting result.
[0052] Furthermore, sorting the second detection frames further includes: Sort all the second detection frames containing the card number in ascending order according to their vertical coordinates; Generate a sorted second detection box index according to the sorting result.
[0053] It should be noted that the objects of sorting are the reference detection frame and the remaining detection frames containing the card number field. The sorting method is based on the vertical coordinates of the detection frames. The values are sorted in ascending order, expressed as: , in, Represents ascending order function; The vertical coordinate value representing the upper left corner coordinate of the reference detection frame; Indicates the ordinate value of the upper left corner coordinate of the first remaining detection box; Indicates the ordinate value of the upper left corner coordinate of the second remaining detection box; Indicates The vertical coordinate value of the upper left corner coordinate of the remaining detection boxes.
[0054] Furthermore, extracting corresponding card number identification content according to the sorting result also includes: Extracting the character sequence in each second detection box in turn according to the sorted second detection box indexes; Concatenate the extracted character sequences to generate a complete card number; Format the generated card number and remove extra spaces and symbols.
[0055] In summary, the beneficial effect of a method for recognizing and vertically extracting meter communication card numbers is that by combining target detection technology with optical character recognition (OCR) tasks, accurate recognition and extraction of meter communication card numbers are achieved. Specifically, target detection technology is used to constrain the meter communication card, and the detection results are cropped to adapt to the diversity of card content and the positioning area is expanded, thereby significantly improving the success rate of card number positioning and effectively reducing the interference of background noise. In addition, by selecting a reference detection frame with invariant features and screening and locating other related detection frames based on its coordinates, accurate extraction and reorganization of segmented vertically distributed card numbers in tilted images are achieved. This method not only improves the accuracy of information extraction, but also enhances the robustness and generalization ability of the system, which is of great significance for improving the automation level and operation and maintenance efficiency of the power industry.
[0056] Example 2 This embodiment provides an electric meter communication card number recognition and vertical extraction system, which includes a cropping module for cropping a picture according to the first detection frame coordinates and saving the cropped picture to a temporary folder; An identification and positioning module, used to perform character recognition on the cropped image using optical character recognition technology, and to locate the second detection frame; The sorting and recognition module is used to sort the second detection frame and extract the corresponding card number recognition content according to the sorting result.
[0057] The above-mentioned unit modules may be embedded in or independent of the processor in the computer device in the form of hardware, or may be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
[0058] Example 3 This embodiment provides a computer device, which may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for identifying and vertically extracting an electric meter communication card number is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0059] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements: cropping an image according to the coordinates of the first detection frame, and saving the cropped image to a temporary folder; performing character recognition on the cropped image using optical character recognition technology, and locating the second detection frame; sorting the second detection frame, and extracting corresponding card number recognition content according to the sorting result.
[0060] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for identifying and vertically extracting an electric meter communication card number, characterized in that: include, Crop the image according to the coordinates of the first detection frame, and save the cropped image to a temporary folder; Performing character recognition on the cropped image using optical character recognition technology, and locating a second detection frame in the cropped image, wherein the second detection frame includes a reference detection frame and other detection frames, the reference detection frame is a detection frame containing an invariant feature, the invariant feature is a code representing the country in the card number, and locating the second detection frame includes determining the reference detection frame according to the character recognition result, and determining the other detection frames from the other detection frames according to the size relationship and relative position relationship between the other detection frames and the reference detection frame in the cropped image, wherein the other detection frames are detection frames on the cropped image other than the reference detection frame; The second detection frames are sorted, and corresponding card number recognition content is extracted according to the sorting result.
2. A method for identifying and vertically extracting an electric meter communication card number as claimed in claim 1, characterized in that: The step of cropping the image according to the coordinates of the first detection frame further includes: Build and train an object detection model; Perform target detection on the image through the target detection model, and filter out the detection results with confidence higher than the preset threshold; The coordinates of the first detection frame are determined according to the detection result.
3. A method for identifying and vertically extracting an electric meter communication card number as claimed in claim 2, characterized in that: The establishing and training of the target detection model further includes: Collect image datasets containing meter communication card numbers; Preprocessing the image data set, wherein the preprocessing includes data cleaning and data enhancement; Use annotation tools to annotate the preprocessed images to generate training data; Use the training data to train the object detection model until the model converges.
4. A method for identifying and vertically extracting an electric meter communication card number as claimed in claim 3, characterized in that: The using of optical character recognition technology to perform character recognition on the cropped image also includes: Perform text detection on the cropped image and locate the text area; Perform text recognition on the detected text area and convert it into a character sequence.
5. A method for identifying and vertically extracting an electric meter communication card number as claimed in claim 4, characterized in that: The sorting of the second detection frames further comprises: Sort all the second detection frames containing the card number in ascending order according to their vertical coordinates; Generate a sorted second detection box index according to the sorting result.
6. A method for identifying and vertically extracting an electric meter communication card number as claimed in claim 5, characterized in that: The extracting corresponding card number identification content according to the sorting result also includes: Extracting the character sequence in each second detection box in turn according to the sorted second detection box indexes; Concatenate the extracted character sequences to generate a complete card number; Format the generated card number and remove extra spaces and symbols.
7. A system using the method for recognizing and vertically extracting the communication card number of an electric meter as claimed in any one of claims 1 to 6, characterized in that: include, A cropping module, used for cropping the image according to the coordinates of the first detection frame, and saving the cropped image to a temporary folder; An identification and positioning module, used to perform character recognition on the cropped image using optical character recognition technology, and to locate the second detection frame; The sorting and recognition module is used to sort the second detection frame and extract the corresponding card number recognition content according to the sorting result.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of a method for identifying and vertically extracting an electric meter communication card number as described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a method for identifying and vertically extracting an electric meter communication card number as claimed in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Method, apparatus and system for recognizing information
CN104217202A
Extensible CRNN bank card number identification method
CN113989806A
Convolutional neural network-based vertical container number identification method and system, storage medium and computer equipment
CN114663885A
Multi-type nameplate container number extraction method and system, storage medium and computer equipment
CN115439852A
License plate recognition method and apparatus, and computer-readable storage medium
WO2024011888A1