Bill identification detachable template generation method, bill splitting method and electronic equipment
The configurable bill recognition template generation method addresses the inefficiencies of manual template development by automating template configuration and recognition, reducing costs and improving efficiency through OCR and filling modules.
Patent Information
- Application Number
- CN202310799518.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2024-12-31
AI Technical Summary
Existing invoice and bill recognition systems require manual development of templates, which is time-consuming, has low frequency of use, and results in high labor and maintenance costs due to varying image sizes and developer skill variability, leading to inconsistent code quality and page layouts.
A configurable bill recognition template generation method that includes obtaining templates, configuring splitting item types and positions, using an OCR module for recognition, and a filling module for data input, reducing the need for manual coding and improving efficiency.
Reduces labor and maintenance costs by enabling quick template configuration and response to customer needs, allowing non-developers to design bill identification and splitting, and enhancing development efficiency.
Smart Images

Figure CN119229453A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bill identification, and more specifically, to a method for generating a configurable bill identification detachable template. In addition, the present invention also relates to a configurable bill identification detachable method and an electronic device. Background Art
[0002] With the continuous accumulation of management projects and the overcoming of various technical difficulties, a problem was found in many projects: most invoice and bill recognition pages need to be manually written by developers, which takes a long time to develop, has a low frequency of use, and takes up too much time for the project team.
[0003] In the existing technology, developers need to manually write adjustment codes and learn split recognition logic every time the usage scenario is different and the image size is different. Since the bill fields, content, images, or structure change every time, it is very likely that the entire page layout will be abnormal and the coordinate values will have a significant deviation. Because the level of developers varies, code quality is often difficult to control, which increases the maintenance cost of later projects.
[0004] Therefore, how to provide a configurable bill recognition and split template generation method that can reduce labor costs and maintenance costs, quickly meet the writing of different bill recognition or split templates in the project, and improve development efficiency has become a technical problem that needs to be urgently solved by technical personnel in this field. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a method for generating a configurable bill recognition split template, which can reduce labor costs and maintenance costs, can quickly meet the writing of different bill recognition or split templates in the project, and improve development efficiency. In addition, the present invention also relates to a configurable bill recognition split method and electronic device, which also have the above beneficial effects.
[0006] The purpose of the scheme of the present invention is to realize the configuration, splitting, identification and reading of templates by configuration, which has the advantages of reducing development costs, quickly responding to customer needs, and improving writing efficiency, so that front-end personnel do not need to spend too much development time on such a simple page to adjust CSS styles and repeatedly calculate data changes. At the same time, it can also allow product and design colleagues who do not have front-end development capabilities to design related bill identification and splitting, and the design is completed when the code is completed.
[0007] The technical solution provided by the present invention is as follows:
[0008] The present invention provides a technical solution for a configurable bill recognition splittable template generation method, which comprises the following steps: obtaining bill templates of different bill types; configuring bill splitting item types according to the bill types; setting corresponding splitting positions according to the splitting item types, wherein the splitting positions include splitting areas and splitting coordinate points; configuring an OCR module, wherein the OCR module is used to recognize bill images according to the splitting positions to obtain bill recognition data; and configuring a filling module, wherein the filling module is used to automatically fill in the bill recognition data in a recognized input box.
[0009] Furthermore, in a preferred embodiment of the present invention, the "obtaining bill templates of different bill types" specifically includes the following steps: collecting common bill types on the market; obtaining bill images of different bill types; configuring a first parameter range of image size and resolution; and constructing and obtaining a bill template based on the bill type and the corresponding first parameter range.
[0010] Furthermore, in a preferred embodiment of the present invention, the "configuring bill splitting item types according to bill types" specifically includes the following steps: filtering out corresponding bill splitting item types according to fixed bill information content on different bill types.
[0011] Furthermore, in a preferred embodiment of the present invention, the "setting corresponding splitting positions according to splitting item types" specifically includes the following steps: configuring splitting positions corresponding to the splitting item types of the bills in bill images of different bill types.
[0012] Furthermore, in a preferred embodiment of the present invention, the generation method further comprises the following steps: installing and configuring an NPM package, wherein the NPM package is used to provide existing code.
[0013] Furthermore, in a preferred embodiment of the present invention, the "configure OCR module" specifically includes the following steps: install and import the OCR library from the NPM package; configure the OCR model and parameters, select or train the OCR recognition model for identifying bill images, and set the language and recognition accuracy of the OCR recognition model; configure the OCR model calling interface for importing image data into the OCR model.
[0014] Furthermore, in a preferred embodiment of the present invention, the filling module includes one or more of a form filling module, a text editor filling module, a document filling module, an application interface filling module, and an electronic form filling module.
[0015] In addition, the present invention also provides a technical solution for a configurable bill recognition and separable method, which includes the following steps: obtaining bill image data to be identified; identifying a bill image in the bill image data; identifying the bill image according to a configurable bill recognition and separable template, and outputting the bill recognition data; wherein the configurable bill recognition and separable template is obtained by the above-mentioned configurable bill recognition and separable template generation method.
[0016] Furthermore, in a preferred embodiment of the present invention, the "identifying the bill image in the bill image data" specifically includes the following steps: identifying, cutting, and classifying the bill image in the bill image data according to a bill template to obtain the bill image.
[0017] In addition, the present invention also provides a technical solution for an electronic device, including: a computer program, the computer program is used to execute the above-mentioned configurable bill recognition detachable template generation method; a memory, the memory is used to store the computer program; and a processor, the processor is used to execute the computer program.
[0018] Compared with the prior art, the present invention provides a method for generating a configurable invoice recognition detachable template. In order to achieve the purpose of generating a configurable invoice recognition detachable template, the invoice templates of different invoice types are obtained in advance, and then the split item type and the corresponding split position are set; by configuring the OCR module and the filling module, the configurable invoice recognition detachable template can be used to quickly split and identify the invoice bill; further, based on the configurable invoice recognition detachable template obtained by this generation method, the front-end interface engineer can quickly configure the invoice recognition module in the front-end UI, improve the configuration efficiency, unify the invoice recognition template, and reduce the construction and debugging costs of this function. In summary, the technical solution provided by the present invention can reduce labor costs and maintenance costs, can quickly meet the writing of different invoice recognition or splitting templates in the project, and improve development efficiency. In addition, the present invention also relates to a configurable invoice recognition detachable method and electronic device, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 A schematic diagram of the main process of the method for generating a configurable bill identification detachable template provided by an embodiment of the present invention;
[0021] Figure 2 A schematic diagram of a process for splitting pages according to a bill template provided in an embodiment of the present invention;
[0022] Figure 3 A schematic diagram of identifying multiple bill images in bill image data provided by an embodiment of the present invention;
[0023] Figure 4 An illustrative diagram of the core process design of the technical solution provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 the field without creative work are within the scope of protection of the present invention.
[0025] It should be noted that when an element is referred to as being "fixed on" or "set on" another element, it can be directly on the other element or indirectly set on the other element; when an element is referred to as being "connected to" another element, it can be directly connected to the other element or indirectly connected to the other element.
[0026] It should be understood that the terms "length", "width", "up", "down", "front", "back", "first", "second", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0027] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" and "several" is two or more, unless otherwise clearly and specifically defined.
[0028] It should be noted that the structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with this technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantive technical significance. Any structural modification, change in proportion or adjustment of size, without affecting the effects and purposes that can be achieved by the present invention, should still fall within the scope of the technical contents disclosed by the present invention.
[0029] like Figures 1 to 4 As shown, the technical solution of the configurable bill recognition splittable template generation method provided by the embodiment of the present invention includes the following steps: obtaining bill templates of different bill types; configuring the bill splitting item type according to the bill type; setting the corresponding splitting position according to the splitting item type, and the splitting position includes the splitting area and the splitting coordinate point; configuring the OCR module, and the OCR module is used to identify the bill image according to the splitting position to obtain the bill recognition data; configuring the filling module, and the filling module is used to automatically fill in the bill recognition data in the recognized input box.
[0030] The present invention provides a technical solution for a method for generating a configurable invoice recognition detachable template. In order to achieve the purpose of generating a configurable invoice recognition detachable template, invoice templates of different invoice types are obtained in advance, and then the split item type and the corresponding split position are set; by configuring the OCR module and the filling module, the configurable invoice recognition detachable template can quickly split and identify the invoice bill; further, based on the configurable invoice recognition detachable template obtained by this generation method, the front-end interface engineer can quickly configure the invoice recognition module in the front-end UI, improve the configuration efficiency, unify the invoice recognition template, and reduce the construction and debugging costs of this function. In summary, the technical solution provided by the present invention can reduce labor costs and maintenance costs, can quickly meet the writing of different invoice recognition or splitting templates in the project, and improve development efficiency. In addition, the present invention also relates to a configurable invoice recognition detachable method and electronic device, which also have the above-mentioned beneficial effects.
[0031] Specifically, in an embodiment of the present invention, the "obtaining bill templates of different bill types" specifically includes the following steps: collecting common bill types on the market; obtaining bill images of different bill types; configuring a first parameter range for image size and resolution; and constructing and obtaining a bill template based on the bill type and the corresponding first parameter range.
[0032] Specifically, in an embodiment of the present invention, the "configuring bill splitting item types according to bill types" specifically includes the following steps: filtering out corresponding bill splitting item types according to fixed bill information content on different bill types.
[0033] Specifically, in an embodiment of the present invention, the "setting corresponding splitting positions according to splitting item types" specifically includes the following steps: configuring splitting positions corresponding to the splitting item types of the bills in bill images of different bill types.
[0034] Specifically, in an embodiment of the present invention, the generation method further includes the following steps: installing and configuring an NPM package, wherein the NPM package is used to provide existing code.
[0035] It should be noted that NPM packages refer to reusable code modules or packages managed by Node Package Manager (NPM). NPM is a package management tool for Node.js that is used to publish, share, and install JavaScript code modules. NPM packages can be used to extend and enhance the functionality of JavaScript applications. By using NPM packages, developers can reuse existing code and simplify the development process by introducing external modules.
[0036] Specifically, in an embodiment of the present invention, the "configure OCR module" specifically includes the following steps: install and import the OCR library from the NPM package; configure the OCR model and parameters, select or train the OCR recognition model for identifying bill images, and set the language and recognition accuracy of the OCR recognition model; configure the OCR model calling interface for importing image data into the OCR model.
[0037] Specifically, in an embodiment of the present invention, the filling module includes: one or more of a form filling module, a text editor filling module, a document filling module, an application interface filling module, and an electronic form filling module.
[0038] In addition, the present invention also provides a technical solution for a configurable bill recognition and detachable method, which includes the following steps: obtaining bill image data to be recognized; recognizing a bill image in the bill image data; recognizing the bill image according to a configurable bill recognition and detachable template, and outputting bill recognition data; wherein the configurable bill recognition and detachable template is obtained by the above-mentioned configurable bill recognition and detachable template generation method. The technical solution for the configurable bill recognition and detachable method provided by the present invention also has the technical effect of the above-mentioned technical solution.
[0039] Specifically, in an embodiment of the present invention, the "identifying the bill image in the bill image data" specifically includes the following steps: identifying, cutting, and classifying the bill image in the bill image data according to the bill template to obtain the bill image.
[0040] In addition, the present invention also provides a technical solution for an electronic device, comprising: a computer program, the computer program is used to execute the above-mentioned method for generating a configurable bill recognition detachable template; a memory, the memory is used to store the computer program; and a processor is used to execute the computer program. The technical solution for the electronic device provided by the present invention also has the technical effect of the above-mentioned technical solution.
[0041] It should be noted that the existing technical solutions have the following potential problems: First, the learning threshold is high. You need to write various native structures to obtain corresponding coordinates, identify split types, grasp various changes in data, and identify and read the content of split areas. You cannot directly use some UI plug-ins. You need to write various page layouts and calculate data by yourself, which consumes computer performance and cannot use open source components. Second, the level of developers is uneven, and the quality of code is often difficult to control. Third, complex pages, obscure codes, and extremely high maintenance costs. It takes too long for the project. Fourth, the developed pages are often different from the designed pages, and it is impossible to reach a consensus.
[0042] It should be noted that the design principle of this technical solution is: the overall process is divided into 6 major parts: bill template, split type configuration, coordinate configuration, OCR recognition, public NPM package, and introduction and use.
[0043] ①Bill template: Use the bill template to scan the bill template you need to use
[0044] ② Split type configuration: Configure the split item type according to the bill type
[0045] ③Coordinate configuration: Select the area to be split or set the coordinate points according to the split type
[0046] ④OCR recognition: Identify slice content through OCR
[0047] ⑤ Public NPM package: Install the NPM package and extract the public logic code
[0048] ⑥Introduction and use: Fill in the relevant configuration fields through code for final display.
[0049] The implementation process of this technical solution is as follows: first open the configuration bill recognition and splitting section, scan the bill, edit the bill template to be used, and split the page as follows Figure 2 shown.
[0050] It should be noted that if Figure 3As shown, a single bill can be split directly, and multiple bills can be split in batches and separated. Then click the code generation on the page to download the generated interface, and then install the Tesseract open source JS package. Finally, put the generated file into the project you need to use, write the relevant business logic, and fill in the identification fields.
[0051] It should be noted that you need to install Tesseract.js, which is a JavaScript library based on the Tesseract OCR engine for text recognition. After the installation is complete, you can perform related text recognition operations according to the API documentation of Tesseract.js (https: / / tesseract.projectnaptha.com / api / ), and configure and call the corresponding methods as needed.
[0052] The architecture of this technical solution is: based on the recognition and splitting code generated on the page, the various public methods in the subsequent entire recognition and splitting process have been injected into the generated page, and are provided for subsequent use through the exposure methods of vue2.x and vue3.x. Developers only need to add business codes and insert the data that needs to be recognized and split into the components.
[0053] It should be noted that Vue.js is a popular JavaScript framework for building user interfaces. Vue.js has different versions, including Vue 2.x and Vue 3.x.
[0054] The bill recognition and splitting template development and design of this technical solution are as follows Figure 4 As shown:
[0055] Taking into account the generality and particularity of the business, the universal templates (5): applicable to all VAT invoices and ordinary invoices, receipts, air tickets, and train ticket templates. They are custom layout grid, long bill display grid, bill upload grid
[0056] Solution design (writing common configuration components): There are many common components in the interface of the bill recognition and splitting template. They are refined, extracted, and stripped to perform related logic reuse and subsequent scalability maintenance.
[0057] In summary, this technical solution includes the following steps:
[0058] Step 1: Invoice template configuration: Users can select existing invoice templates, or customize general templates such as layout grid, long invoice display grid, invoice upload grid, etc. Use the scanning tool to scan the invoice template to be used to obtain the structure and layout information of the invoice.
[0059] Step 2: Split type configuration: Users can configure the type of split items according to the specific bill type. For example, for a VAT invoice, the split items can be configured as invoice number, invoice date, purchaser, etc. By configuring the split type, determine the area to be split or set the coordinate point.
[0060] The third step is coordinate configuration: according to the configuration of the split type, the user can configure the coordinates of the area to be split. In this way, the system can accurately locate the content area that needs to be identified and split.
[0061] Step 4: OCR recognition: Use OCR technology to recognize the split areas of the bill and convert the image into text. Obtain the specific field content in the bill through the OCR recognition results.
[0062] Step 5: Public NPM packages: You can install public NPM packages, which contain some common logic codes that can be referenced and used in the generated interface. Public NPM packages can provide some common methods and functions for developers to quickly integrate and use.
[0063] Step 6: Introduce and use: The generated interface code can be placed into the project where it needs to be used according to specific project requirements. Developers can fill in relevant configuration fields according to business logic and identification field requirements, and pass the data that needs to be identified and split into components.
[0064] Through the above steps and methods, it is possible to configure, split, identify and read templates through configuration. This can reduce development costs, quickly respond to customer needs, improve development efficiency, and eliminate the need for developers to manually write pages and adjust styles and layouts.
[0065] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating a configurable bill recognition detachable template, characterized in that: The following steps are involved: Get bill templates for different bill types; Configure the bill splitting item type according to the bill type; Set a corresponding split position according to the split item type, wherein the split position includes a split area and a split coordinate point; Configure an OCR module, the OCR module is used to recognize the bill image according to the split position to obtain bill recognition data; A filling module is configured, and the filling module is used to automatically fill in the bill identification data in the identified input box.
2. The method for generating a configurable bill recognition detachable template according to claim 1, characterized in that: The "obtaining bill templates of different bill types" specifically includes the following steps: Collect common types of bills on the market; Get bill images of different bill types; Configure the first parameter range of image size and resolution; According to the bill type and the corresponding first parameter range, a bill template is constructed and obtained.
3. The method for generating a configurable bill recognition detachable template according to claim 2, characterized in that: The "configuring bill splitting item type according to bill type" specifically includes the following steps: According to the fixed bill information content on different bill types, the corresponding bill split item types are filtered out.
4. The method for generating a configurable bill recognition detachable template according to claim 3, characterized in that: The "setting the corresponding split position according to the split item type" specifically includes the following steps: Configure split positions corresponding to the bill split item types in bill images of different bill types.
5. The method for generating a configurable bill recognition detachable template according to any one of claims 1 to 4, characterized in that: The generation method also includes the following steps: Install and configure an NPM package, which is used to provide existing code.
6. The method for generating a configurable bill recognition detachable template according to claim 5, characterized in that: The "Configuring OCR Module" includes the following steps: Install and import the OCR library from the said NPM package; Configure OCR models and parameters, select or train the OCR recognition model for bill image recognition, and set the language and recognition accuracy of the OCR recognition model; Configure the OCR model calling interface to import image data into the OCR model.
7. The method for generating a configurable bill recognition detachable template according to claim 5, characterized in that: The filling module includes: one or more of a form filling module, a text editor filling module, a document filling module, an application interface filling module, and an electronic form filling module.
8. A configurable bill identification and splitting method, characterized in that: The method comprises the following steps: Obtaining image data of bills to be identified; identifying a bill image in the bill image data; Recognize the bill image according to the configurable bill recognition detachable template, and output bill recognition data; The configurable invoice identification detachable template is obtained by the configurable invoice identification detachable template generation method described in any one of claims 1 to 7.
9. The configurable bill identification and detachability method according to claim 8, characterized in that: The “identifying the bill image in the bill image data” specifically includes the following steps: The bill image in the bill image data is identified, cut and classified according to the bill template to obtain the bill image.
10. An electronic device, characterized in that include: A computer program, the computer program being used to execute the method for generating a configurable bill identification detachable template as claimed in any one of claims 1 to 7; A memory, the memory being used to store the computer program; A processor is used to execute the computer program.
