Invoice information acquisition method and device, equipment and storage medium
By applying the DONUT model to the automation method in the process of obtaining invoice information, the problems of cumbersome and inefficient acquisition of invoice information in the prior art are solved, and more efficient and reliable acquisition of information is achieved.
Patent Information
- Application Number
- CN202411763578.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-11
AI Technical Summary
In the prior art, the process of obtaining invoice information is cumbersome and relies on manual operations, resulting in inefficiency and limited reliability.
Using an automated method based on the DONUT model, the invoice information is automatically acquired and analyzed through preprocessing and feature extraction technology to reduce manual intervention.
It improves the efficiency and reliability of invoice information acquisition, reduces the acquisition time, and avoids the impact of manual operations.
Smart Images

Figure CN119600631A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence and financial technology, and in particular to methods, devices, equipment and storage media for obtaining invoice information. Background Art
[0002] Invoices, as the true proof of transactions, ensure the legitimacy and authenticity of insurance claims or financial service transactions, and effectively prevent fraud. By collecting and analyzing invoice information, insurance companies can quickly verify the actual cost of services or goods, thereby speeding up the claims process and improving customer satisfaction.
[0003] However, the current process of obtaining invoice information is cumbersome, which is not conducive to improving the efficiency of obtaining the current invoice information. The reason is that the existing technology mainly adopts the manual acquisition method to obtain the current invoice information, and the manual acquisition method consumes a lot of human resources and time resources, increases the time of obtaining the current invoice information, and is easily affected by manual operations. Therefore, it is not conducive to improving the efficiency of obtaining the current invoice information. Summary of the invention
[0004] The present invention provides an invoice information acquisition method, device, computer equipment and storage medium to solve the technical problem that the current invoice information acquisition process is cumbersome and is not conducive to improving the efficiency of acquiring the current invoice information.
[0005] In a first aspect, a method for obtaining invoice information is provided, comprising:
[0006] Acquire a preset invoice image and preset invoice information corresponding to the preset invoice image;
[0007] Obtaining predicted invoice information output by a preset DONUT model based on the preset invoice image, and obtaining a loss value between the preset invoice information and the predicted invoice information;
[0008] When the loss value meets the stop condition, stop training the DONUT model and obtain the trained DONUT model;
[0009] Obtain the current invoice image to be processed by the trained DONUT model;
[0010] Preprocessing the current invoice image to obtain the preprocessed current invoice image;
[0011] When the preprocessed current invoice image meets a preset condition, the preprocessed current invoice image is input into the trained DONUT model to obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image.
[0012] Further, the obtaining of the predicted invoice information output by the preset DONUT model based on the preset invoice image, and obtaining the loss value between the preset invoice information and the predicted invoice information, includes:
[0013] Inputting the preset invoice image into a preset DONUT model, and obtaining predicted invoice information output by the DONUT model based on the preset invoice image;
[0014] The loss value between the predicted invoice information and the preset invoice information is obtained through a preset loss function, wherein the loss function includes a mean square error loss function, an absolute loss function, or a combination thereof.
[0015] Further, when the loss value satisfies the stopping condition, stopping the training of the DONUT model and obtaining the trained DONUT model comprises:
[0016] Training the DONUT model according to the loss value, and obtaining a decrease in the loss value during the training of the DONUT model;
[0017] When the decrease amplitude is less than the preset amplitude, the training of the DONUT model is stopped, and the trained DONUT model is obtained.
[0018] Furthermore, the step of obtaining the current invoice image to be processed by the trained DONUT model includes:
[0019] Connect to a database and obtain an access interface to the database;
[0020] The database is accessed through the access interface, and the current invoice image to be processed by the trained DONUT model is obtained from the database.
[0021] Furthermore, the preprocessing of the current invoice image to obtain the preprocessed current invoice image includes:
[0022] Selecting the image center of the current invoice image as the rotation center, controlling the current invoice image to rotate around the rotation center to a specified preset angle, and obtaining the rotated current invoice image;
[0023] The rotated current invoice image is cropped, and the cropped current invoice image is selected as the pre-processed current invoice image.
[0024] Furthermore, when the preprocessed current invoice image meets a preset condition, the preprocessed current invoice image is input into the trained DONUT model, and the current invoice information output by the trained DONUT model based on the preprocessed current invoice image is obtained, including:
[0025] Obtaining a definition parameter of the preprocessed current invoice image; when the definition parameter is not higher than a preset parameter, performing feature extraction on the current invoice image to obtain an image feature vector corresponding to the current invoice image, inputting the image feature vector into the trained DONUT model, and obtaining the current invoice information output by the trained DONUT model based on the image feature vector;
[0026] When the clarity parameter is higher than the preset parameter, optical character recognition is performed on the preprocessed current invoice image to obtain recognized text information, feature extraction is performed on the text information to obtain a text feature vector corresponding to the text information, feature extraction is performed on the current invoice image to obtain an image feature vector corresponding to the current invoice image, the text feature vector and the image feature vector are concatenated to generate a target feature vector, the target feature vector is input into the trained DONUT model, and the current invoice information output by the trained DONUT model based on the target feature vector is obtained.
[0027] Furthermore, when the preprocessed current invoice image meets a preset condition, the preprocessed current invoice image is input into the trained DONUT model, and the current invoice information output by the trained DONUT model based on the preprocessed current invoice image is obtained, the invoice information acquisition method includes:
[0028] Perform data processing operations on the current invoice information and output the processed current invoice information in JSON format, wherein the data processing operations include one or a combination of operations of removing erroneous characters, correcting the date format, verifying the name, and verifying the amount.
[0029] In a second aspect, a device for obtaining invoice information is provided, comprising:
[0030] A first acquisition module, used to acquire a preset invoice image and preset invoice information corresponding to the preset invoice image;
[0031] A second acquisition module is used to obtain the predicted invoice information output by the preset DONUT model based on the preset invoice image, and obtain the loss value between the preset invoice information and the predicted invoice information;
[0032] A training module, used for stopping training the DONUT model and obtaining the trained DONUT model when the loss value meets a stopping condition;
[0033] A third acquisition module is used to acquire the current invoice image to be processed by the trained DONUT model;
[0034] A processing module, used for preprocessing the current invoice image to obtain the preprocessed current invoice image;
[0035] The fourth acquisition module is used to input the preprocessed current invoice image into the trained DONUT model when the preprocessed current invoice image meets the preset conditions, and obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image.
[0036] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned invoice information acquisition method when executing the computer program.
[0037] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned invoice information acquisition method are implemented.
[0038] The present application provides an invoice information acquisition method, device, computer equipment and storage medium, which obtain a preset invoice image and the preset invoice information corresponding to the preset invoice image; obtain the predicted invoice information output by the preset DONUT model based on the preset invoice image, and obtain the loss value between the preset invoice information and the predicted invoice information; when the loss value meets the stop condition, stop training the DONUT model and obtain the trained DONUT model; obtain the current invoice image to be processed by the trained DONUT model; pre-process the current invoice image to obtain the pre-processed current invoice image; when the pre-processed current invoice image meets the preset condition, input the pre-processed current invoice image into the training The DONUT model after training is used to obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image. The beneficial effects are in two aspects. On the one hand, when the preprocessed current invoice image meets the preset conditions, the preprocessed current invoice image is input into the trained DONUT model to obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image. Since manual acquisition is not required, the acquisition time of the current invoice information is reduced, which is conducive to improving the acquisition efficiency of the current invoice information. On the other hand, since the trained DONUT model will not be affected by manual operation, it is conducive to improving the reliability of the acquired current invoice information. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0040] Figure 1 It is a schematic diagram of an application environment of a method for obtaining invoice information in one embodiment of the present invention;
[0041] Figure 2 A schematic diagram of a flow chart of a method for obtaining invoice information provided by an embodiment of the present invention;
[0042] Figure 3 yes Figure 1 A schematic flow chart of a specific implementation of step S23;
[0043] Figure 4 yes Figure 1 A schematic flow chart of a specific implementation of step S25;
[0044] Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step S26;
[0045] Figure 6 It is a structural schematic diagram of an invoice information acquisition device in one embodiment of the present invention;
[0046] Figure 7 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0047] Figure 8 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] 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 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.
[0049] See also Figure 1 , Figure 1 is a schematic diagram of an application environment of a method for obtaining invoice information in an embodiment of the present invention. The method for obtaining invoice information provided by the embodiment of the present invention can be applied in the following situations: Figure 1 In an application environment, a client communicates with a server through a network.
[0050] The server obtains the preset invoice image and the preset invoice information corresponding to the preset invoice image through the client;
[0051] Obtaining predicted invoice information output by a preset DONUT model based on the preset invoice image, and obtaining a loss value between the preset invoice information and the predicted invoice information;
[0052] When the loss value meets the stop condition, stop training the DONUT model and obtain the trained DONUT model;
[0053] Obtain the current invoice image to be processed by the trained DONUT model;
[0054] Preprocessing the current invoice image to obtain the preprocessed current invoice image;
[0055] When the preprocessed current invoice image meets a preset condition, the preprocessed current invoice image is input into the trained DONUT model to obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image.
[0056] In the scheme implemented by the above-mentioned invoice information acquisition method, device, equipment and medium, the beneficial effects are in two aspects. On the one hand, when the preprocessed current invoice image meets the preset conditions, the preprocessed current invoice image is input into the trained DONUT model to obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image. Since manual acquisition is not required, the acquisition time of the current invoice information is reduced, which is conducive to improving the efficiency of acquiring the current invoice information. On the other hand, since the trained DONUT model will not be affected by manual operation, it is conducive to improving the reliability of the acquired current invoice information.
[0057] The client may include but is not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0058] The server can be implemented with an independent task database or a task database cluster composed of multiple task databases. The present invention is described in detail below through specific embodiments.
[0059] See also Figure 2 , Figure 2 A flowchart of a method for obtaining invoice information provided by an embodiment of the present invention includes the following steps:
[0060] S21, obtaining a preset invoice image and preset invoice information corresponding to the preset invoice image;
[0061] The preset invoice image is an invoice image of a past time period.
[0062] For the sake of illustration, an example is given below:
[0063] For example, the past time period is 2023, and the preset invoice image is the invoice image of 2023.
[0064] For example, the past time period is 2022, and the preset invoice image is the invoice image of 2022.
[0065] For example, the past time period is September 2022, and the preset invoice image is the invoice image of September 2022.
[0066] S22, obtaining predicted invoice information output by a preset DONUT model based on the preset invoice image, and obtaining a loss value between the preset invoice information and the predicted invoice information;
[0067] The step of obtaining the predicted invoice information output by the preset DONUT model based on the preset invoice image and obtaining the loss value between the preset invoice information and the predicted invoice information includes:
[0068] Inputting the preset invoice image into a preset DONUT model, and obtaining predicted invoice information output by the DONUT model based on the preset invoice image;
[0069] The loss value between the predicted invoice information and the preset invoice information is obtained through a preset loss function, wherein the loss function includes a mean square error loss function, an absolute loss function, or a combination thereof.
[0070] S23, when the loss value meets the stop condition, stop training the DONUT model and obtain the trained DONUT model;
[0071] The full name of the DONUT model in Chinese is Document Understanding Transformer, and the full name of the DONUT model in English is Document Understanding Transformer. The DONUT model is an end-to-end deep learning model.
[0072] S24, obtaining the current invoice image to be processed by the trained DONUT model;
[0073] The current invoice image is the invoice image of the current time period.
[0074] For the sake of illustration, an example is given below:
[0075] For example, the current time period is 2024, and the current invoice image is the invoice image of 2024.
[0076] For example, the current time period is September 2024, and the current invoice image is the invoice image of September 2024.
[0077] The step of obtaining the current invoice image to be processed by the trained DONUT model includes:
[0078] Connect to a database and obtain an access interface to the database;
[0079] The database is accessed through the access interface, and the current invoice image to be processed by the trained DONUT model is obtained from the database.
[0080] Exemplarily, the accessing the database through the access interface, and obtaining the current invoice image to be processed by the trained DONUT model in the database, includes:
[0081] The database is accessed through the access interface, and in the database, invoice images of insurance business are queried, and the invoice images of insurance business are selected as the current invoice images to be processed by the trained DONUT model.
[0082] Among them, in the insurance field, whether it is auto insurance repairs, medical and health insurance claims, or property insurance loss assessment, insurance business invoice images are an important basis for verifying the authenticity and accuracy of claim applications. Therefore, selecting insurance business invoice images as the current invoice images to be processed by the trained DONUT model is conducive to improving the processing speed of insurance business invoice images.
[0083] S25, preprocessing the current invoice image to obtain the preprocessed current invoice image;
[0084] S26, when the preprocessed current invoice image meets the preset conditions, the preprocessed current invoice image is input into the trained DONUT model, and the current invoice information output by the trained DONUT model based on the preprocessed current invoice image is obtained.
[0085] Wherein, when the preprocessed current invoice image meets the preset condition, the preprocessed current invoice image is input into the trained DONUT model, and after the current invoice information output by the trained DONUT model based on the preprocessed current invoice image is obtained, the invoice information acquisition method includes:
[0086] Perform data processing operations on the current invoice information and output the processed current invoice information in JSON format, wherein the data processing operations include one or a combination of operations of removing erroneous characters, correcting the date format, verifying the name, and verifying the amount.
[0087] Among them, JSON (JavaScript Object Notation) format is a lightweight data exchange format that is easy to parse and process by computer programs.
[0088] Exemplarily, after performing a data processing operation on the current invoice information and outputting the processed current invoice information in JSON format, the invoice information acquisition method includes:
[0089] A display window is created, and the processed current invoice information is displayed through the display window.
[0090] In the embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, when the preprocessed current invoice image meets the preset conditions, the preprocessed current invoice image is input into the trained DONUT model to obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image. Since manual acquisition is not required, the acquisition time of the current invoice information is reduced, which is conducive to improving the efficiency of acquiring the current invoice information. On the other hand, since the trained DONUT model will not be affected by manual operations, it is conducive to improving the reliability of the acquired current invoice information.
[0091] See also Figure 3 , Figure 3 yes Figure 1 A specific implementation flow diagram of step S23 is described in detail as follows:
[0092] S31, training the DONUT model according to the loss value, and obtaining a decrease range of the loss value during the training of the DONUT model;
[0093] Exemplarily, the DONUT model is trained according to the loss value. During the training of the DONUT model, the decrease in the loss value is determined according to the value of the loss function in this round of training and the value of the loss function in the previous round of training.
[0094] S32, when the decreasing amplitude is less than the preset amplitude, stop training the DONUT model and obtain the trained DONUT model.
[0095] In the embodiment of the present invention, when the decrease amplitude is less than the preset amplitude, it indicates that the loss value has converged, and the training of the DONUT model is stopped, and the trained DONUT model is obtained, which can save computing resources.
[0096] See also Figure 4 , Figure 4 yes Figure 1 A specific implementation flow diagram of step S25 is described in detail as follows:
[0097] S41, selecting the image center of the current invoice image as the rotation center, controlling the current invoice image to rotate around the rotation center to a specified preset angle, and obtaining the rotated current invoice image;
[0098] S42, cropping the rotated current invoice image, and selecting the cropped current invoice image as the pre-processed current invoice image.
[0099] In an embodiment of the present invention, the cropped current invoice image is selected as the preprocessed current invoice image, which can remove irrelevant or redundant parts of the current invoice image, such as blank areas at the edges and unnecessary background information, which is conducive to reducing the amount of data to be processed.
[0100] See also Figure 5 , Figure 5 yes Figure 1 A specific implementation flow diagram of step S26 is described in detail as follows:
[0101] S51, obtaining the clarity parameter of the pre-processed current invoice image;
[0102] Among them, the clarity parameter is usually used to quantify the clarity of an image or video, that is, the resolution of picture details and the sharpness of edges.
[0103] Among them, clarity parameters include but are not limited to resolution, contrast, sharpness, and color fidelity.
[0104] S52, when the clarity parameter is not higher than the preset parameter, extracting features from the current invoice image to obtain an image feature vector corresponding to the current invoice image, inputting the image feature vector into the trained DONUT model, and obtaining the current invoice information output by the trained DONUT model based on the image feature vector;
[0105] S53, when the clarity parameter is higher than the preset parameter, optical character recognition is performed on the preprocessed current invoice image to obtain recognized text information, feature extraction is performed on the text information to obtain a text feature vector corresponding to the text information, feature extraction is performed on the current invoice image to obtain an image feature vector corresponding to the current invoice image, the text feature vector and the image feature vector are concatenated to generate a target feature vector, the target feature vector is input into the trained DONUT model, and the current invoice information output by the trained DONUT model based on the target feature vector is obtained.
[0106] In the embodiment of the present invention, since manual acquisition is not required, the time for acquiring the current invoice information is reduced, which is conducive to improving the efficiency of acquiring the current invoice information.
[0107] See also Figure 6 , Figure 6 : is a schematic diagram of a structure of an invoice information acquisition device in one embodiment of the present invention, such as Figure 6As shown, the invoice information acquisition device includes a first acquisition module 101, a second acquisition module 102, a training module 103, a third acquisition module 104, a processing module 105, and a fourth acquisition module 106. The functional modules are described in detail as follows:
[0108] The first acquisition module 101 is used to acquire a preset invoice image and preset invoice information corresponding to the preset invoice image;
[0109] The second acquisition module 102 is used to obtain the predicted invoice information output by the preset DONUT model based on the preset invoice image, and obtain the loss value between the preset invoice information and the predicted invoice information;
[0110] The training module 103 is used to stop training the DONUT model and obtain the trained DONUT model when the loss value meets the stopping condition;
[0111] The third acquisition module 104 is used to acquire the current invoice image to be processed by the trained DONUT model;
[0112] The processing module 105 is used to pre-process the current invoice image to obtain the pre-processed current invoice image;
[0113] The fourth acquisition module 106 is used to input the preprocessed current invoice image into the trained DONUT model when the preprocessed current invoice image meets the preset conditions, and obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image.
[0114] In one embodiment, the second acquisition module 102 includes:
[0115] An input subunit, used for inputting the preset invoice image into a preset DONUT model, and obtaining predicted invoice information output by the DONUT model based on the preset invoice image;
[0116] The first acquisition subunit is used to obtain the loss value between the predicted invoice information and the preset invoice information through a preset loss function, and the loss function includes one of a mean square error loss function and an absolute loss function or a combination thereof.
[0117] In one embodiment, the training module 103 includes:
[0118] A training subunit, used for training the DONUT model according to the loss value, and obtaining a decrease range of the loss value during the training process of the DONUT model;
[0119] The second acquisition subunit is used to stop training the DONUT model and acquire the trained DONUT model when the decrease amplitude is less than the preset amplitude.
[0120] In one embodiment, the third acquisition module 104 includes:
[0121] A third acquisition subunit is used to connect to a database and obtain an access interface of the database;
[0122] The access subunit is used to access the database through the access interface, and obtain the current invoice image to be processed by the trained DONUT model in the database.
[0123] In one embodiment, the processing module 105 includes:
[0124] A rotation subunit, used for selecting the image center of the current invoice image as the rotation center, controlling the current invoice image to rotate around the rotation center to a specified preset angle, and obtaining the rotated current invoice image;
[0125] The cropping subunit is used to crop the rotated current invoice image and select the cropped current invoice image as the pre-processed current invoice image.
[0126] In one embodiment, the fourth acquisition module 106 includes:
[0127] A fourth acquisition subunit, used for acquiring a definition parameter of the preprocessed current invoice image;
[0128] A fifth acquisition subunit is used for, when the clarity parameter is not higher than a preset parameter, performing feature extraction on the current invoice image to obtain an image feature vector corresponding to the current invoice image, inputting the image feature vector into the trained DONUT model, and obtaining the current invoice information output by the trained DONUT model based on the image feature vector;
[0129] The sixth acquisition subunit is used to perform optical character recognition on the preprocessed current invoice image when the clarity parameter is higher than the preset parameter, obtain the recognized text information, perform feature extraction on the text information, obtain a text feature vector corresponding to the text information, perform feature extraction on the current invoice image, obtain an image feature vector corresponding to the current invoice image, splice the text feature vector and the image feature vector to generate a target feature vector, input the target feature vector into the trained DONUT model, and obtain the current invoice information output by the trained DONUT model based on the target feature vector.
[0130] In one embodiment, the invoice information acquisition device further includes:
[0131] The output module is used to perform data processing operations on the current invoice information and output the processed current invoice information in JSON format. The data processing operation includes one or a combination of operations of removing erroneous characters, correcting the date format, verifying the name, and verifying the amount.
[0132] In the embodiment of the present invention, the beneficial effects lie in two aspects. On the one hand, when the preprocessed current invoice image meets the preset conditions, the preprocessed current invoice image is input into the trained DONUT model to obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image. Since manual acquisition is not required, the acquisition time of the current invoice information is reduced, which is conducive to improving the efficiency of acquiring the current invoice information. On the other hand, since the trained DONUT model will not be affected by manual operations, it is conducive to improving the reliability of the acquired current invoice information.
[0133] For the specific limitations of the invoice information acquisition device, please refer to the limitations of the invoice information acquisition method above, which will not be repeated here.
[0134] Each module in the above-mentioned invoice information acquisition 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 corresponding operations of each module.
[0135] See also Figure 7 , Figure 7 is a schematic diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a server. The internal structure diagram thereof may be as shown in FIG. Figure 7 The computer device includes a processor, a memory, a network interface and a database connected through a system bus.
[0136] The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, the functions or steps of a method for obtaining invoice information can be implemented on the server side.
[0137] See also Figure 8 , Figure 8 is another structural diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, 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 network interface of the computer device is used to communicate with an external task database through a network connection. When the computer program is executed by the processor, the functions or steps of an invoice information acquisition method can be implemented on the client.
[0138] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor.
[0139] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions of the server and the client in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0140] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0141] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0142] Those skilled in the art will appreciate that the units 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 may depend on the specific application and design constraints of the technical solution. Technicians 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 the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0143] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0144] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A method for obtaining invoice information, characterized in that: include: Acquire a preset invoice image and preset invoice information corresponding to the preset invoice image; Obtaining predicted invoice information output by a preset DONUT model based on the preset invoice image, and obtaining a loss value between the preset invoice information and the predicted invoice information; When the loss value meets the stop condition, stop training the DONUT model and obtain the trained DONUT model; Obtain the current invoice image to be processed by the trained DONUT model; Preprocessing the current invoice image to obtain the preprocessed current invoice image; When the preprocessed current invoice image meets a preset condition, the preprocessed current invoice image is input into the trained DONUT model to obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image.
2. The invoice information acquisition method according to claim 1, characterized in that: The step of obtaining the predicted invoice information output by the preset DONUT model based on the preset invoice image, and obtaining the loss value between the preset invoice information and the predicted invoice information, includes: Inputting the preset invoice image into a preset DONUT model, and obtaining predicted invoice information output by the DONUT model based on the preset invoice image; The loss value between the predicted invoice information and the preset invoice information is obtained through a preset loss function, wherein the loss function includes a mean square error loss function, an absolute loss function, or a combination thereof.
3. The invoice information acquisition method according to claim 1, characterized in that: When the loss value satisfies the stopping condition, stopping training the DONUT model and acquiring the trained DONUT model comprises: Training the DONUT model according to the loss value, and obtaining a decrease in the loss value during the training of the DONUT model; When the decrease amplitude is less than the preset amplitude, the training of the DONUT model is stopped, and the trained DONUT model is obtained.
4. The invoice information acquisition method according to claim 1, characterized in that: The step of obtaining the current invoice image to be processed by the trained DONUT model includes: Connect to a database and obtain an access interface to the database; The database is accessed through the access interface, and the current invoice image to be processed by the trained DONUT model is obtained from the database.
5. The invoice information acquisition method according to claim 1, characterized in that: The preprocessing of the current invoice image to obtain the preprocessed current invoice image includes: Selecting the image center of the current invoice image as the rotation center, controlling the current invoice image to rotate around the rotation center to a specified preset angle, and obtaining the rotated current invoice image; The rotated current invoice image is cropped, and the cropped current invoice image is selected as the pre-processed current invoice image.
6. The invoice information acquisition method according to claim 1, characterized in that: When the preprocessed current invoice image meets a preset condition, inputting the preprocessed current invoice image into the trained DONUT model, and obtaining the current invoice information output by the trained DONUT model based on the preprocessed current invoice image, including: Obtaining the clarity parameter of the preprocessed current invoice image; When the clarity parameter is not higher than the preset parameter, feature extraction is performed on the current invoice image to obtain an image feature vector corresponding to the current invoice image, the image feature vector is input into the trained DONUT model, and the current invoice information output by the trained DONUT model based on the image feature vector is obtained; When the clarity parameter is higher than the preset parameter, optical character recognition is performed on the preprocessed current invoice image to obtain recognized text information, feature extraction is performed on the text information to obtain a text feature vector corresponding to the text information, feature extraction is performed on the current invoice image to obtain an image feature vector corresponding to the current invoice image, the text feature vector and the image feature vector are concatenated to generate a target feature vector, the target feature vector is input into the trained DONUT model, and the current invoice information output by the trained DONUT model based on the target feature vector is obtained.
7. The invoice information acquisition method according to any one of claims 1 to 6, characterized in that: When the preprocessed current invoice image meets the preset condition, the preprocessed current invoice image is input into the trained DONUT model, and the current invoice information output by the trained DONUT model based on the preprocessed current invoice image is obtained, the invoice information acquisition method includes: Perform data processing operations on the current invoice information and output the processed current invoice information in JSON format, wherein the data processing operations include one or a combination of operations of removing erroneous characters, correcting the date format, verifying the name, and verifying the amount.
8. An invoice information acquisition device, characterized in that: include: A first acquisition module, used to acquire a preset invoice image and preset invoice information corresponding to the preset invoice image; A second acquisition module is used to obtain the predicted invoice information output by the preset DONUT model based on the preset invoice image, and obtain the loss value between the preset invoice information and the predicted invoice information; A training module, used for stopping training the DONUT model and obtaining the trained DONUT model when the loss value meets a stopping condition; A third acquisition module is used to acquire the current invoice image to be processed by the trained DONUT model; A processing module, used for preprocessing the current invoice image to obtain the preprocessed current invoice image; The fourth acquisition module is used to input the preprocessed current invoice image into the trained DONUT model when the preprocessed current invoice image meets the preset conditions, and obtain the current invoice information output by the trained DONUT model based on the preprocessed current invoice image.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the invoice information acquisition method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the invoice information acquisition method according to any one of claims 1 to 7 are implemented.