Electric charge notice processing method combining OCR and multi-level verification
By combining OCR with multi-level verification in the electricity bill processing method, the problem of separation between OCR and data verification is solved, achieving efficient and automated electricity bill processing, adapting to different formats, and improving data accuracy and processing efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SINOPEC SALES CO LTD GUANGDONG PETROLEUM BRANCH
- Filing Date
- 2025-12-09
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, the OCR recognition and data verification processes are separated, making it impossible to form a closed loop for error correction. This results in low processing efficiency and insufficient data accuracy for electricity bills, and makes it unable to adapt to different versions of electricity bills.
This paper presents a method for processing electricity bills that combines OCR with multi-level verification. By integrating an OCR engine, a field positioning module, a multi-level rule engine, and an intelligent correction module, it achieves end-to-end automated processing from images to high-quality structured data, including key field extraction, multi-level rule verification, and intelligent correction.
It achieves end-to-end automated closed loop, significantly improving the efficiency and data accuracy of electricity bill processing, adapting to different versions of electricity bills, and reducing operating costs.
Smart Images

Figure CN121904776A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision, optical character recognition, and intelligent data processing. Specifically, it relates to a method for extracting structured information from electricity bill images by deeply integrating OCR recognition results with multi-level business rule verification, thereby achieving high accuracy and end-to-end automated processing. Background Technology
[0002] Electricity bills serve as the core voucher for electricity bill settlement between businesses and users. Their digitization and structuring are crucial for financial automation and energy management informatization. Currently, optical character recognition (OCR) technology is commonly used to convert paper or image-formatted bills into text data. However, due to factors such as diverse bill formats, inconsistent printing quality, and limitations in image acquisition conditions, the OCR recognition process is prone to typical errors such as character misrecognition, digit misalignment, and decimal point omission. For example, the number "0" may be misrecognized as the letter "O", "1" as "l" or "I", or the decimal point "." may be omitted or incorrectly added.
[0003] Current technology typically treats OCR recognition and data verification as two separate sequential steps. After the OCR engine outputs text, the data accuracy is checked by a separate system or manually. This fragmented approach has significant drawbacks: First, the OCR process is conducted in isolation, making it impossible to utilize the inherent business logic of electricity bill data for real-time self-optimization and error correction. Second, when subsequent verification detects data anomalies, it is difficult to automatically and accurately trace the specific error point in the OCR output and repair it. This often requires manual re-verification of the original image, leading to process interruptions, low processing efficiency, and the inability to achieve large-scale automated processing.
[0004] Therefore, there is an urgent need for a technical solution that can deeply couple OCR information extraction with intelligent data verification. This solution introduces business rules for intervention and correction in the early stages of data generation, forming an intelligent closed loop of "identification-verification-correction" to significantly improve the automation level and data output quality of electricity bill processing. The proposed method does not rely on a single fixed template. Through the extraction of key fields that combine semantics and location, it can adapt to electricity bills of different formats and regions, and has good format adaptability. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of existing technologies where OCR recognition and data verification are separated and cannot form a closed loop for error correction. This invention provides a method for processing electricity bills that combines OCR with multi-level verification. This method aims to build an integrated system that allows multi-level business verification logic to directly apply to the data extracted by OCR, and to perform real-time diagnosis and intelligent correction of recognition errors. Ultimately, it achieves end-to-end automated output from the bill image to high-quality, reliable structured data.
[0006] To achieve the above objectives, the present invention provides a method for processing electricity bills that combines OCR and multi-level verification, which is executed by a data processing system that integrates an OCR engine, a field positioning module, a multi-level rule engine, and an intelligent correction module.
[0007] The method includes the following steps: S1: Image OCR Processing and Text Location Information Acquisition The input electricity bill image is processed by optical character recognition to obtain all the recognized text content (full text information) in the image, and the coordinate position information of each text block or character in the original image is obtained simultaneously.
[0008] S2: Key Field Extraction Based on Semantics and Location Based on the predefined semantic tags of key fields (such as "account name", "total amount", "electricity consumption", "meter number", etc.), and combined with the text location coordinate information obtained in step S1, the initial text values of each key field are located and extracted from the full text information.
[0009] Specifically, the system uses two types of information for location: (1) Location matching: Key fields have relatively fixed areas in typical layouts (e.g., "Total Amount" is often located in the lower right corner).
[0010] (2) Keyword association: Key fields are often accompanied by specific prompt words (such as "Amount:" or "Account Number:").
[0011] (3) By comprehensively matching coordinate regions and search-related keywords, the system accurately captures the original recognition text of the target field.
[0012] S3: Structured Data Assembly The extracted initial text values of each key field are organized according to a predefined data structure (such as a JSON object or database record) to form preliminary structured electricity bill data. At this stage, the data may contain erroneous characters introduced by OCR recognition.
[0013] S4: Multi-level rule engine verification The initial structured data is input into a multi-level rule engine for automated validation, the engine containing at least two validation levels: (1) Basic logic verification layer: Perform data format and basic rationality checks, such as verifying whether the "total amount" field can be converted into a number; verifying that the "current period reading" is greater than the "previous period reading"; and verifying whether the date format is correct.
[0014] (2) Business rule verification layer: Based on electricity bill business knowledge, perform in-depth verification, for example, verify whether the "total amount" is equal to the sum of each item fee (allowing reasonable error); verify whether the calculation relationship between electricity consumption and electricity bill is in line with the current electricity price.
[0015] S5: Intelligent Correction for OCR Errors When the verification in step S4 fails and the abnormal features strongly indicate an OCR recognition error (such as non-numeric characters in the field, abnormal numerical magnitude, or incorrect decimal point position), the intelligent correction module is triggered.
[0016] The calibration module performs the following process: (1) Anomaly diagnosis: Identify abnormal fields and suspicious error characters.
[0017] (2) Contextual semantic analysis and candidate generation: Based on the semantic type of the abnormal field (such as amount, electricity, number), a limited set of legal character candidates is determined. For example, for the "amount" field, the candidate set is the numbers 0-9 and the decimal point; for the "account name" field, the candidate set may be common Chinese characters and English letters.
[0018] (3) Character replacement and verification: For the suspected characters diagnosed, replace them with the characters that are most similar in shape in the candidate set and are logically reasonable in the context, and use the new field value after replacement to perform fast logical verification again (such as recalculating the checksum and verifying the numerical relationship).
[0019] (4) Confirmation and Update: If the new value passes the verification, the correction is confirmed to be effective, and the corresponding field value in the structured data is updated. At the same time, a detailed correction log is recorded.
[0020] S6: Output high-quality structured data The output is the final electricity bill data after the above verification and intelligent correction processing. This data has eliminated most typical OCR recognition errors, has high accuracy and reliability, and can be directly used for subsequent financial accounting, data analysis, or system integration.
[0021] Beneficial effects Compared with the prior art, the present invention has the following significant advantages: 1. Achieve end-to-end automated closed loop: Seamlessly connect OCR, field extraction, data verification and intelligent correction to form a complete automated processing chain, greatly reducing manual intervention and significantly improving processing efficiency.
[0022] 2. Source error correction and high data quality: By introducing business rule-based verification in the early stages of data processing, and intelligently correcting OCR errors found through multi-level verification, recognition errors are effectively corrected from the source, greatly improving the accuracy of the final data.
[0023] 3. Strong adaptability to different formats: This method does not rely on a single fixed template. By combining key field semantic tags with a dynamic extraction strategy of text location coordinates, it can effectively adapt to the diverse formats of electricity bills issued by different regions and power supply companies, thereby improving the system's versatility and deployment flexibility.
[0024] 4. Reduce operating costs: The intelligent correction mechanism avoids a large amount of manual review and rework caused by OCR errors, which is especially suitable for batch processing scenarios with a large number of notifications, effectively reducing operating costs. Attached Figure Description
[0025] Figure 1 This is a schematic diagram of the overall process of an embodiment of the present invention.
[0026] Figure 2 This is a schematic diagram of the verification flowchart in an embodiment of the present invention.
[0027] Figure 3 This is a diagram illustrating a specific correction strategy for OCR errors in an embodiment of the present invention. Detailed Implementation
[0028] The accompanying drawings illustrate the complete "identification-verification-correction" process of this invention. The key steps are explained below with reference to the accompanying drawings: I. Overall Processing Flow (see attached document) Figure 1 ) like Figure 1 As shown, this invention starts with the input of an electricity bill image and sequentially performs OCR recognition, extraction of key fields based on semantics and location, structured data assembly, and multi-level rule engine verification. If the verification passes, high-quality data is directly output; if the verification fails and abnormal features indicate an OCR error, an intelligent correction process is triggered, and the corrected data is returned for re-verification, forming a closed-loop processing system to ultimately ensure the accuracy of the output data.
[0029] II. Detailed process for field extraction and validation (see attached document) Figure 2 ) like Figure 2 As shown, the field extraction of this invention adopts a dual strategy: 1) Location area matching: matching text coordinates with pre-stored reference areas; 2) Keyword association search: searching for keywords associated with semantic tags and extracting adjacent text. The initial values of the extracted key fields are combined into structured data, and then enter multi-level verification. The verification is divided into a basic logic layer (checking the data format and basic rationality) and a business rule layer (verifying data relationships based on electricity bill business knowledge). If the verification of any layer fails, the correction process is triggered.
[0030] III. OCR Error Correction Decision Process (see attached document) Figure 3 ) like Figure 3 As shown, when verification fails and correction is triggered, the system first performs anomaly diagnosis, classifying the anomaly as character recognition error, decimal point misalignment, or other format errors. Based on the anomaly type, it matches the corresponding correction strategy: for character errors, it performs contextual semantic analysis and generates candidate characters, verifying the logical rationality of the replacement; for decimal point misalignment, it attempts to shift the decimal point and matches it with numerical relationships and historical magnitudes for verification; for format errors, it applies predefined format rules. Only corrections that pass verification are executed; otherwise, manual processing is initiated. All correction operations are recorded to ensure traceability.
[0031] To make the objectives, technical solutions, and advantages of the present invention clearer, a detailed description is provided below in conjunction with the accompanying drawings and specific embodiments.
[0032] Example: Processing a scanned image of an electricity bill S1: Image OCR Processing The system performs OCR recognition on the scanned image of the input electricity bill, recognizing the full text, including, for example: "Account Name: Zhang San", "Total Amount: 1Z3.50 Yuan", "Current Period Reading: 205876", "Previous Period Reading: 198523", etc. Simultaneously, it obtains the coordinates of each text string.
[0033] S2: Key Field Extraction Based on the configuration, the system extracts key fields. For example, the "Total Amount" field is extracted by locating the text block to the right of the keyword "Amount:", and the initial text value "1Z3.5O" is obtained.
[0034] S3: Structured Data Assembly Assembled data as follows: {"Account Name": "Zhang San", "Total Amount": "1Z3.5O", "Current Period Reading": "2O5876", "Previous Period Reading": "198523"}.
[0035] S4: Multi-level rule validation Basic logic validation layer: The system attempts to convert the "Total Amount" field value "1Z3.5O" into a numerical value, but fails, triggering an exception.
[0036] Business rule validation layer (in this example, since the base layer has failed, some checks can be paused or executed in parallel to assist in diagnosis).
[0037] S5: Intelligent Correction Anomaly Diagnosis: Based on the result of the failure of basic logic verification, it was determined that the "Total Amount" field "1Z3.5O" contains characters ('Z' and 'O') that do not conform to the semantic constraints of the numeric field.
[0038] Contextual analysis and candidate generation: The semantic type of the "Total Amount" field is amount, and its legal character set should be the numbers 0-9 and the decimal point. Based on the similarity of character shapes, the suspicious character 'Z' is replaced with the number '2', and 'O' is replaced with the number '0', resulting in the candidate value "123.50".
[0039] Verification: The candidate value "123.50" is a valid number. Furthermore, the system can combine this with other sub-items extracted from the image (such as electricity fees and surcharges) for summation verification. If the sum matches 123.50, the verification passes.
[0040] Update: The "Total Amount" field value has been updated to "123.50". Simultaneously, based on the same field semantic rules (readings should be numbers), the system corrected the 'O' in "Current Period Reading" to '0', resulting in "205876". Verification shows "205876 > 198523", which is logically correct.
[0041] Record: Generate a correction log.
[0042] S6: Output Results
[0043] Output high-quality structured data after correction: {"Account Name": "Zhang San", "Total Amount": "123.50", "Current Period Reading": "205876", "Previous Period Reading": "198523"}, along with a correction log.
[0044] This embodiment demonstrates how the present invention achieves real-time detection and intelligent correction of recognition errors by deeply integrating OCR and business rule verification, and automatically repairs abnormal data that might otherwise flow to manual processing in traditional processes within the system, thereby significantly improving the automation rate and reliability of the entire data processing process.
Claims
1. A method for processing electricity bills combining OCR and multi-level verification, characterized in that, The method includes the following steps: S1: Perform OCR processing on the input electricity bill image to obtain the full text information and the position coordinate information of each text in the image; S2: Based on predefined key field semantic tags and combined with the location coordinate information, locate and extract the initial text values of each key field from the full text information; S3: Combine the initial text values of the extracted key fields into structured electricity bill data; S4: Input the structured electricity fee data into the multi-level rule engine for verification; S5: When the verification fails and data anomalies caused by OCR errors are identified, a correction strategy related to the OCR process is triggered and executed to correct the initial text value. S6: Outputs the electricity bill data after verification and correction.
2. The method according to claim 1, characterized in that, In step S2, the extraction of key fields based on semantic tags and location information specifically includes: locating and extracting the initial text value of the key field by matching the location coordinates with a pre-stored reference location area, and or by searching for keywords associated with semantic tags and extracting their neighboring text.
3. The method according to claim 1, characterized in that, The key fields include at least three of the following: customer name, electricity address, electricity bill amount, electricity consumption, electricity meter reading, and electricity billing period.
4. The method according to claim 1, characterized in that, The multi-level rule engine performs at least two types of checks: basic logic checks and business rule checks. The basic logic checks are used to check the data format and basic rationality, while the business rule checks are used to verify data relationships based on electricity billing business knowledge.
5. The method according to claim 1, characterized in that, The correction strategies related to the OCR process include character replacement strategies based on character semantics.
6. The method according to claim 5, characterized in that, The character substitution strategy based on character semantics includes: (1) Identify suspicious characters in the abnormal field that violate its semantic type constraints; (2) Determine a limited set of legal candidate characters based on the semantic type of the key field; (3) Replace the suspicious character with a character in the candidate character set that has a similar shape and is reasonable in the context logic to form the corrected field value.
7. The method according to claim 6, characterized in that, The step of determining the candidate character set based on the semantic type of the key field includes: if the key field is amount, battery level, or reading, then the candidate character set is the digits 0-9 and the decimal point.
8. The method according to claim 1, characterized in that, The correction strategies related to the OCR process include a decimal point position correction strategy based on contextual semantics.
9. The method according to claim 1, characterized in that, Before step S6, the method further includes the step of: recording the correction operation performed on the initial text value and generating a correction log containing the values before and after correction and the triggered strategy information.
10. The method according to claim 1, characterized in that, After executing the correction strategy in step S5, the new field values obtained are returned to step S4 or independently verified to confirm the effectiveness of the correction.