Methods, devices, computer equipment and storage media for document recognition and verification
By optimizing the invoice recognition process through OCR recognition technology and pixel positioning model, and combining encryption algorithms and verification priorities, the problem of slow medical invoice recognition speed has been solved, achieving efficient and intelligent invoice recognition and verification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2023-06-08
- Publication Date
- 2026-06-30
AI Technical Summary
In the existing technology, the identification and verification process of medical invoices suffers from problems such as slow identification speed, large workload of manual testing, and high repetition, especially in the regression comparison of electronic invoices, which is time-consuming and inefficient.
By combining OCR recognition technology with a pixel-based localization recognition model, and optimizing ticket recognition through pre-training and classification rules, the system utilizes a preset wide table and encryption algorithm for verification optimization. By setting verification priorities and similarity judgments, it achieves intelligent ticket recognition and verification.
It improves the speed and accuracy of invoice recognition, reduces the manpower consumption of doctors in reviewing invoices, and enables efficient recognition and verification of invoices for different types of business.
Smart Images

Figure CN116704528B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of digital healthcare, specifically to the field of medical-related invoice recognition, and particularly to an invoice recognition and verification method, apparatus, computer equipment, and storage medium. Background Technology
[0002] In the process of functional testing, the testing of image-based requirements has always been a weak point in automation and tooling. For the digital healthcare industry, electronic invoices are a particularly important form of voucher. The content of these vouchers is diverse, such as personal health records, prescriptions, examination reports, and registration vouchers. Testers' comparison work is highly repetitive and lacks technical sophistication.
[0003] Currently, each iteration requires manual testing of a large amount of image data such as electronic invoices, electronic vouchers, and electronic reports. Often, during regression testing, there are too many product types, involving the regression comparison of batches of electronic invoices. This repetitive and extensive manual testing work is time-consuming and results in slow recognition speed. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, computer equipment, and storage medium for document recognition and verification, so as to enable OCR recognition of documents of different business types according to their business type and verification priority, thereby ensuring the speed of document recognition.
[0005] To address the aforementioned technical problems, this application provides a method for identifying and verifying invoices, employing the following technical solution:
[0006] A method for identifying and verifying invoices includes the following steps:
[0007] Receive a ticket identification request, wherein the ticket identification request includes the cache address of the PDF file corresponding to the target ticket and the identification information of the target ticket;
[0008] Based on the cache address, obtain the PDF file corresponding to the target ticket;
[0009] The PDF file is input into a pre-trained pixel localization and recognition model to identify the target pixel region in the PDF file to be recognized by OCR.
[0010] The characters within the target pixel region are extracted using OCR recognition technology to obtain the actual values;
[0011] Based on the identification information and the preset bill data cache wide table, the bill data is obtained from the bill data cache wide table to obtain the estimated value;
[0012] Based on the comparison between the actual value and the estimated value, it is determined whether the target bill has been successfully verified.
[0013] Furthermore, before the step of inputting the PDF file into the pre-trained pixel localization and recognition model to identify the target pixel region to be OCR recognized in the PDF file, the method further includes:
[0014] Step A: Batch obtain PDF files corresponding to invoices of different business types;
[0015] Step B: Input the PDF file into the initialized pixel positioning recognition model, and classify the PDF file according to the preset classification rules in the pixel positioning recognition model. The preset classification rules are to classify the invoice PDF files of the same business according to the business type.
[0016] Step C: Based on the classification results, preprocess the PDF files of the same type. The preprocessing steps include: scaling the PDF file to the target size, enhancing the contrast and clarity of the scaled PDF file, and optimizing the edges of the characters in the enhanced PDF file. The target size is the preset optimal size of the PDF file for OCR optical recognition.
[0017] Step D: Based on OCR optical recognition technology, recognize the characters in the pre-processed PDF files of the same type, and obtain the character recognition area of the PDF files of the same type based on the recognition results;
[0018] Step E: Use the character recognition region as the target pixel region to be OCR recognized in the current category PDF file to obtain the pre-trained pixel localization and recognition model.
[0019] Furthermore, prior to the step of using the character recognition region as the target pixel region for OCR recognition in the current category PDF file, the method further includes:
[0020] Step F: Obtain the ratio of the character recognition area of each PDF file to the total area of the PDF file;
[0021] Step G: Iterate through the ratio values and obtain the ratio of the number of ratio values within the preset allowable error to the number of similar PDF files;
[0022] Step H: Determine whether the percentage value meets the preset percentage threshold;
[0023] Step I: If the preset percentage threshold is met, the character recognition area does not need to be corrected.
[0024] Step J: If the preset percentage threshold is not met, repeat steps A to H until the percentage value meets the preset percentage threshold, thus completing the correction process for the character recognition area.
[0025] Furthermore, the step of extracting characters within the target pixel region based on OCR recognition technology to obtain actual values specifically includes:
[0026] After extracting the characters within the target pixel area, the characters are obtained line by line, and the spacing between the characters in the same line is identified to determine the spacing between two adjacent characters. Distinguishing marks are then set at the spacing.
[0027] Determine whether the spacing is greater than a preset character spacing threshold;
[0028] If the spacing is not greater than a preset character spacing threshold, then delete the distinguishing label corresponding to the spacing;
[0029] If the spacing is greater than a preset character spacing threshold, then the distinguishing label corresponding to the spacing is retained;
[0030] Using the retained distinguishing markers as the segmentation positions, the characters in the same line are segmented, and the segmented strings are obtained as the actual values.
[0031] Furthermore, before the step of determining whether the target bill has been successfully verified based on the comparison between the actual value and the estimated value, the method further includes:
[0032] Based on the DES symmetric encryption algorithm, each string in the actual value and each invoice data in the estimated value are encrypted.
[0033] Obtain the encrypted ciphertext corresponding to each string in the actual value, and update the corresponding string in the actual value using the encrypted ciphertext;
[0034] Obtain the encrypted ciphertext corresponding to each bill data in the estimated value, and use the encrypted ciphertext to update the corresponding bill data in the estimated value.
[0035] Furthermore, the step of determining whether the target bill has been successfully verified based on the comparison between the actual value and the estimated value specifically includes:
[0036] Pre-set verification priorities for invoices of different business types;
[0037] Based on the cosine similarity algorithm, the similarity between the data in the actual value and the data in the estimated value is identified;
[0038] Determine whether the similarity is greater than a preset similarity threshold;
[0039] If the similarity is greater than the preset similarity threshold, the target invoice is successfully verified, and the verification priority of the business type corresponding to the target invoice is increased based on the preset priority increment algorithm.
[0040] If the similarity is not greater than a preset similarity threshold, the verification of the target invoice fails, and the verification priority of the business type corresponding to the target invoice is reduced based on a preset priority deduction algorithm.
[0041] Furthermore, after the step of determining whether the target bill has been successfully verified based on the comparison between the actual value and the estimated value, the method further includes:
[0042] If the target invoice verification fails, the actual value and the estimated value are traversed and compared to filter out the string that failed verification in the actual value and the invoice data corresponding to the string in the estimated value.
[0043] The string and the ticket data are split into character sets to obtain corresponding single character sets;
[0044] By traversing and comparing the corresponding set of single characters, single characters that failed verification were filtered out.
[0045] The single character that fails verification is marked, and an association relationship is set based on the single character marked as failing verification and the corresponding single character in the estimated value.
[0046] To address the aforementioned technical problems, this application also provides a document recognition and verification device, which employs the following technical solution:
[0047] A document recognition and verification device, comprising:
[0048] The request receiving module is used to receive a ticket identification request, wherein the ticket identification request includes the cache address of the PDF file corresponding to the target ticket and the identification information of the target ticket;
[0049] The ticket acquisition module is used to acquire the PDF file corresponding to the target ticket based on the cache address;
[0050] The model recognition module is used to input the PDF file into a pre-trained pixel localization and recognition model to identify the target pixel region to be OCR recognized in the PDF file.
[0051] The actual value extraction module is used to extract characters within the target pixel area based on OCR recognition technology to obtain the actual value;
[0052] The estimated value acquisition module is used to obtain the estimated value by retrieving the bill data from the bill data cache wide table based on the identification information and the preset bill data cache wide table.
[0053] The verification and judgment module is used to determine whether the target invoice has been successfully verified based on the comparison between the actual value and the estimated value.
[0054] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0055] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the above-described document recognition and verification method.
[0056] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0057] A computer-readable storage medium storing computer-readable instructions, which, when executed by a processor, implement the steps of the document recognition and verification method described above.
[0058] Compared with the prior art, the embodiments of this application have the following main advantages:
[0059] The invoice recognition and verification method described in this application involves: receiving an invoice recognition request; obtaining the PDF file corresponding to the target invoice; identifying the target pixel region based on a pre-trained pixel positioning and recognition model; extracting characters within the target pixel region using OCR optical recognition technology to obtain actual values; obtaining invoice data to obtain an estimated value; and determining whether the target invoice has been successfully verified based on a comparison between the actual value and the estimated value. This application utilizes a method of comparing OCR recognition results with wide table results for OCR recognition verification. By determining whether the verification result is successful, the character recognition by OCR is optimized. Furthermore, an incremental verification optimization method is used to schedule OCR recognition for invoices of different business types according to their business type and verification priority, ensuring invoice recognition speed, intelligently recognizing medical data in medical invoices, and reducing the manpower consumption of doctors' review. Attached Figure Description
[0060] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0061] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0062] Figure 2 A flowchart of an embodiment of the invoice identification and verification method according to this application;
[0063] Figure 3 yes Figure 2 A flowchart of a specific implementation of step 204 shown;
[0064] Figure 4 yes Figure 2 A flowchart of a specific implementation of step 206 shown;
[0065] Figure 5 A schematic diagram of the structure of an embodiment of the invoice recognition and verification device according to this application;
[0066] Figure 6 This is a schematic diagram of the structure of one embodiment of the pre-training module in this application;
[0067] Figure 7 This is a schematic diagram of the structure of one embodiment of the model correction submodule in this application;
[0068] Figure 8 This is a schematic diagram of the structure of one embodiment of the security encryption module in this application;
[0069] Figure 9 This is a schematic diagram of the structure of one embodiment of the verification failure handling module in this application;
[0070] Figure 10 A schematic diagram of the structure of an embodiment of the computer device according to this application. Detailed Implementation
[0071] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0072] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0073] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0074] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0075] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0076] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0077] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0078] It should be noted that the invoice recognition and verification method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the invoice recognition and verification device is generally set in the server / terminal device.
[0079] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0080] Continue to refer to Figure 2 The diagram illustrates a flowchart of an embodiment of the invoice identification and verification method according to this application. The invoice identification and verification method includes the following steps:
[0081] Step 201: Receive a ticket identification request, wherein the ticket identification request includes the cache address of the PDF file corresponding to the target ticket and the identification information of the target ticket.
[0082] In this embodiment, the receipt identification request includes receipts that store medical data, such as personal health records, prescriptions, examination reports, registration vouchers, etc.
[0083] In this embodiment, the identification information of the target ticket can be the ticket number or the distinguishing cache information pre-set for obtaining ticket data. The purpose of this identification information is to facilitate the retrieval of the specific ticket data contained in the target ticket from the preset database through the identification information.
[0084] In this embodiment, the identification information of the target ticket is generally set differently according to the registration order or the patient's identity information. For example, the registration number or the patient's ID number can be used as the ticket identification information.
[0085] By attaching the cache address of the PDF file corresponding to the target invoice and the identification information of the target invoice to the request, the parsing unit can directly obtain valuable data information from the request after parsing, which can speed up the identification and verification of invoices.
[0086] Step 202: Obtain the PDF file corresponding to the target ticket based on the cache address.
[0087] Step 203: Input the PDF file into the pre-trained pixel localization and recognition model to identify the target pixel region to be OCR recognized in the PDF file.
[0088] In this embodiment, before the step of inputting the PDF file into the pre-trained pixel localization recognition model to identify the target pixel region to be recognized by OCR in the PDF file, the method further includes: Step A: Batch acquisition of PDF files corresponding to invoices of different business types; Step B: Inputting the PDF file into the initialized pixel localization recognition model, and classifying the PDF file according to the preset classification rules in the pixel localization recognition model, wherein the preset classification rules are to classify invoice PDF files of the same business according to business type; Step C: Preprocessing PDF files of the same type according to the classification results, wherein the... The preprocessing steps include: scaling the PDF file according to the target size, enhancing the contrast and clarity of the scaled PDF file, and optimizing the edges of the characters in the enhanced PDF file, wherein the target size is the preset optimal size of the PDF file for OCR optical recognition; Step D: Based on OCR optical recognition technology, recognizing characters in similar PDF files after preprocessing, and obtaining the character recognition region of similar PDF files according to the recognition results; Step E: Using the character recognition region as the target pixel region to be recognized by OCR in the current category of PDF files, obtaining the pre-trained pixel localization and recognition model.
[0089] By pre-training on invoices of different business types, the target pixel regions corresponding to invoices of different business types are obtained. This makes it easier to quickly determine the corresponding character recognition region based on the business type of the target invoice when using the pixel positioning and recognition model, and to perform OCR recognition and verification on the character recognition region, thereby improving the speed of OCR recognition and verification.
[0090] In this embodiment, the different types of receipts refer to the receipts corresponding to personal health records, prescriptions, examination reports, and registration vouchers, respectively.
[0091] In this embodiment, before the step of using the character recognition region as the target pixel region for OCR recognition in the current category of PDF files, the method further includes: Step F: obtaining the ratio of the character recognition region of each PDF file in the same category of PDF files to the total region of the PDF file; Step G: traversing the ratio values and obtaining the proportion of the number of ratio values within a preset allowable error to the number of the same category of PDF files; Step H: determining whether the proportion value meets a preset proportion threshold; Step I: if the preset proportion threshold is met, the character recognition region does not need to be corrected; Step J: if the preset proportion threshold is not met, repeating steps A to H until the proportion value meets the preset proportion threshold, thus completing the correction process for the character recognition region.
[0092] Although the document formats of personal health records, prescriptions, examination reports, and registration vouchers are different, the document format for the same document is basically uniform. For example, examination reports from the same department within a hospital have a uniform format. By calculating the character recognition area corresponding to each PDF file of the same business type, and filtering according to a preset proportion threshold, it is determined whether the character recognition area needs to be corrected. Through correction processing, the accuracy of the pixel positioning recognition model in locating the target pixel area is further improved, ensuring the speed and accuracy of OCR recognition verification results.
[0093] Step 204: Extract characters from the target pixel area based on OCR recognition technology to obtain actual values.
[0094] In this embodiment, the step of extracting characters within the target pixel region based on OCR recognition technology to obtain actual values specifically includes: after extracting the characters within the target pixel region, obtaining the characters line by line, and performing spacing recognition on the characters in the same line to identify the spacing between two adjacent characters, and setting a distinction label at the spacing; determining whether the spacing is greater than a preset character spacing threshold; if the spacing is not greater than the preset character spacing threshold, deleting the distinction label corresponding to the spacing; if the spacing is greater than the preset character spacing threshold, retaining the distinction label corresponding to the spacing; using the retained distinction label as the segmentation position, segmenting the characters in the same line, and obtaining each segmented string as the actual value.
[0095] By identifying the spacing between characters in the same line and setting distinguishing marks at the spacing, and then retaining valuable spacing by setting a preset spacing threshold, the characters in each line are segmented to obtain each string. The actual value identified in the target document is obtained by simply using the segmentation method, which improves the recognition and verification speed of OCR.
[0096] Continue to refer to Figure 3 , Figure 3 yes Figure 2 A flowchart of a specific implementation of step 204 shown includes the following steps:
[0097] Step 301: After extracting the characters within the target pixel area, the characters are obtained line by line, and the spacing between the characters in the same line is identified to determine the spacing between two adjacent characters. A distinguishing label is then set at the spacing.
[0098] Step 302: Determine whether the spacing is greater than a preset character spacing threshold;
[0099] Step 303: If the spacing is not greater than a preset character spacing threshold, then delete the distinguishing label corresponding to the spacing;
[0100] Step 304: If the spacing is greater than a preset character spacing threshold, then retain the distinction label corresponding to the spacing;
[0101] Step 305: Using the retained distinguishing markers as the segmentation positions, the characters in the same line are segmented to obtain the segmented strings as actual values.
[0102] Step 205: Based on the identification information and the preset bill data cache wide table, obtain the bill data from the bill data cache wide table to get the estimated value.
[0103] Step 206: Based on the comparison between the actual value and the estimated value, determine whether the target bill has been successfully verified.
[0104] In this embodiment, before the step of determining whether the target bill has been successfully verified based on the comparison result between the actual value and the estimated value, the method further includes: encrypting each string in the actual value and each bill data in the estimated value using the DES symmetric encryption algorithm; obtaining the encrypted ciphertext corresponding to each string in the actual value, and updating the corresponding string in the actual value using the encrypted ciphertext; obtaining the encrypted ciphertext corresponding to each bill data in the estimated value, and updating the corresponding bill data in the estimated value using the encrypted ciphertext.
[0105] By using the same encryption rules to encrypt the data information in both the actual and estimated values, the security and privacy of the invoice content are ensured during the OCR recognition and verification process, thus providing a certain level of protection for the security of the invoice data.
[0106] In this embodiment, the step of determining whether the target invoice has been successfully verified based on the comparison between the actual value and the estimated value specifically includes: pre-setting verification priorities for invoices of different business types; identifying the similarity between the data in the actual value and the data in the estimated value using a cosine similarity algorithm; determining whether the similarity is greater than a preset similarity threshold; if the similarity is greater than the preset similarity threshold, the target invoice is successfully verified, and the verification priority of the business type corresponding to the target invoice is increased based on a preset priority increment algorithm; if the similarity is not greater than the preset similarity threshold, the target invoice verification fails, and the verification priority of the business type corresponding to the target invoice is decreased based on a preset priority decrement algorithm.
[0107] By pre-setting verification priorities and combining the results of each verification, the priority of invoice recognition for different business types is fine-tuned, so that invoice types that have been successfully verified will be recognized and verified first in subsequent verifications, further ensuring the processing efficiency of verification during batch recognition.
[0108] Continue to refer to Figure 4 , Figure 4 yes Figure 2 A flowchart of a specific implementation of step 206 shown includes the following steps:
[0109] Step 401: Pre-set verification priorities for invoice verification of different business types;
[0110] Step 402: Based on the cosine similarity algorithm, identify the similarity between the data in the actual value and the data in the estimated value;
[0111] In this embodiment, the actual value generally refers to the actual medical data content in the verified personal health records, prescriptions, and examination reports, while the estimated value generally refers to the expected medical data content in the personal health records, prescriptions, and examination reports.
[0112] Step 403: Determine whether the similarity is greater than a preset similarity threshold;
[0113] Step 404: If the similarity is greater than the preset similarity threshold, the target invoice is successfully verified. Based on the preset priority value-added algorithm, the verification priority of the business type corresponding to the target invoice is increased.
[0114] Step 405: If the similarity is not greater than a preset similarity threshold, the verification of the target invoice fails. Based on a preset priority deduction algorithm, the verification priority of the business type corresponding to the target invoice is reduced.
[0115] In this embodiment, the verification priority can be set to an initial value for different business types, and the increment and decrement values can be set to a second value. Whenever the verification is successful, the initial value is added to the second value once, and the sum of the two values is used as the verification priority. Whenever the verification fails, the initial value is subtracted from the second value once, and the difference between the two values is used as the verification priority.
[0116] In this embodiment, after the step of determining whether the target invoice has been successfully verified based on the comparison result of the actual value and the estimated value, the method further includes: if the target invoice verification fails, by traversing and comparing the data in the actual value and the estimated value, filtering out the string that failed verification in the actual value and the invoice data corresponding to the string in the estimated value; splitting the string and the invoice data into characters respectively to obtain corresponding single character sets; by traversing and comparing the corresponding single character sets, filtering out the single characters that failed verification; marking the single characters that failed verification, and setting an association relationship based on the single characters marked as the single characters that failed verification and the corresponding single characters referenced in the estimated value.
[0117] By obtaining and marking the specific individual character corresponding to the failure after a recognition verification fails, subsequent verifications can directly determine the reference character corresponding to that individual character through the mark and the association relationship, thereby further improving the accuracy and efficiency of the recognition verification.
[0118] This application involves receiving a document recognition request; obtaining the PDF file corresponding to the target document; identifying the target pixel region based on a pre-trained pixel positioning and recognition model; extracting characters within the target pixel region using OCR optical recognition technology to obtain actual values; acquiring document data to obtain an estimated value; and determining whether the target document has been successfully verified based on a comparison between the actual value and the estimated value. This application utilizes a method of comparing OCR recognition results with wide table results for OCR recognition verification. By determining whether the verification result is successful, the application optimizes the verification of characters recognized by OCR. Furthermore, it employs an incremental verification optimization method to schedule OCR recognition for documents of different business types according to their business type and verification priority, ensuring document recognition speed, intelligently recognizing medical data in medical documents, and reducing the human review burden on doctors.
[0119] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0120] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0121] In this embodiment, artificial intelligence can be combined to automate the pre-training of the pixel positioning and recognition model. Simultaneously, the invoice recognition and verification method described in this application can be encapsulated into an invoice recognition model. In subsequent use, this model can be directly reused when recognizing and verifying incoming invoices, resulting in greater intelligence and automation. This intelligent recognition of medical data in medical invoices reduces the human review burden on doctors.
[0122] Further reference Figure 5 As a response to the above Figure 2 The implementation of the method shown in this application provides an embodiment of a ticket recognition and verification device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0123] like Figure 5 As shown, the invoice recognition and verification device 500 described in this embodiment includes: a request receiving module 501, an invoice recognition acquisition module 502, a model recognition module 503, an actual value extraction module 504, an estimated value acquisition module 505, and a verification judgment module 506. Wherein:
[0124] The request receiving module 501 is used to receive a ticket identification request, wherein the ticket identification request includes the cache address of the PDF file corresponding to the target ticket and the identification information of the target ticket;
[0125] The ticket acquisition module 502 is used to acquire the PDF file corresponding to the target ticket based on the cache address;
[0126] Model recognition module 503 is used to input the PDF file into a pre-trained pixel localization recognition model to recognize the target pixel region to be OCR recognized in the PDF file;
[0127] The actual value extraction module 504 is used to extract characters within the target pixel region based on OCR recognition technology to obtain actual values;
[0128] The estimated value acquisition module 505 is used to obtain the estimated value by acquiring the bill data from the bill data cache wide table based on the identification information and the preset bill data cache wide table.
[0129] The verification and judgment module 506 is used to determine whether the target invoice has been successfully verified based on the comparison result between the actual value and the estimated value.
[0130] This application involves receiving a document recognition request; obtaining the PDF file corresponding to the target document; identifying the target pixel region based on a pre-trained pixel positioning and recognition model; extracting characters within the target pixel region using OCR optical recognition technology to obtain actual values; acquiring document data to obtain an estimated value; and determining whether the target document has been successfully verified based on a comparison between the actual value and the estimated value. This application utilizes a method of comparing OCR recognition results with wide table results for OCR recognition verification. By determining whether the verification result is successful, the application optimizes the verification of characters recognized by OCR. Furthermore, it employs an incremental verification optimization method to schedule OCR recognition for documents of different business types according to their business type and verification priority, ensuring document recognition speed, intelligently recognizing medical data in medical documents, and reducing the human review burden on doctors.
[0131] Further reference Figure 6 In some specific embodiments of this application, the invoice recognition and verification device 500 further includes: a pre-training module 507, which includes a first acquisition submodule 5071, a classification processing submodule 5072, a preprocessing submodule 5073, a character region recognition submodule 5074, and a training completion submodule 5075, wherein:
[0132] The first acquisition submodule 5071 is used to acquire PDF files corresponding to invoices of different business types in batches;
[0133] The classification processing submodule 5072 is used to input the PDF file into the initialized pixel positioning recognition model, and classify the PDF file according to the preset classification rules in the pixel positioning recognition model. The preset classification rules are to classify the invoice PDF files of the same business according to the business type.
[0134] The preprocessing submodule 5073 is used to preprocess PDF files of the same type according to the classification processing results. The preprocessing steps include: scaling the PDF file according to the target size, enhancing the contrast and clarity of the scaled PDF file, and optimizing the edges of the characters in the enhanced PDF file. The target size is the preset optimal size of the PDF file for OCR optical recognition.
[0135] The character region recognition submodule 5074 is used to recognize characters in preprocessed PDF files of the same type based on OCR optical recognition technology, and obtain the character recognition region of the PDF file of the same type based on the recognition result.
[0136] The training completion submodule 5075 is used to take the character recognition region as the target pixel region to be OCR recognized in the current category PDF file, and obtain the pre-trained pixel localization recognition model.
[0137] By pre-training the invoices of different business types through the pre-training module, the target pixel regions corresponding to the invoices of different business types are obtained. This makes it easier to quickly determine the corresponding character recognition region based on the business type of the target invoice when using the pixel positioning and recognition model, and to perform OCR recognition and verification on the character recognition region, thereby improving the speed of OCR recognition and verification.
[0138] Further reference Figure 7 In some specific embodiments of this application, the pre-training module 507 further includes: a model correction submodule 5076, which includes a first calculation unit 5076a, a second calculation unit 5076b, a judgment condition unit 5076c, a first judgment result unit 5076d, and a second judgment result unit 5076e, wherein:
[0139] The first calculation unit 5076a is used to obtain the ratio of the character recognition area of each PDF file to the total area of the PDF file in the same type of PDF files;
[0140] The second calculation unit 5076b is used to traverse the ratio values and obtain the ratio of the number of ratio values within a preset allowable error to the number of similar PDF files.
[0141] The judgment condition unit 5076c is used to determine whether the percentage value meets the preset percentage threshold.
[0142] The first judgment result unit 5076d is used to determine that if the preset proportion threshold is met, the character recognition area does not need to be corrected.
[0143] The second judgment result unit 5076e is used to repeatedly execute the pre-training module 507 if the preset proportion threshold is not met, until the proportion value meets the preset proportion threshold, and complete the correction processing of the character recognition region.
[0144] The model correction submodule calculates the character recognition regions corresponding to each PDF file in the same business category, filters them according to a preset proportion threshold, and determines whether the character recognition regions need to be corrected. Through correction, the accuracy of the pixel positioning and recognition model in locating the target pixel region is further improved, ensuring the speed and accuracy of OCR recognition verification results.
[0145] Further reference Figure 8 In some specific embodiments of this application, the ticket recognition and verification device 500 further includes: a security encryption module 508, which includes an encryption submodule 5081, a first update submodule 5082, and a second update submodule 5083, wherein:
[0146] The encryption submodule 5081 is used to encrypt each string in the actual value and each ticket data in the estimated value based on the DES symmetric encryption algorithm.
[0147] The first update submodule 5082 is used to obtain the encrypted ciphertext corresponding to each string in the actual value, and use the encrypted ciphertext to update the corresponding string in the actual value;
[0148] The second update submodule 5083 is used to obtain the encrypted ciphertext corresponding to each bill data in the estimated value, and use the encrypted ciphertext to update the corresponding bill data in the estimated value.
[0149] Further reference Figure 9 In some specific embodiments of this application, the invoice recognition and verification device 500 further includes: a verification failure processing module 509, which includes a first filtering submodule 5091, a second acquisition submodule 5092, a second filtering submodule 5093, and a tag setting submodule 5094, wherein:
[0150] The first filtering submodule 5091 is used to filter out the string that failed verification in the actual value and the corresponding bill data in the estimated value if the target bill fails to be verified by traversing and comparing the data in the actual value and the estimated value.
[0151] The second acquisition submodule 5092 performs character splitting on the string and the ticket data respectively to obtain the corresponding single character set;
[0152] The second filtering submodule 5093 filters out single characters that fail verification by traversing and comparing the corresponding single character set.
[0153] The tag setting submodule 5094 tags the single character that failed the verification, and sets an association relationship based on the single character tagged as the single character that failed the verification and the estimated value.
[0154] After a verification failure, the verification failure processing module obtains the specific single character corresponding to the verification failure and marks it. This makes it easier to directly determine the reference character corresponding to the single character when the single character is identified again in subsequent verifications, thereby further improving the accuracy and efficiency of the verification.
[0155] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0156] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0157] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 10 , Figure 10 This is a basic structural block diagram of the computer device in this embodiment.
[0158] The computer device 10 includes a memory 10a, a processor 10b, and a network interface 10c that are interconnected via a system bus. It should be noted that only the computer device 10 with components 10a-10c is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0159] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0160] The memory 10a includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10a may be an internal storage unit of the computer device 10, such as the hard disk or memory of the computer device 10. In other embodiments, the memory 10a may also be an external storage device of the computer device 10, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the memory 10a may include both internal storage units and external storage devices of the computer device 10. In this embodiment, the memory 10a is typically used to store the operating system and various application software installed on the computer device 10, such as computer-readable instructions for a ticket recognition and verification method. In addition, the memory 10a can also be used to temporarily store various types of data that have been output or will be output.
[0161] In some embodiments, the processor 10b may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 10b is typically used to control the overall operation of the computer device 10. In this embodiment, the processor 10b is used to execute computer-readable instructions stored in the memory 10a or to process data, for example, to execute computer-readable instructions for the ticket recognition and verification method.
[0162] The network interface 10c may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 10 and other electronic devices.
[0163] The computer device proposed in this embodiment belongs to the field of digital healthcare and is applied to the field of medical-related invoice recognition. This application receives an invoice recognition request; obtains the PDF file corresponding to the target invoice; identifies the target pixel region based on a pre-trained pixel positioning recognition model; extracts characters within the target pixel region using OCR optical recognition technology to obtain actual values; obtains invoice data to obtain an estimated value; and determines whether the target invoice has been successfully verified based on the comparison between the actual value and the estimated value. This application uses a method of comparing OCR recognition results with wide table results for OCR recognition verification. By determining whether the verification result is successful, the characters recognized by OCR are optimized for verification. Furthermore, by using an incremental verification optimization method, OCR recognition is scheduled for invoices of different business types according to their business type and verification priority, ensuring invoice recognition speed, intelligently recognizing medical data in medical invoices, and reducing the human review burden on doctors.
[0164] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by a processor to cause the processor to perform the steps of the above-described ticket recognition and verification method.
[0165] The computer-readable storage medium proposed in this embodiment belongs to the field of digital healthcare and is applied to the field of medical-related invoice recognition. This application receives an invoice recognition request; obtains the PDF file corresponding to the target invoice; identifies the target pixel region based on a pre-trained pixel positioning recognition model; extracts characters within the target pixel region using OCR optical recognition technology to obtain actual values; obtains invoice data to obtain an estimated value; and determines whether the target invoice has been successfully verified based on the comparison between the actual value and the estimated value. This application uses a method of comparing OCR recognition results with wide table results for OCR recognition verification. By determining whether the verification result is successful, the characters recognized by OCR are optimized for verification. Furthermore, by using an incremental verification optimization method, OCR recognition is scheduled for invoices of different business types according to their business type and verification priority, ensuring invoice recognition speed, intelligently recognizing medical data in medical invoices, and reducing the human review burden on doctors.
[0166] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0167] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A method of ticket identification verification, characterized by, Includes the following steps: Receive a ticket identification request, wherein the ticket identification request includes the cache address of the PDF file corresponding to the target ticket and the identification information of the target ticket; Based on the cache address, obtain the PDF file corresponding to the target ticket; The PDF file is input into a pre-trained pixel localization and recognition model to identify the target pixel region in the PDF file to be recognized by OCR. The characters within the target pixel region are extracted using OCR recognition technology to obtain the actual values; Based on the identification information and the preset bill data cache wide table, the bill data is obtained from the bill data cache wide table to obtain the estimated value; Based on the comparison between the actual value and the estimated value, it is determined whether the target invoice has been successfully verified. Combining the results of each verification, the priority of invoice identification for different business types is fine-tuned, so that invoice types that have been successfully verified will be prioritized for verification in subsequent verifications. Invoices for different business types refer to those corresponding to personal health records, prescriptions, examination reports, and registration vouchers, respectively. The specific implementation method is as follows: Pre-set verification priorities for invoices of different business types; Based on the cosine similarity algorithm, the similarity between the data in the actual value and the data in the estimated value is identified; Determine whether the similarity is greater than a preset similarity threshold; If the similarity is greater than the preset similarity threshold, the target invoice is successfully verified, and the verification priority of the business type corresponding to the target invoice is increased based on the preset priority increment algorithm. If the similarity is not greater than a preset similarity threshold, the verification of the target invoice fails, and the verification priority of the business type corresponding to the target invoice is reduced based on a preset priority deduction algorithm.
2. The method of claim 1, wherein Before the step of inputting the PDF file into the pre-trained pixel localization and recognition model to identify the target pixel region to be recognized by OCR in the PDF file, the method further includes: Step A: Batch obtain PDF files corresponding to invoices of different business types; Step B: Input the PDF file into the initialized pixel positioning recognition model, and classify the PDF file according to the preset classification rules in the pixel positioning recognition model. The preset classification rules are to classify the invoice PDF files of the same business according to the business type. Step C: Based on the classification results, preprocess the PDF files of the same type. The preprocessing steps include: scaling the PDF file to the target size, enhancing the contrast and clarity of the scaled PDF file, and optimizing the edges of the characters in the enhanced PDF file. The target size is the preset optimal size of the PDF file for OCR optical recognition. Step D: Based on OCR optical recognition technology, recognize the characters in the pre-processed PDF files of the same type, and obtain the character recognition area of the PDF files of the same type based on the recognition results; Step E: Use the character recognition region as the target pixel region to be OCR recognized in the current category PDF file to obtain the pre-trained pixel localization and recognition model.
3. The document identification and verification method according to claim 2, characterized in that, Before the step of using the character recognition region as the target pixel region for OCR recognition in the current category PDF file, the method further includes: Step F: Obtain the ratio of the character recognition area of each PDF file to the total area of the PDF file; Step G: Iterate through the ratio values and obtain the ratio of the number of ratio values within the preset allowable error to the number of similar PDF files; Step H: Determine whether the percentage value meets the preset percentage threshold; Step I: If the preset percentage threshold is met, the character recognition area does not need to be corrected. Step J: If the preset percentage threshold is not met, repeat steps A to H until the percentage value meets the preset percentage threshold, thus completing the correction process for the character recognition area.
4. The document identification and verification method according to claim 1, characterized in that, The step of extracting characters within the target pixel region based on OCR recognition technology to obtain actual values specifically includes: After extracting the characters within the target pixel area, the characters are obtained line by line, and the spacing between the characters in the same line is identified to determine the spacing between two adjacent characters. Distinguishing marks are then set at the spacing. Determine whether the spacing is greater than a preset character spacing threshold; If the spacing is not greater than a preset character spacing threshold, then delete the distinguishing label corresponding to the spacing; If the spacing is greater than a preset character spacing threshold, then the distinguishing label corresponding to the spacing is retained; Using the retained distinguishing markers as the segmentation positions, the characters in the same line are segmented, and the segmented strings are obtained as the actual values.
5. The document identification and verification method according to claim 1, characterized in that, Before the step of determining whether the target bill has been successfully verified based on the comparison between the actual value and the estimated value, the method further includes: Based on the DES symmetric encryption algorithm, each string in the actual value and each invoice data in the estimated value are encrypted. Obtain the encrypted ciphertext corresponding to each string in the actual value, and update the corresponding string in the actual value using the encrypted ciphertext; Obtain the encrypted ciphertext corresponding to each bill data in the estimated value, and use the encrypted ciphertext to update the corresponding bill data in the estimated value.
6. The document identification and verification method according to claim 1, characterized in that, After the step of determining whether the target bill has been successfully verified based on the comparison between the actual value and the estimated value, the method further includes: If the target invoice verification fails, the actual value and the estimated value are traversed and compared to filter out the string that failed verification in the actual value and the invoice data corresponding to the string in the estimated value. The string and the ticket data are split into character sets to obtain corresponding single character sets; By traversing and comparing the corresponding set of single characters, single characters that failed verification were filtered out. The single character that fails verification is marked, and an association relationship is set based on the single character marked as failing verification and the corresponding single character in the estimated value.
7. A document recognition and verification device, characterized in that, include: The request receiving module is used to receive a ticket identification request, wherein the ticket identification request includes the cache address of the PDF file corresponding to the target ticket and the identification information of the target ticket; The ticket acquisition module is used to acquire the PDF file corresponding to the target ticket based on the cache address; The model recognition module is used to input the PDF file into a pre-trained pixel localization and recognition model to identify the target pixel region to be OCR recognized in the PDF file. The actual value extraction module is used to extract characters within the target pixel area based on OCR recognition technology to obtain the actual value; The estimated value acquisition module is used to obtain the estimated value by retrieving the bill data from the bill data cache wide table based on the identification information and the preset bill data cache wide table. The verification and judgment module is used to determine whether the target invoice has been successfully verified based on the comparison between the actual value and the estimated value. Combining the results of each verification, the priority of invoice identification for different business types is fine-tuned, so that invoice types that have been successfully verified are given priority in subsequent verifications. Invoices for different business types refer to those corresponding to personal health records, prescriptions, examination reports, and registration vouchers, respectively. The specific implementation method is as follows: Pre-set verification priorities for invoices of different business types; Based on the cosine similarity algorithm, the similarity between the data in the actual value and the data in the estimated value is identified; Determine whether the similarity is greater than a preset similarity threshold; If the similarity is greater than the preset similarity threshold, the target invoice is successfully verified, and the verification priority of the business type corresponding to the target invoice is increased based on the preset priority increment algorithm. If the similarity is not greater than a preset similarity threshold, the verification of the target invoice fails, and the verification priority of the business type corresponding to the target invoice is reduced based on a preset priority deduction algorithm.
8. A computer device comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the document recognition and verification method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the ticket recognition and verification method as described in any one of claims 1 to 6.