Bill identification method and device, computer equipment, readable storage medium and program product
By identifying and processing bill images, determining languages and obtaining corresponding bill templates, the problem of traditional technology being difficult to identify bills in different countries and regions is solved, and adapting to multiple bill standards and accurate information extraction is achieved.
Patent Information
- Application Number
- CN202411517333.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-18
AI Technical Summary
Traditional bill recognition methods are difficult to identify bills from different countries and regions, and cannot adapt to differences in multiple languages and standards.
By obtaining the target bill file, identifying the bill image, performing optical character recognition, determining the language and obtaining the corresponding bill template, and finally obtaining the bill information based on the template and text information.
It has achieved accurate identification and information extraction of bill documents in different countries, regions and languages, adapted to multiple bill standards, and improved the universality and accuracy of bill processing.
Smart Images

Figure CN119478989A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of bill technology, and in particular to a bill identification method, apparatus, computer equipment, computer-readable storage medium and computer program product. Background Art
[0002] In daily life, people often need to use various bills, such as invoices, checks, etc., and companies also need to count and identify various bills for company accounting needs. However, traditional bill recognition methods can usually only recognize domestic standardized bills, and it is difficult to recognize bills from different countries and regions. Summary of the invention
[0003] Based on this, it is necessary to provide a bill recognition method, device, computer equipment, computer-readable storage medium and computer program product that can recognize bills from different countries and regions in order to address the above technical problems.
[0004] In a first aspect, the present application provides a bill recognition method, comprising:
[0005] Get the target bill file;
[0006] identifying at least one bill image from the target bill file;
[0007] Performing optical character recognition on the bill image to obtain the bill text in the bill image;
[0008] Determine the language of the bill text and obtain the bill template corresponding to the language;
[0009] Based on the bill template and the bill text, the bill information is obtained.
[0010] In one embodiment, the target bill file is a target invoice file; and identifying at least one bill image from the target bill file comprises:
[0011] Acquire target invoice features in the target invoice file, and match the target invoice features with reference invoice features;
[0012] If the target invoice feature matches the reference invoice feature, indicating that the target invoice feature is an independent invoice feature, a bill image is determined based on the target invoice feature.
[0013] In one embodiment, determining the bill image based on the target invoice feature includes:
[0014] Determining the text box to which the target invoice feature belongs;
[0015] The area included in the text box is determined as the bill image.
[0016] In one embodiment, the method further comprises:
[0017] If the target invoice file includes at least two pages of sub-invoice files, the at least two pages of sub-invoice files are split to obtain each page of sub-invoice files;
[0018] The obtaining of the target invoice features in the target invoice file and matching the target invoice features with the reference invoice features includes:
[0019] For each page of the sub-invoice file, the target invoice features in the sub-invoice file are obtained, and the target invoice features are matched with the reference invoice features.
[0020] In one embodiment, the acquiring the bill information based on the bill template and the bill text includes:
[0021] Matching the bill template with the bill text to generate a large language model prompt word; the large language model prompt word includes the tax standard of the area corresponding to the bill template;
[0022] The bill information is obtained from the bill text through the target large language model based on the large language model prompt words.
[0023] In one embodiment, the method further comprises:
[0024] Acquire historical bill information and a first language model; the first language model is used to extract the historical bill information;
[0025] The parameters of the initial model are adjusted based on the historical bill information to obtain a large language model.
[0026] In one embodiment, obtaining the target ticket file includes:
[0027] Obtain the initial bill document;
[0028] Determining the file type of the initial bill file;
[0029] A file parser corresponding to the file type is obtained, and the initial bill file is parsed by the file parser to obtain a target bill file.
[0030] In a second aspect, the present application further provides a bill recognition device, comprising:
[0031] The bill file acquisition module is used to acquire the target bill file;
[0032] A bill image recognition module, used to recognize at least one bill image from the target bill file;
[0033] An optical character recognition module, used for performing optical character recognition on the bill image to obtain the bill text in the bill image;
[0034] A bill template determination module, used to determine the language of the bill text and obtain the bill template corresponding to the language;
[0035] The bill information acquisition module is used to acquire the bill information based on the bill template and the bill text.
[0036] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0037] Get the target bill file;
[0038] identifying at least one bill image from the target bill file;
[0039] Performing optical character recognition on the bill image to obtain the bill text in the bill image;
[0040] Determine the language of the bill text and obtain the bill template corresponding to the language;
[0041] Based on the bill template and the bill text, the bill information is obtained.
[0042] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0043] Get the target bill file;
[0044] identifying at least one bill image from the target bill file;
[0045] Performing optical character recognition on the bill image to obtain the bill text in the bill image;
[0046] Determine the language of the bill text and obtain the bill template corresponding to the language;
[0047] Based on the bill template and the bill text, the bill information is obtained.
[0048] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0049] Get the target bill file;
[0050] identifying at least one bill image from the target bill file;
[0051] Performing optical character recognition on the bill image to obtain the bill text in the bill image;
[0052] Determine the language of the bill text and obtain the bill template corresponding to the language;
[0053] Based on the bill template and the bill text, the bill information is obtained.
[0054] The above-mentioned bill recognition method, device, computer equipment, computer-readable storage medium and computer program product obtain a target bill file, identify at least one bill image from the target bill file, perform optical character recognition on the bill image, obtain the bill text in the bill image, determine the language to which the bill text belongs, and obtain the bill template corresponding to the language. Then, the bill template corresponding to the language can accurately match the bill text, and further obtain bill information for target bill files in different languages of different countries and regions. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0056] FIG1 is a schematic diagram of a flow chart of a bill recognition method in one embodiment;
[0057] Figure 2 A schematic diagram of a flow chart of a bill recognition method in another embodiment;
[0058] Figure 3 is a structural block diagram of a bill recognition device in one embodiment;
[0059] Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] In one embodiment, as shown in FIG1 , a bill recognition method is provided. This embodiment is illustrated by applying the method to a computer device, which may be a terminal or a server. It is understandable that the method may also be applied to a system including a terminal and a server, and implemented through the interaction between the terminal and the server. Among them, the terminal may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server may be an independent physical server, a server cluster or a distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0062] In this embodiment, the bill recognition method includes the following steps:
[0063] Step S102, obtaining the target bill file.
[0064] The target ticket file is a file containing ticket information.
[0065] Optionally, obtaining the target bill file includes: obtaining an initial bill file; determining the file type of the initial bill file; obtaining a file parser corresponding to the file type, and parsing the initial bill file through the file parser to obtain the target bill file.
[0066] The computer device receives initial ticket files of different file types, and the file types may be ZIP file type, RAR file type, OFD file type, PDF file type, or XML file type, etc., but are not limited thereto.
[0067] Optionally, the computer device imports the initial bill file into a file parser corresponding to the file type, and parses the initial bill file through the file parser to obtain the target bill file. Supporting bill file input of multiple file types enhances the flexibility of the system and meets the needs of different users.
[0068] Exemplarily, if the file type of the initial bill file is a ZIP file type, a ZIP file parser is obtained to parse the initial bill file, extract the target bill file contained in the initial bill file, and subsequently import the target bill file into the image processing module for image recognition; if the file type of the initial bill file is a RAR file type, a RAR file parser is obtained to parse the initial bill file, extract the target bill file contained in the initial bill file, and subsequently import the target bill file into the image processing module for image recognition; if the file type of the initial bill file is an OFD file type, an OFD file parser is obtained to parse the initial bill file, extract the target bill file contained in the initial bill file, and subsequently import the target bill file into the image processing module for image recognition; Convert the target bill file into a graphic type, and then import the target bill file into the image processing module for image recognition; if the file type of the initial bill file is a PDF file type, obtain a PDF file parser to parse the initial bill file, perform signature verification and key parsing on the initial bill file, obtain the target bill file, and then import the target bill file into the image processing module for image recognition; if the file type of the initial bill file is an XML file type, obtain an XML file parser to parse the initial bill file, convert the initial bill file of the XML file type into a graphic type target bill file, and then import the target bill file into the image processing module for image recognition.
[0069] Optionally, after determining the file type of the initial bill file, determine whether the file type meets the preset requirements; if the file type meets the preset requirements, obtain the file parser corresponding to the file type; if the file type does not meet the preset requirements, generate a prompt message.
[0070] The preset requirements can be set as needed, such as whether there is a file parser that supports the file type, etc. The prompt information can be used to indicate that the user's file type is illegal and that the user should operate according to the required file type.
[0071] Step S104: identifying at least one bill image from the target bill file.
[0072] The bill image is an image containing bill information. Each bill image corresponds to an independent bill. For example, one bill image corresponds to one invoice.
[0073] Optionally, the computer device obtains the bill feature from the target bill file and matches the bill feature with the reference feature; if the bill feature matches the reference feature, the area to which the bill feature belongs is determined as a bill image. The bill feature may be a field, keyword, tag, etc. of the bill, but is not limited thereto. The reference feature is used to characterize the features of an independent bill image.
[0074] Exemplarily, the computer device recognizes the keyword "check" from the target bill file, and can use the area to which the keyword "check" belongs as a bill image.
[0075] Exemplarily, the computer device recognizes the keyword "invoice" from the target bill file, and the acquired invoice features match the reference invoice features, then the area to which the keyword "invoice" and the invoice features belong can be regarded as a bill image.
[0076] Step S106, performing optical character recognition on the bill image to obtain the bill text in the bill image.
[0077] Among them, Optical Character Recognition (OCR) is a method that converts printed or handwritten text into machine-readable text through image recognition technology, and is often used to extract text from scanned documents and pictures.
[0078] Computer equipment calls the OCR recognition service to perform optical character recognition on the bill image and extract the common bill text in the bill image to ensure the accuracy of the bill data. OCR recognition can adapt to the text layout and format of different bill images to ensure the accuracy of text information extraction.
[0079] Step S108, determine the language of the bill text and obtain the bill template corresponding to the language.
[0080] Among them, language is the linguistic language type, such as Chinese, English, Russian, Arabic, French or Spanish.
[0081] Optionally, the computer device determines the language of the bill text, determines the language of the bill text, and obtains the bill template corresponding to the language from the template library. The template library pre-stores bill templates corresponding to languages of different countries and regions, and the bill templates are set with tax policies and other standards corresponding to languages of different countries and regions. The bill template can be designed as needed, such as invoice type, amount, item details, etc.
[0082] Optionally, if the language of the bill text is within the language support range, the bill template corresponding to the language is obtained; if the language of the bill text is not within the language support range, the process terminates. The language support range is the range of languages corresponding to the bill templates in the template library.
[0083] Step S110, acquiring bill information based on the bill template and bill text.
[0084] The bill information is the information required in the target bill file, and the bill template is provided with a field for the required bill information.
[0085] Optionally, the computer device matches the bill text with the bill template and obtains the bill information from the bill text.
[0086] The above-mentioned bill recognition method obtains a target bill file, recognizes at least one bill image from the target bill file, performs optical character recognition on the bill image, obtains the bill text in the bill image, determines the language to which the bill text belongs, and obtains the bill template corresponding to the language. Then, the bill template corresponding to the language can accurately match the bill text, and then the bill information can be obtained for target bill files in different languages of different countries and regions; and it can ensure that the bill information meets the requirements of the country corresponding to the language. Furthermore, the computer device can also provide a simple and easy-to-use interface, so that users can easily upload and process bill files.
[0087] In one embodiment, the target bill file is a target invoice file; identifying at least one bill image from the target bill file includes: obtaining a target invoice feature in the target invoice file, and matching the target invoice feature with a reference invoice feature; if the target invoice feature matches the reference invoice feature, indicating that the target invoice feature is an independent invoice feature, then determining the bill image based on the target invoice feature.
[0088] The target invoice feature is a feature extracted from the target invoice file. The reference invoice feature is an independent invoice feature. Optionally, both the target invoice feature and the reference invoice feature are vector features.
[0089] Optionally, the computer device obtains the target invoice feature from the target invoice file, and performs vector matching on the target invoice feature and the reference invoice feature; if the target invoice feature and the reference invoice feature match, indicating that the target invoice feature is an independent invoice feature, the bill image is determined based on the target invoice feature; if the target invoice feature and the reference invoice feature do not match, the target invoice feature is discarded, and the process returns to the step of obtaining the target invoice feature in the target invoice file.
[0090] Optionally, determining the bill image based on the target invoice feature includes: determining a text box to which the target invoice feature belongs; and determining an area included in the text box as the bill image.
[0091] The computer device performs image detection on the target invoice file and detects the text box in the target invoice file; if the target invoice feature matches the reference invoice feature, the text box to which the target invoice feature belongs is determined, and the area included in the text box is determined as the bill image. The bill image is the invoice image.
[0092] Optionally, the computer device uses a dotted line mark to mark the text box to which the target invoice feature belongs, and obtains the bill image according to the dotted line mark, thereby ensuring the independence and accuracy of each invoice image.
[0093] Optionally, the above method also includes: if the target invoice file includes at least two pages of sub-invoice files, then at least two pages of sub-invoice files are divided to obtain each page of sub-invoice files; the target invoice features in the target invoice file are obtained, and the target invoice features are matched with the reference invoice features, including: for each page of sub-invoice file, the target invoice features in the sub-invoice file are obtained, and the target invoice features are matched with the reference invoice features.
[0094] If the target invoice file includes a page of sub-invoice files, the target invoice features in the sub-invoice file are obtained for the sub-invoice file, and the target invoice features are matched with the reference invoice features.
[0095] In this embodiment, the computer device obtains the target invoice features in the target invoice file, and matches the target invoice features with the reference invoice features. If the target invoice features match the reference invoice features, characterizing the target invoice features as independent invoice features, the bill image can be accurately determined based on the target invoice features.
[0096] Furthermore, the computer device determines the text box to which the target invoice feature belongs, and can accurately determine the area included in the text box as the bill image, thereby ensuring the independence and accuracy of each invoice image.
[0097] Furthermore, if the target invoice file includes at least two pages of sub-invoice files, the at least two pages of sub-invoice files are segmented to obtain each page of sub-invoice files; for each page of sub-invoice files, the target invoice features in the sub-invoice files are obtained, and the target invoice features are matched with the reference invoice features, so that the invoice features can be accurately matched to determine the bill image.
[0098] In one embodiment, the bill information is obtained based on the bill template and the bill text, including: matching the bill template and the bill text to generate a large language model prompt word; the large language model prompt word includes the tax standards of the area corresponding to the bill template; and obtaining the bill information from the bill text based on the large language model prompt word through a target large language model.
[0099] Among them, the Large Language Model (LLM) is a large-scale model trained by deep learning that can understand and generate natural language text. For example: GPT-4. The large language model prompt is information used to instruct the large language model to obtain bill information. The large language model can be obtained through pre-training. Pre-training means that when building a machine learning model, the model is first trained on a large-scale, general text dataset so that it can learn a wide range of language knowledge and patterns. This process usually does not involve specific tasks, but lays the foundation for the model's broad understanding of language. Common pre-training methods include autoregressive language models (such as the GPT series) and autoencoding language models (such as the BERT series).
[0100] Optionally, the bill template includes a standard bill template and corresponding tax policy information. The computer device matches the bill template and the bill text, and can generate a large language model prompt word for instructing the large language model to extract the required bill information from the bill text.
[0101] For example, for a VAT invoice from country A, the computer device identifies the keyword "Mehrwertsteuer" (value added tax) from the file of the VAT invoice, and determines that the template corresponding to the language is the VAT invoice template of country A. The VAT invoice template presets the tax rate and tax requirements in the tax law of country A. Therefore, the computer device matches the VAT invoice with the extracted bill text, and can accurately generate a large language model prompt word to ensure that the extracted bill information complies with the legal requirements and tax standards of country A. The large language model prompt word may include: "Use the standard VAT template of country A, the tax rate is 19%, the total amount is XXXX euros, the item details are YYY, and the tax calculation method is 'amount × tax rate'". The large language model prompt word complies with the tax standards of country A.
[0102] Optionally, the computer device calls the large language model, and obtains the bill information from the bill text based on the large language model prompt words through the target large language model to ensure that the bill information accurately meets all requirements corresponding to the language.
[0103] The target large language model is based on machine learning and can automatically adapt to different invoice formats and business needs. Machine learning (ML) is a branch of artificial intelligence that learns patterns and rules from data to predict and classify new data.
[0104] By using the large language model for intelligent analysis, anomalies can be detected in bill texts, prompts can be given when anomalies are detected, and the reliability and security of the system can be improved. Computer equipment can call the interface of the large language model multiple times to extract and assemble bill data.
[0105] Optionally, the above method also includes: obtaining historical bill information and a first large language model; the first large language model is used to extract the historical bill information; and adjusting the parameters of the first large language model based on the historical bill information to obtain a target large language model.
[0106] Among them, the first language model is used to extract historical bill information from historical bill files.
[0107] Optionally, the computer device obtains historical bill information at preset time intervals, and regularly adjusts the parameters of the first large language model based on the historical bill information, so as to continuously update a more accurate target large language model; the bill information is obtained from the bill text based on the large language model prompt words through the target large language model.
[0108] It is understandable that the computer device fine-tunes the parameters of the first language model based on the historical ticket information.
[0109] Optionally, the computer device uses the target large language model as the new first large language model, uses the bill information obtained through the target large language model as the historical bill information, and re-executes the step of adjusting the parameters of the first large language model based on the historical bill information to obtain the target large language model.
[0110] The computer equipment regularly fine-tunes the large language model based on historical bill information, ensuring that the large language model can continuously improve its accuracy and adaptability when processing similar bill files; after processing thousands of bills from different countries, the large language model will gradually adapt to the language and tax requirements of different countries, improving the accuracy and efficiency of processing similar invoices in the future. It is understandable that the fine-tuning of the large language model includes some differences in the definition of bills (invoices) in different countries, such as: some are tax-inclusive and some are tax-exclusive, and finally they are uniformly calculated and processed into tax-inclusive and tax-exclusive fields and then given to the business layer. Fine-tuning refers to further training the model for a specific task after the model pre-training is completed. This process uses a smaller-scale, field-specific training data set to adapt the pre-trained model to the requirements of the specific task through fine-tuning. In the fine-tuning stage, the parameters of the model are adjusted according to the data of the specific task to improve its performance on the task.
[0111] Optionally, a combination of rules and machine learning is used to expand the predefined rules of the bill formats of various countries and regions to obtain bill templates. The bill template library dedicated to each country and region is used to customize the bill files of different countries and regions.
[0112] Optionally, the machine learning model and the big language model are combined to perform data analysis on the big language model prompt words to obtain the bill information from the bill text.
[0113] In this embodiment, the computer device matches the bill template and the bill text, generates a large language model prompt word, uses the large language model to perform data semantic analysis and structured processing, realizes efficient processing of the large language model prompt words, and obtains bill information from the bill text.
[0114] In one embodiment, Figure 2 As shown, a bill identification method is also provided, in which a computer device receives an initial invoice file, performs file type judgment on the initial invoice file, determines the file type of the initial invoice file, obtains a file parser corresponding to the file type, and parses the initial invoice file through the file parser to obtain a target invoice file; the file parser includes a ZIP file parser, a RAR file parser, an OFD file parser, a PDF file parser and an XML file parser.
[0115] The computer device performs image segmentation on the target invoice file and identifies at least one invoice image; performs OCR recognition on the invoice image to obtain the invoice text in the invoice image; performs language recognition on the invoice text to determine the language to which the invoice text belongs, obtains the invoice template corresponding to the language, performs invoice template matching, and generates large language model prompt words; and extracts invoice data based on the large language model prompt words through the target large language model.
[0116] In one embodiment, a bill recognition method is also provided, which is applied to a computer device, and the bill recognition method includes the following steps:
[0117] Step A1, obtaining the initial bill file.
[0118] Step A2: determine the file type of the initial bill file.
[0119] Step A3, obtaining a file parser corresponding to the file type, and parsing the initial bill file through the file parser to obtain a target bill file; the target bill file is a target invoice file, and the target invoice file includes one page or at least two pages of sub-invoice files.
[0120] Step A4: if the target invoice file includes at least two pages of sub-invoice files, the at least two pages of sub-invoice files are divided to obtain each page of sub-invoice files.
[0121] Step A5: for each page of the sub-invoice file, obtain the target invoice features in the sub-invoice file, and match the target invoice features with the reference invoice features.
[0122] Step A6: If the target invoice feature matches the reference invoice feature, indicating that the target invoice feature is an independent invoice feature, the text box to which the target invoice feature belongs is determined; and the area included in the text box is determined as the bill image.
[0123] Step A7, performing optical character recognition on the bill image to obtain the bill text in the bill image.
[0124] Step A8, determine the language of the bill text and obtain the bill template corresponding to the language.
[0125] Step A9, matching the bill template and the bill text to generate a large language model prompt word; the large language model prompt word includes the tax standard of the region corresponding to the bill template.
[0126] Step A10, obtaining historical bill information and a first large language model; the first large language model is used to extract the historical bill information; and the parameters of the first large language model are adjusted based on the historical bill information to obtain a target large language model.
[0127] Step A11, obtaining bill information from the bill text through the target large language model based on the large language model prompt words.
[0128] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0129] Based on the same inventive concept, the embodiment of the present application also provides a bill recognition device for implementing the bill recognition method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more bill recognition device embodiments provided below can refer to the limitations of the bill recognition method above, and will not be repeated here.
[0130] In an exemplary embodiment, Figure 3 As shown, a bill recognition device is provided, including: a bill file acquisition module 302, a bill image recognition module 304, an optical character recognition module 306, a bill template determination module 308 and a bill information acquisition module 310, wherein:
[0131] The bill file acquisition module 302 is used to acquire the target bill file.
[0132] The bill image recognition module 304 is used to recognize at least one bill image from the target bill file.
[0133] The optical character recognition module 306 is used to perform optical character recognition on the bill image to obtain the bill text in the bill image.
[0134] The bill template determination module 308 is used to determine the language of the bill text and obtain the bill template corresponding to the language.
[0135] The bill information acquisition module 310 is used to acquire bill information based on the bill template and bill text.
[0136] The above-mentioned bill recognition device obtains a target bill file, recognizes at least one bill image from the target bill file, performs optical character recognition on the bill image, obtains the bill text in the bill image, determines the language to which the bill text belongs, and obtains a bill template corresponding to the language. Then, the bill template corresponding to the language can accurately match the bill text, and further, the bill information can be obtained for target bill files in different languages of different countries and regions.
[0137] In one embodiment, the target bill file is a target invoice file; the bill image recognition module 304 is also used to obtain the target invoice features in the target invoice file, and match the target invoice features with the reference invoice features; if the target invoice features match the reference invoice features, indicating that the target invoice features are independent invoice features, the bill image is determined based on the target invoice features.
[0138] In one embodiment, the bill image recognition module 304 is further used to determine the text box to which the target invoice feature belongs; and determine the area included in the text box as the bill image.
[0139] In one embodiment, the above-mentioned bill image recognition module 304 is also used to divide the at least two pages of sub-invoice files into each page of sub-invoice files if the target invoice file includes at least two pages of sub-invoice files; for each page of sub-invoice files, obtain the target invoice features in the sub-invoice file, and match the target invoice features with the reference invoice features.
[0140] In one embodiment, the above-mentioned bill information acquisition module 310 is also used to match the bill template and the bill text to generate a large language model prompt word; the large language model prompt word conforms to the tax standards of the area corresponding to the bill template; and the bill information is obtained from the bill text based on the large language model prompt word through the large language model.
[0141] In one embodiment, the above-mentioned device also includes a large language model adjustment module, which is used to obtain historical bill information and a first large language model; the first large language model is used to extract historical bill information; based on the historical bill information, the parameters of the first large language model are adjusted to obtain a target large language model.
[0142] In one embodiment, the above-mentioned bill file acquisition module 302 is also used to obtain an initial bill file; determine the file type of the initial bill file; obtain a file parser corresponding to the file type, and parse the initial bill file through the file parser to obtain a target bill file.
[0143] Each module in the above-mentioned bill recognition device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0144] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 4As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a bill recognition method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0145] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0146] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0147] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0148] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0150] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0151] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0152] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A bill recognition method, characterized in that: The method comprises: Get the target bill file; identifying at least one bill image from the target bill file; Performing optical character recognition on the bill image to obtain the bill text in the bill image; Determine the language of the bill text and obtain the bill template corresponding to the language; Based on the bill template and the bill text, the bill information is obtained.
2. The method according to claim 1, characterized in that: The target bill file is a target invoice file; and identifying at least one bill image from the target bill file includes: Acquire target invoice features in the target invoice file, and match the target invoice features with reference invoice features; If the target invoice feature matches the reference invoice feature, indicating that the target invoice feature is an independent invoice feature, a bill image is determined based on the target invoice feature.
3. The method according to claim 2, characterized in that The step of determining the bill image based on the target invoice feature comprises: Determining the text box to which the target invoice feature belongs; The area included in the text box is determined as the bill image.
4. The method according to claim 2, characterized in that: The method further comprises: If the target invoice file includes at least two pages of sub-invoice files, the at least two pages of sub-invoice files are split to obtain each page of sub-invoice files; The obtaining of the target invoice features in the target invoice file and matching the target invoice features with the reference invoice features includes: For each page of the sub-invoice file, the target invoice features in the sub-invoice file are obtained, and the target invoice features are matched with the reference invoice features.
5. The method according to any one of claims 1 to 4, characterized in that: The acquiring of bill information based on the bill template and the bill text includes: Matching the bill template with the bill text to generate a large language model prompt word; the large language model prompt word includes the tax standard of the area corresponding to the bill template; The bill information is obtained from the bill text through the target large language model based on the large language model prompt words.
6. The method according to claim 5, characterized in that The method further comprises: Acquire historical bill information and a first language model; the first language model is used to extract the historical bill information; The parameters of the first large language model are adjusted based on the historical ticket information to obtain a target large language model.
7. The method according to any one of claims 1 to 5, characterized in that: The step of obtaining the target bill file includes: Obtain the initial bill document; Determining the file type of the initial bill file; A file parser corresponding to the file type is obtained, and the initial bill file is parsed by the file parser to obtain a target bill file.
8. A bill recognition device, characterized in that: The device comprises: The bill file acquisition module is used to acquire the target bill file; A bill image recognition module, used to recognize at least one bill image from the target bill file; An optical character recognition module, used for performing optical character recognition on the bill image to obtain the bill text in the bill image; A bill template determination module, used to determine the language of the bill text and obtain the bill template corresponding to the language; The bill information acquisition module is used to acquire the bill information based on the bill template and the bill text.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Invoice identification method, device and equipment based on multi-modal large model
CN120808377A