A method for digital invoice recognition based on computer vision
Through the digital invoice recognition method based on computer vision, combining the verification of digital signature and encrypted feature data, text recognition of deep learning models and clustering of K-means algorithms, the accuracy and security problems of traditional recognition technology in forgery and complex formats are solved, and efficient and accurate invoice recognition and management are achieved.
Patent Information
- Application Number
- CN202411942223.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-01
AI Technical Summary
Traditional digital invoice identification technology is prone to incorrect identification or data leakage when facing forgery and tampering invoices, and has low accuracy in complex invoice formats or different versions of identification.
The digital invoice recognition method based on computer vision is adopted to identify text areas by collecting invoice images, extracting digital signatures and encrypting feature data, initial screening and verification data, inputting the recognition model, and identifying potential subcategories using the K-means algorithm.
Effectively ensure the authenticity and integrity of invoices, improve identification accuracy and security, reduce manual errors, and adapt to the diversity and complexity of different types of digital invoices.
Smart Images

Figure CN119741719A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of digital invoice recognition, and more specifically, to a digital invoice recognition method based on computer vision. Background Art
[0002] With the advancement of digital transformation, digital invoices are becoming increasingly popular in business and government affairs. Traditional paper invoices are gradually being replaced by electronic invoices, which not only have the advantages of electronic storage and transmission, but also can ensure the security and authenticity of invoices through encryption and digital signature technology. In order to efficiently process and manage these large numbers of electronic invoices, digital invoice automatic recognition technology based on OCR (optical character recognition) and machine learning has become a core application and is widely used in financial management, tax auditing, corporate compliance and other fields.
[0003] However, traditional digital invoice recognition is prone to misidentification or data leakage when facing the problem of forged and tampered invoices; secondly, the accuracy of digital invoice recognition of complex invoice formats or different versions is low. In view of the above problems, the present invention proposes a solution. Summary of the invention
[0004] In order to overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a method for digital invoice recognition based on computer vision, which solves the problems raised in the above-mentioned background technology through a method for digital invoice recognition based on computer vision.
[0005] To achieve the above object, the present invention provides the following technical solutions: A method for digital electronic invoice recognition based on computer vision comprises the following steps: collecting a digital electronic invoice image to be recognized, and extracting a digital signature and encrypted feature data from the digital electronic invoice image to be recognized; verifying the digital signature and encrypted feature data, and preliminarily screening the digital electronic invoice image to be recognized to obtain a preliminarily screened digital electronic invoice image; inputting the preliminarily screened digital electronic invoice image into a preset digital electronic invoice recognition model to obtain first recognition data of a text area; using the first recognition data of the text area to identify potential subcategories of the digital electronic invoice using a K-means algorithm, and obtaining second recognition data of the text area for digital electronic invoice recognition.
[0006] In a preferred embodiment, the digital signature and the encrypted feature data are verified, and the digital invoice image to be identified is preliminarily screened to obtain the preliminarily screened digital invoice image, specifically: the digital signature and the encrypted feature data are verified respectively, and the preliminarily screened comprehensive score of each invoice is obtained based on the preliminarily screened comprehensive score calculation formula; if the preliminarily screened comprehensive score of each invoice is greater than or equal to 0, the invoice passes the screening; if the preliminarily screened comprehensive score of each invoice is less than 0, the invoice is screened out.
[0007] In a preferred embodiment, respectively verifying the digital signature and the encrypted characteristic data includes verifying the digital signature and verifying the encrypted characteristic data, specifically: the verification of the digital signature specifically includes: extracting the invoice content in each invoice and the public key required for signature verification; performing hash value calculation on the invoice content in each invoice to obtain a first hash value; using the public key required for signature verification to decrypt the digital signature based on a formula to obtain a second hash value; comparing the first hash value and the second hash value to obtain a signature verification error value.
[0008] In a preferred embodiment, the verification of the encrypted characteristic data is specifically as follows: extracting the encrypted field of each invoice and the private key used for decryption; using the private key to decrypt the encrypted field of each invoice to obtain the decrypted data of the invoice; extracting the plaintext data of each invoice, and comparing the decrypted data of the invoice with the plaintext data of each invoice to obtain the difference value between the decrypted field and the plaintext field.
[0009] In a preferred embodiment, the digital electrical invoice image after the initial screening is input into a preset digital electrical invoice recognition model to obtain the first recognition data of the text area, specifically: each text area of the digital electrical invoice image after the initial screening is marked and the corresponding annotation data is set to obtain the marked digital electrical invoice image after the initial screening, and the annotation data includes but is not limited to the invoice number, invoice code, amount, and tax amount; the marked digital electrical invoice image after the initial screening is input into a preset target detection model for convolution operation to obtain several groups of text area bounding box coordinate information and corresponding text area categories; the several groups of text area bounding box coordinate information and the corresponding text area categories are input into the paddleocr model to recognize the text in the text area, and each text area field is output; each text area field is matched with a preset field label list based on a matching formula, and each text area field is combined with the corresponding field label to obtain the first recognition data of the text area.
[0010] In a preferred embodiment, the first recognition data of the text area is used to identify potential subcategories of digital electronic invoices using the K-means algorithm, and the second recognition data of the text area is obtained for digital electronic invoice recognition, specifically: the first recognition data of the text area is converted into a text area feature vector, and the text area feature vector includes text area fields, text area coordinates and text area categories; the text area feature vector is clustered based on the K-means algorithm to obtain the second recognition data of the text area for digital electronic invoice recognition.
[0011] In a preferred embodiment, the text area feature vectors are clustered based on the K-means algorithm to obtain the second identification data of the text area for digital invoice recognition, specifically: K initial cluster centers are randomly selected, and the Euclidean distance between each text area feature vector and the K initial cluster centers is calculated; each text area feature vector is assigned to the nearest initial cluster center based on the Euclidean distance between each text area feature vector and the K initial cluster centers; the average eigenvalue of all text area feature vectors in the initial cluster center is calculated, and the average eigenvalue is used as the new cluster center; the above steps are repeated until the cluster center no longer changes, and the potential subcategory label to which each text area belongs is obtained; the potential subcategory label to which each text area belongs is used as the second identification data of the text area for digital invoice recognition.
[0012] The technical effects and advantages of the computer vision-based digital invoice recognition method of the present invention are as follows: 1. The present invention can effectively ensure the authenticity and integrity of the digital invoice image to be identified by extracting and verifying digital signatures and encrypted feature data. Digital signature and encryption technology can verify whether the source and content of the invoice have been tampered with, avoiding the potential risks of forged invoices to the system. This initial screening step provides security for subsequent invoice identification, ensuring that only legal and valid invoices are included in the identification process; secondly, the preset digital invoice recognition model can be used to efficiently perform preliminary identification of the text area in the digital invoice and automatically extract the key fields of the invoice (such as invoice number, amount, tax amount, etc.). Compared with traditional manual recognition, this deep learning-based automated recognition technology not only improves the efficiency of recognition, but also reduces manual errors and ensures the accuracy of the recognition results; by applying the first recognition data to the K-means algorithm, potential subcategories are further identified. The K-means clustering algorithm can cluster similar text areas together, thereby helping the model to identify the differences between different invoice categories and fields, and improve the accuracy and robustness of recognition. For example, in digital invoices, there may be different types of field formats or layouts. Clustering can automatically classify them, thereby improving the accuracy of subsequent processing. Finally, by combining the above steps, the entire process can automatically complete the classification and field recognition of invoices, while ensuring security and improving recognition efficiency and accuracy. The overall solution not only improves the intelligence level of invoice recognition, but also adapts to the diversity and complexity of different types of digital invoices, effectively solving the problems of errors and inefficiency that are prone to occur in traditional manual recognition. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 The present invention is a flowchart of a method for digital invoice recognition based on computer vision. DETAILED DESCRIPTION
[0013] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0014] Embodiment 1, Figure 1 The present invention provides a method for recognizing digital invoices based on computer vision, comprising the following steps: S1, collecting a digital invoice image to be identified, and extracting a digital signature and encrypted feature data from the digital invoice image to be identified; In this example, the digital invoice image to be identified is collected, and the digital signature and encrypted feature data in the digital invoice image to be identified are extracted, specifically: The digital signature in the digital invoice image identified is: Digital signatures are usually generated using public key cryptography algorithms (such as RSA, ECC, etc.). The sender of the invoice (e.g., the invoice issuer) uses a private key to encrypt the invoice content (such as invoice number, amount, date, etc.) to generate a unique signature that can be attached to the invoice data; The encrypted feature data is as follows: Encrypted feature data may include key information of the invoice, such as invoice number, amount, tax amount, invoice issuer, recipient, etc. These data are encrypted using symmetric encryption or asymmetric encryption algorithms (such as AES, RSA) when stored.
[0015] It should be noted that in the process of digital invoice recognition, collecting the invoice image to be recognized and extracting the digital signature and encrypted feature data from it has significant advantages. First, the digital signature provides strong identity authentication and integrity protection for the invoice. By using the public key encryption algorithm, the digital signature ensures that the invoice content has not been tampered with, avoids the risk of forgery or tampering, and greatly improves the credibility of the invoice. This mechanism can not only verify the source of the invoice, but also ensure the data integrity of the invoice during transmission and prevent the spread of false information.
[0016] Secondly, encrypted feature data can protect sensitive information in invoices, such as amount, tax amount, invoice number, etc. During storage and transmission, sensitive data is encrypted and only authorized parties can decrypt and obtain it, ensuring the security and privacy of the invoice content. This approach effectively prevents data leakage and illegal access, and greatly enhances the system's security protection capabilities, especially when processing large amounts of sensitive data.
[0017] Through the combination of these two technologies, the digital invoice image to be identified can be efficiently identified and processed while ensuring security and reliability. The introduction of digital signatures and encrypted feature data has greatly improved the security, accuracy and credibility of the invoice recognition system, providing enterprises and government departments with a more reliable and compliant electronic invoice management solution.
[0018] S2, verifying the digital signature and the encrypted feature data, and preliminarily screening the digital invoice image to be identified to obtain a preliminarily screened digital invoice image; In this example, the digital signature and the encrypted feature data are verified, and the digital invoice image to be identified is preliminarily screened to obtain the preliminarily screened digital invoice image, specifically: Verifying the digital signature and the encrypted feature data respectively, and obtaining the preliminary screening comprehensive score of each invoice based on the preliminary screening comprehensive score calculation formula; If the initial screening comprehensive score of each invoice is greater than or equal to 0, the invoice passes the screening; If the initial screening comprehensive score of each invoice is less than 0, it will be screened out.
[0019] In this example, the calculation formula for the initial screening comprehensive score is as follows:
[0020] in, The comprehensive score of the initial screening is and are the weights of signature verification and encryption field verification, is the signature verification error value, is the maximum error value for signature verification, is the difference between the decrypted field and the plaintext field. The maximum difference between the decrypted field and the expected value It should be noted that by verifying the digital signature and encrypted feature data, and evaluating the legitimacy and reliability of the invoice based on the initial screening comprehensive score calculation formula, the security and accuracy of digital invoice recognition can be significantly improved. First of all, the verification of the digital signature ensures the integrity and authenticity of the invoice, and effectively prevents the risk of forgery and tampering by verifying whether the content of the invoice has been tampered with during the transmission process. The verification of the encrypted feature data ensures the security of sensitive information in the invoice, preventing unauthorized personnel from accessing or tampering with key data such as invoice number, amount and tax amount.
[0021] The use of comprehensive scoring methods for initial screening can quantitatively evaluate the compliance of invoices and determine whether they pass the screening based on the scores. By setting a threshold (for example, if the score is greater than or equal to 0, the invoice passes the screening, and if it is less than 0, the invoice is excluded), a clear standard is provided for invoice screening. This method is highly flexible and automated, and can process large amounts of invoice data without manual intervention, significantly improving work efficiency.
[0022] In addition, the comprehensive score calculation formula not only combines the verification of digital signatures and encrypted feature data, but may also include other factors, such as the recognition confidence of invoices, field consistency, etc., further enhancing the accuracy of screening. This comprehensive scoring method avoids the limitations of a single verification method and provides a more comprehensive evaluation basis.
[0023] Through this method, invalid or forged invoices can be efficiently eliminated, and only legal invoices that meet the standards can be retained, which effectively improves the reliability and security of the identification process and realizes the automated and efficient management of digital electronic invoices in practical applications.
[0024] In this example, respectively verifying the digital signature and the encrypted characteristic data includes verifying the digital signature and verifying the encrypted characteristic data, specifically: The verification of the digital signature is specifically as follows: Extract the invoice content and the public key required for signature verification from each invoice; Performing hash value calculation on the invoice content in each invoice to obtain a first hash value; Using the public key required for signature verification to decrypt the digital signature based on a formula to obtain a second hash value; The first hash value and the second hash value are compared to obtain a signature verification error value.
[0025] It should be noted that the combination of hash value calculation of invoice content and public key decryption verification significantly improves the security and accuracy of digital invoice recognition. Specifically, the invoice content and the public key required for signature verification in each invoice are first extracted. This operation ensures that all information of the invoice can be correctly verified, avoiding verification failures caused by information extraction errors.
[0026] Next, the invoice content is processed using hash value calculation to obtain the first hash value. This process can map the original invoice content into a string of fixed length, effectively compressing the complexity of the invoice content and providing a basis for subsequent signature verification. Since the hash algorithm is unidirectional and unique, any slight modification to the invoice content will result in a significant change in the hash value, thereby protecting the integrity of the invoice.
[0027] Then, the digital signature is decrypted by the public key to obtain the second hash value. The use of the public key ensures that only the legitimate invoice issuer can sign and verify the authenticity of the invoice content. By comparing the first hash value and the second hash value, the system can confirm whether the invoice has been tampered with during transmission. If the two are consistent, it means that the invoice content has not been changed and the verification is successful; if the two are inconsistent, it means that there is a difference in the invoice content and it may have been tampered with or forged.
[0028] The advantage of this digital signature verification method is that it provides strong anti-tampering capabilities and identity authentication, which can effectively prevent forged invoices or data leakage. At the same time, through the dual verification of hash value and public key, it can ensure the efficiency and accuracy of the verification process, greatly improve the security of the digital invoice system, and provide a reliable electronic invoice transaction environment for relevant parties.
[0029] In this example, the verification of encrypted feature data is as follows: Extract the encrypted fields of each invoice and the private key used for decryption; Use the private key to decrypt the encrypted fields of each invoice to obtain the decrypted data of the invoice; The plaintext data of each invoice is extracted, and the decrypted data of the invoice is compared with the plaintext data of each invoice to obtain the difference value between the decrypted field and the plaintext field.
[0030] It should be noted that the verification process of encrypted feature data effectively ensures the data security and integrity of digital invoices by comparing the decryption of encrypted fields with plaintext data. First, by extracting the encrypted fields of each invoice and the private key used for decryption, it ensures that only authorized parties can decrypt sensitive information in the invoice, preventing unauthorized personnel from accessing these key data (such as amount, tax amount, invoice number, etc.). This process uses symmetric or asymmetric encryption technology and ensures data security through private keys, so that even if the invoice is intercepted during transmission, malicious attackers cannot obtain sensitive information.
[0031] Next, the private key is used to decrypt the encrypted fields of each invoice to obtain the decrypted data. This operation relies on the strength of the encryption algorithm and the confidentiality of the private key to ensure the accuracy of the decryption process. The invoice information obtained through decryption can be compared with the plaintext data of the invoice. By comparing the differences between the decrypted data and the plaintext data, the system can quickly detect whether there are data inconsistencies, tampering or forgery.
[0032] The difference value obtained during the comparison process can be used as the basis for invoice verification. If the decrypted data is consistent with the plaintext data, it means that the invoice has not been tampered with and the verification has passed; on the contrary, if there is a difference, it means that the invoice content may have been tampered with or forged, and thus it will be eliminated. This mechanism effectively guarantees the integrity and credibility of digital invoices.
[0033] Overall, the advantage of this encrypted feature data verification method is that it can achieve high security protection for sensitive data, and quickly and accurately identify potential forgery and tampering risks by comparing the decryption results with the plaintext data. This process does not require manual review, greatly improving the verification efficiency and accuracy, ensuring the security and compliance of the electronic invoice system, and providing users and institutions with a reliable invoice management solution.
[0034] S3, inputting the pre-screened digital invoice image into a preset digital invoice recognition model to obtain first recognition data of the text area; In this example, the digital invoice image after the initial screening is input into the preset digital invoice recognition model to obtain the first recognition data of the text area, which is specifically: Annotate each text area of the pre-screened digital invoice image and set corresponding annotation data to obtain an annotated pre-screened digital invoice image, wherein the annotation data includes but is not limited to invoice number, invoice code, amount, and tax amount; Input the labeled and pre-screened digital invoice image into a preset target detection model for convolution operation to obtain several sets of text area boundary box coordinate information and corresponding text area categories; Input the plurality of groups of text area bounding box coordinate information and the corresponding text area categories into the PaddleOCR model to recognize the text in the text area, and output each text area field; Each text area field is matched with a preset field label list based on a matching formula, and each text area field is combined with a corresponding field label to obtain first recognition data of the text area.
[0035] In this example, each text area field is matched with a preset field label list based on a matching formula. The specific calculation formula is as follows: in, is the matching value, is the weight coefficient, is the content of the text area, For preset field labels, and The horizontal and vertical coordinates of the upper left corner of the text area, respectively. and Label the horizontal and vertical axes respectively.
[0036] It should be noted that by annotating the text area of the digital invoice image after the initial screening and setting the relevant annotation data (such as invoice number, invoice code, amount, tax amount, etc.), the system can clearly locate each key field in the invoice. This process ensures that each important text area in the invoice image is correctly identified and annotated, providing a clear structure and accurate positioning for subsequent text extraction.
[0037] Next, the annotated image is input into the target detection model for convolution operation. The system automatically learns the text area in the image through the convolutional neural network (CNN) and generates several sets of bounding box coordinates and text area categories. This step can not only accurately locate the text area, but also classify it according to the regional characteristics, thereby providing more efficient and accurate input for text recognition. Compared with traditional manual annotation and processing, this automated process greatly improves recognition efficiency and accuracy.
[0038] Then, the bounding box coordinates and category information of the text area are input into the PaddleOCR model, which performs OCR recognition on each text area and extracts the text fields in the invoice (such as invoice number, amount, etc.). PaddleOCR is a powerful optical character recognition tool that can efficiently recognize text in different fonts and layouts in complex invoice formats.
[0039] Finally, by matching the identified text fields with the preset field label list based on the matching formula, each field is combined with the corresponding label to obtain accurate first recognition data. This process ensures the precise connection between invoice fields and labels, greatly improving the accuracy and consistency of recognition results.
[0040] Overall, this method combines the technical advantages of target detection, OCR recognition and intelligent matching to achieve efficient and accurate invoice field recognition, reduce manual intervention and errors, and improve the level of automated processing of digital invoices. S4, using the first recognition data of the text area to identify potential subcategories of the digital invoice using a K-means algorithm, and obtaining the second recognition data of the text area to perform digital invoice recognition.
[0041] In this example, the first recognition data of the text area is used to identify the potential subcategories of the digital invoice using the K-means algorithm, and the second recognition data of the text area is obtained to identify the digital invoice, specifically: Converting the first recognition data of the text area into a text area feature vector, wherein the text area feature vector includes a text area field, text area coordinates and a text area category; The text area feature vectors are clustered based on the K-means algorithm to obtain second recognition data of the text area for digital invoice recognition.
[0042] It should be noted that by converting the first recognition data of the text area into a text area feature vector and applying the K-means algorithm for clustering, the potential subcategories in the digital invoice can be effectively identified, thereby improving the accuracy and detail of invoice recognition. First, by converting information such as text area fields, coordinates, and categories into feature vectors, complex invoice data can be represented in a structured form, which is convenient for subsequent algorithm processing and analysis. The construction of the feature vector not only takes into account the content of the text, but also includes the spatial location and category information of the text, making the features richer and able to capture more invoice features.
[0043] Then, based on K-means clustering, the system can automatically identify text regions with similar features and assign them to corresponding subcategories. The K-means algorithm can group similar field information in the invoice together by dividing the text region feature vectors into several clusters, and automatically discover potential field patterns or categories, such as invoice number, tax amount, amount, etc. This not only improves the flexibility of recognition, but also can adapt to the format differences that may exist in different types of invoices, reducing the need for manual intervention.
[0044] Finally, the second recognition data after K-means clustering can more accurately reflect the true meaning of each text area, thereby improving the accuracy and efficiency of the entire digital invoice recognition process. This method combines automated clustering analysis with traditional text recognition technology, fully leveraging the advantages of machine learning and having high adaptability and scalability.
[0045] In this example, the text region feature vector is clustered based on the K-means algorithm to obtain the second recognition data of the text region for digital invoice recognition, specifically: Randomly select K initial cluster centers, and calculate the Euclidean distance between each text region feature vector and the K initial cluster centers; Assigning each text region feature vector to the nearest initial cluster center based on the Euclidean distance between each text region feature vector and the K initial cluster centers; Calculating the average eigenvalue of all text region feature vectors within the initial cluster center, and using the average eigenvalue as a new cluster center; Repeat the above steps until the cluster center no longer changes, and obtain the potential subcategory label to which each text region belongs; The potential subcategory label to which each text region belongs is used as the second identification data of the text region to perform digital invoice identification.
[0046] In this example, the average eigenvalue of all text region feature vectors in the initial cluster center is calculated, and the average eigenvalue is used as the new cluster center. The specific calculation formula is as follows:
[0047] in, is the new cluster center of the kth cluster, is the set of text regions contained in the kth cluster, is the weight of the i-th text region, is the feature vector of the i-th text region.
[0048] It should be noted that by applying the K-means algorithm to cluster text region feature vectors, the accuracy and automation of digital invoice recognition can be significantly improved. First, the K-means algorithm effectively groups text regions with similar features by randomly selecting the initial cluster center and calculating the Euclidean distance between each text region feature vector and the initial cluster center. This process automatically identifies potential subcategories in the invoice, such as invoice number, amount, tax amount and other fields, making the subsequent recognition process more efficient.
[0049] Next, based on the distance between each text region feature vector and the initial cluster center, the text region is assigned to the closest cluster center, and the cluster center is updated by calculating the average value of the feature vector within the cluster. This update method based on cluster features can not only continuously optimize the accuracy of the cluster, but also adapt to changes in different invoice styles and formats.
[0050] The algorithm iterates and updates the cluster center until the cluster center is stable, and finally obtains the potential subcategory label to which each text region belongs. Such an adaptive clustering method can handle a large amount of different types of invoice data without manual intervention, thereby greatly improving recognition efficiency and accuracy.
[0051] In general, the K-means clustering method improves the recognition accuracy and flexibility of digital invoices by effectively and automatically classifying invoice text areas, and is particularly suitable for processing complex and diverse invoice data.
[0052] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0053] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product.
[0054] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0055] In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0056] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0057] Finally: The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for digital invoice recognition based on computer vision, characterized in that: The following steps are involved: Collecting the digital invoice image to be identified, and extracting the digital signature and encrypted feature data in the digital invoice image to be identified; Verify the digital signature and the encrypted feature data, perform a preliminary screening on the digital invoice image to be identified, and obtain a digital invoice image after the preliminary screening; Inputting the pre-screened digital invoice image into a preset digital invoice recognition model to obtain first recognition data of the text area; The first recognition data of the text area is used to identify potential subcategories of digital invoices using a K-means algorithm, and the second recognition data of the text area is obtained to perform digital invoice recognition.
2. The method for digital invoice recognition based on computer vision according to claim 1 is characterized in that: The digital signature and the encrypted feature data are verified, and the digital invoice image to be identified is preliminarily screened to obtain the preliminarily screened digital invoice image, specifically: Verifying the digital signature and the encrypted feature data respectively, and obtaining the preliminary screening comprehensive score of each invoice based on the preliminary screening comprehensive score calculation formula; If the initial screening comprehensive score of each invoice is greater than or equal to 0, the invoice passes the screening; If the initial screening comprehensive score of each invoice is less than 0, it will be screened out.
3. The method for digital invoice recognition based on computer vision according to claim 2 is characterized in that: Verifying the digital signature and the encrypted characteristic data separately includes verifying the digital signature and verifying the encrypted characteristic data, specifically: The verification of the digital signature is specifically as follows: Extract the invoice content and the public key required for signature verification from each invoice; Performing hash value calculation on the invoice content in each invoice to obtain a first hash value; Using the public key required for signature verification to decrypt the digital signature based on a formula to obtain a second hash value; The first hash value and the second hash value are compared to obtain a signature verification error value.
4. The method for recognizing digital invoices based on computer vision according to claim 3 is characterized in that: The verification of the encrypted characteristic data is specifically as follows: Extract the encrypted fields of each invoice and the private key used for decryption; Use the private key to decrypt the encrypted fields of each invoice to obtain the decrypted data of the invoice; The plaintext data of each invoice is extracted, and the decrypted data of the invoice is compared with the plaintext data of each invoice to obtain the difference value between the decrypted field and the plaintext field.
5. The method for recognizing digital invoices based on computer vision according to claim 4 is characterized in that: The digital invoice image after the initial screening is input into the preset digital invoice recognition model to obtain the first recognition data of the text area, which is specifically: Annotate each text area of the pre-screened digital invoice image and set corresponding annotation data to obtain an annotated pre-screened digital invoice image, wherein the annotation data includes but is not limited to invoice number, invoice code, amount, and tax amount; Input the labeled and pre-screened digital invoice image into a preset target detection model for convolution operation to obtain several sets of text area boundary box coordinate information and corresponding text area categories; Input the plurality of groups of text area bounding box coordinate information and the corresponding text area categories into the PaddleOCR model to recognize the text in the text area, and output each text area field; Each text area field is matched with a preset field label list based on a matching formula, and each text area field is combined with a corresponding field label to obtain first recognition data of the text area.
6. The method for digital invoice recognition based on computer vision according to claim 5 is characterized in that: The first recognition data of the text area is used to identify the potential subcategories of the digital invoice using the K-means algorithm, and the second recognition data of the text area is obtained to identify the digital invoice, specifically: Converting the first recognition data of the text area into a text area feature vector, wherein the text area feature vector includes a text area field, text area coordinates and a text area category; The text area feature vectors are clustered based on the K-means algorithm to obtain second recognition data of the text area for digital invoice recognition.
7. The method for digital invoice recognition based on computer vision according to claim 6 is characterized in that: The text region feature vector is clustered based on the K-means algorithm to obtain the second recognition data of the text region for digital invoice recognition, specifically: Randomly select K initial cluster centers, and calculate the Euclidean distance between each text region feature vector and the K initial cluster centers; Assigning each text region feature vector to the nearest initial cluster center based on the Euclidean distance between each text region feature vector and the K initial cluster centers; Calculating the average eigenvalue of all text region feature vectors within the initial cluster center, and using the average eigenvalue as a new cluster center; Repeat the above steps until the cluster center no longer changes, and obtain the potential subcategory label to which each text region belongs; The potential subcategory label to which each text region belongs is used as the second identification data of the text region to perform digital invoice identification.
8. The method for recognizing digital invoices based on computer vision according to claim 7 is characterized in that: The calculation formula of the preliminary screening comprehensive score is as follows: in, The comprehensive score of the initial screening is and are the weights of signature verification and encryption field verification, respectively. is the signature verification error value, is the maximum error value for signature verification, is the difference between the decrypted field and the plaintext field. The maximum difference between the decrypted field and the expected value.
9. The method for recognizing digital invoices based on computer vision according to claim 8, characterized in that: Each text area field is matched with a preset field label list based on a matching formula. The specific calculation formula is as follows: in, is the matching value, is the weight coefficient, is the content of the text area, For preset field labels, and The horizontal and vertical coordinates of the upper left corner of the text area, respectively. and Label the horizontal and vertical axes respectively.
10. The method for digital invoice recognition based on computer vision according to claim 9 is characterized in that: Calculate the average eigenvalue of all text region feature vectors in the initial cluster center, and use the average eigenvalue as the new cluster center. The specific calculation formula is as follows: in, is the new cluster center of the kth cluster, is the set of text regions contained in the kth cluster, is the weight of the i-th text region, is the feature vector of the i-th text region.