Invoice classification method, device, computer equipment and storage medium

Through image code recognition and classified character recognition, quickly classified invoices have been solved, and the problem of low invoice recognition accuracy in the prior art is achieved, and efficient invoice classification and processing is achieved.

CN113780116BActive Publication Date: 2024-11-15ZHONGAN ONLINE P&C INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110987139.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-26
Publication Date
2024-11-15
Estimated Expiration
2041-08-26

AI Technical Summary

Technical Problem

In actual insurance business scenarios, how to quickly separate electronic invoices from a large number of invoices to facilitate subsequent invoice information identification, the existing technology is difficult to effectively deal with the identification of ordinary invoices and electronic invoices, resulting in a low accuracy rate.

Method used

By obtaining the invoice image to be processed, image code recognition is performed, the header area is segmented, and the pre-trained header detection model and text recognition model are used to identify the classification characters, and invoices are classified according to the classification characters to achieve rapid classification.

Benefits of technology

It improves the efficiency and accuracy of invoice classification, saves program time, reduces the number of character recognition, and can quickly classify in a large number of invoices, laying the foundation for subsequent processing of different types of invoices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113780116B_ABST
    Figure CN113780116B_ABST
Patent Text Reader

Abstract

The present application relates to an invoice classification method, device, computer equipment and storage medium. The method comprises: obtaining an invoice picture to be processed; performing image code recognition on the invoice picture to be processed; when the image code is recognized, recognizing the invoice picture to be processed to obtain classification characters in the invoice picture to be processed; and classifying the invoice picture to be processed according to the classification characters. The method can quickly separate a certain type of invoice from a large number of invoice pictures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence image technology, and in particular to an electronic invoice classification method, apparatus, computer equipment and storage medium. Background Art

[0002] As a valid voucher for consumer consumption, electronic invoices have the basic characteristics of interoperability, paperless and real-name system compared to traditional paper invoices. They are also faster to issue, easier to check for authenticity and easier to store. Therefore, electronic invoices have been widely promoted and applied.

[0003] In the current actual insurance business scenario, users will upload photos of invoices taken with their mobile phones as claim vouchers. Even for electronic invoices, they will print them out and take photos or directly upload screenshots of invoices for submission. However, the methods for handling the identification of electronic invoices and ordinary invoices are different. Electronic invoices can quickly obtain key invoice information by identifying the QR code on the invoice, with high accuracy, while ordinary invoices can only obtain invoice information through traditional OCR and other technologies, with relatively low accuracy. How to separate electronic invoices from a large number of invoices for subsequent invoice information identification has become a very meaningful issue. Summary of the invention

[0004] Based on this, it is necessary to provide an invoice classification method, device, computer equipment and storage medium that can quickly classify a large number of invoices in response to the above technical problems.

[0005] An invoice classification method, the method comprising:

[0006] Get the image of the invoice to be processed;

[0007] Performing image code recognition on the invoice picture to be processed;

[0008] When the image code is recognized, the invoice image to be processed is recognized to obtain the classification characters in the invoice image to be processed;

[0009] The invoice images to be processed are classified according to the classification characters.

[0010] In one embodiment, the step of identifying the invoice image to be processed to obtain the classified characters in the invoice image to be processed includes:

[0011] Segmenting the invoice image to be processed to obtain a header area;

[0012] Identify the classification characters in the header area.

[0013] In one embodiment, the segmentation of the invoice image to be processed to obtain the header area is processed by a pre-trained header detection model; wherein the training method of the header detection model includes:

[0014] Reading a first invoice image and marking a header position in the first invoice image;

[0015] A header detection model is obtained by training according to the first invoice image and the corresponding header position.

[0016] In one embodiment, the identification of the classified characters in the header area is obtained by a pre-trained character recognition model; wherein the training method of the character recognition model includes:

[0017] Randomly generate text slices of different lengths, and mark the text contents of the text slices;

[0018] A text recognition model is obtained by training according to the text slices of different lengths and the corresponding marked text contents.

[0019] In one embodiment, classifying the invoice image to be processed according to the classification characters includes:

[0020] The invoice classification corresponding to the classification character is obtained as the classification of the invoice image to be processed.

[0021] In one embodiment, the image code recognition of the invoice image to be processed is obtained by a pre-trained image code detection model; wherein the training method of the image code detection model includes:

[0022] reading the second invoice image, and generating a target mark according to whether the second invoice image contains an image code;

[0023] Model training is performed based on the second invoice image and the target mark to obtain an image code detection model.

[0024] An invoice classification device, comprising:

[0025] A receiving module is used to obtain the invoice image to be processed;

[0026] An image code detection module is used to determine whether the invoice image to be processed contains an image code;

[0027] A classification character recognition module, for recognizing the invoice image to be processed to obtain the classification characters in the invoice image to be processed when the image code is recognized;

[0028] A classification module is used to classify the invoice images to be processed according to the classification characters.

[0029] In one embodiment, the classification character recognition module includes:

[0030] A header detection unit is used to segment the invoice image to be processed to obtain a header area;

[0031] The character recognition unit is used to recognize the classification characters in the header area.

[0032] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0033] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.

[0034] The above-mentioned electronic invoice classification method, device, computer equipment and storage medium first obtain the invoice image to be processed, and perform image code recognition on the invoice image to determine whether the invoice image contains an image code. If so, it proceeds to the next step of detection, otherwise the judgment process is terminated in time, which can save the time of the program; when the image code is recognized, the classification characters in the invoice image are further recognized, and the invoice image is classified according to the classification characters, so that the invoice can be quickly classified in a large number of invoices according to the classification characters, so as to lay the foundation for the subsequent different processing of different types of invoices. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A diagram showing an application environment of an invoice classification method in an embodiment;

[0036] Figure 2 A schematic diagram of a flow chart of an invoice classification method in one embodiment;

[0037] Figure 3 A schematic flow chart of a step of identifying an invoice image to be processed to obtain classified characters in the invoice image to be processed in one embodiment;

[0038] Figure 4 This is a schematic diagram of an invoice picture in an embodiment;

[0039] Figure 5 A schematic diagram of a process of pre-training a header detection model in one embodiment;

[0040] Figure 6 A schematic diagram of a process of pre-training a text recognition model in one embodiment;

[0041] Figure 7A schematic diagram of a process of pre-training an image code detection model in one embodiment;

[0042] Figure 8 A schematic diagram of a flow chart of an electronic invoice classification method in one embodiment;

[0043] Fig. 9 is a structural block diagram of an invoice classification device in one embodiment;

[0044] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0045] 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.

[0046] The invoice classification method provided by this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The terminal 102 can send the acquired invoice picture to the server 104, so that the server 104 can process the invoice picture to be processed. For example, the server 104 determines whether the invoice picture to be processed contains an image code. If the invoice picture to be processed contains an image code, it enters the next step of detection, otherwise the judgment process is terminated in time, so that the time-consuming program can be saved; when the invoice picture to be processed contains an image code, the next step of detection is performed to identify the classification characters in the invoice picture to be processed, and the current invoice picture to be processed is classified according to the classification characters. In this way, invoice classification can be quickly carried out from a large number of invoices. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0047] In one embodiment, Figure 2 As shown, a method for classifying invoices is provided, which is applied to Figure 1 The server in the example is used to illustrate the following steps:

[0048] Step 202, obtaining the image of the invoice to be processed.

[0049] Among them, the invoice picture to be processed is the invoice photo received by the server and uploaded by the terminal. The invoice picture to be processed can be a screenshot of the electronic invoice uploaded by the terminal, or a printed electronic invoice or a photographed ordinary invoice. For example, the terminal can select some or all of the invoice pictures to be processed from the terminal as needed and upload them to the server, so that the server can classify the invoice pictures to be processed according to the instructions. When the invoice picture to be processed is an electronic invoice picture, the server can quickly obtain the key information of the invoice by identifying the QR code on the electronic invoice picture, with high accuracy. When the invoice picture to be processed is an ordinary invoice picture, the server obtains the invoice information through OCR and other technologies.

[0050] Step 204: perform image code recognition on the invoice image to be processed.

[0051] The image code refers to a recognizable barcode including invoice information, which can be a one-dimensional code, a two-dimensional code or a barcode.

[0052] Specifically, after the server obtains the invoice image to be identified uploaded by the user, it determines whether the invoice image to be identified contains an image code, so as to perform the next step of processing on the invoice image to be identified.

[0053] Optionally, after the server obtains the invoice image to be identified uploaded by the terminal, it uses the image code detection model to identify the invoice image to determine whether it contains the image code. If it contains the image code, it enters the next processing step for identification; otherwise, it ends the judgment process in time, thereby saving program time.

[0054] It should be noted that invoice classification includes but is not limited to electronic invoices and ordinary invoices, wherein electronic invoices and ordinary invoices can be classified according to the classification characters in the invoices. However, since character recognition is time-consuming, in this embodiment, the server first performs an initial classification of the invoices to be processed by determining whether the invoice pictures to be processed include image codes, thereby filtering out most of the ordinary invoices, and then performing character recognition on the remaining invoice pictures to be processed. This reduces the number of invoices to be processed that require character recognition, thereby improving the efficiency of the entire classification process.

[0055] Step 206: When the image code is recognized, the invoice image to be processed is recognized to obtain the classified characters in the invoice image to be processed.

[0056] The classification characters refer to specific characters used to classify invoice images. For example, the words "electronic" exist in the header area of ​​an electronic invoice, but not in an ordinary invoice. Therefore, the server can classify the invoice images uploaded by the user according to the classification characters in the specific area by identifying the classification characters in the specific area.

[0057] After determining that there is an image code in the image of the invoice to be processed, the server continues to perform classified character recognition on the invoice to be processed. If classified characters are recognized, the invoice to be processed is classified according to the classified characters.

[0058] Optionally, after the server detects the invoice image to be processed uploaded by the user, it segments the invoice image to be processed to obtain a specific area of ​​the invoice image to be processed, such as the header area, and cuts out the header area to obtain a corresponding header slice, and then identifies the classified characters contained in the header slice. In this way, only the characters in the header area are identified, which further reduces the number of character recognitions and improves processing efficiency.

[0059] Step 208, classify the invoice image to be processed according to the classification characters.

[0060] Specifically, the server classifies the invoice image according to the classification characters in the text in the header area of ​​the current invoice image to be processed.

[0061] Optionally, there may be one or more classification characters. For example, the server may classify the invoice images to be processed according to the word "electronic", or may classify the invoice images to be processed according to the two classification characters "electronic" and "medical". Specifically, when the server determines that the classification character is "electronic", the corresponding invoice to be processed is classified as an electronic invoice, otherwise it is classified as an ordinary invoice.

[0062] It should also be noted that when the server receives a large number of invoices to be processed, the invoices to be processed can be distributed to different threads for processing by load balancing. In addition, threads can be divided into image code detection threads, classification character recognition threads, etc. Different threads can be used to process different steps in parallel to improve processing efficiency.

[0063] In the above-mentioned electronic invoice classification method, firstly, the image of the invoice to be processed is obtained, and the image code recognition is performed on the invoice image to determine whether the invoice image contains the image code. If so, the next step of detection is entered, otherwise the judgment process is terminated in time, which can reduce the time consumption of the program; when the image code is recognized, the classification characters in the invoice image are further recognized, and the invoice image is classified according to the classification characters, so that the invoice can be quickly classified in a large number of invoices according to the classification characters, laying the foundation for the subsequent processing of different types of invoices.

[0064] In one embodiment, if Figure 3 As shown, Figure 3 for Figure 2The step flow of step 206 in the illustrated embodiment. In step 206, specifically, the invoice picture to be processed is recognized to obtain the classification characters in the invoice picture to be processed, including the following steps:

[0065] Step 302: Segment the invoice picture to be processed to obtain the header area.

[0066] Specifically, the invoice picture to be processed includes a table area and a header area. Specifically, reference can be made to Figure 4 as shown, where the header area refers to the area located in the middle of the top of the invoice picture to be processed. The remaining area is the table area.

[0067] The server segments the invoice picture to be processed to obtain the header area. Optionally, the server can segment the invoice picture to be processed to obtain the header area through a pre-trained header detection model, or segment the invoice picture to be processed through corresponding image recognition rules.

[0068] The server performs location detection on the invoice picture to be processed for which the image code has been recognized. After the server locates the header position of the current invoice picture to be processed, it segments the current invoice picture to obtain the invoice picture header area. Optionally, to avoid errors, the server can extend the recognized header area outward by a preset number of pixels, such as 5 pixels, and then crop the extended header area by the preset number of pixels to obtain the target header area.

[0069] Step 304: Recognize the classification characters in the header area.

[0070] Specifically, the classification characters refer to specific characters for classifying the invoice picture.

[0071] After the server obtains the target header area, it recognizes the target header area and reads the text content contained in the target header area, where the text content includes classification characters and other characters. Optionally, the server can only recognize and read the classification characters to reduce the amount of character recognition. For example, the server recognizes the header area to determine whether the header area includes the classification character "electronic".

[0072] In the above embodiment, since the server can recognize the text in the header area of the invoice picture to be processed and classify the recognized invoice picture according to the classification characters included in the invoice header area text, a large amount of time loss caused by manual classification of the invoice picture can be avoided.

[0073] In one of the embodiments, as Figure 5 shown, Figure 5The step flow of the header detection model training step in one embodiment is that the invoice image to be processed is segmented to obtain the header area, which is processed by the pre-trained header detection model; wherein the training method of the header detection model includes the following steps:

[0074] Step 502: Read the first invoice image and mark the header position in the first invoice image.

[0075] Specifically, the header detection model refers to a machine learning model used to obtain the header area of ​​the invoice image. After training, the header detection model can quickly segment the invoice image to be processed to obtain the header area; the first invoice image refers to the invoice image data used to train the header detection model, which can be any invoice image including a header.

[0076] The user marks the header position in each first invoice image in advance, so that the server can obtain the first invoice image with the header position marked, and the first invoice image carries the marked header tag.

[0077] Step 504: training a header detection model based on the first invoice image and the corresponding header position.

[0078] The server inputs the first invoice image and the corresponding header position into the first machine learning model, wherein the first machine learning model refers to a machine learning model that can obtain the location of a certain area in the image, wherein optionally, the first machine learning model can select models such as EAST (An Efficient and Accurate Scene Text Detector, a text detection model) and DBNet (Differentiable Binarization Network, a text detection model). The first machine learning model is trained and learned on a large number of first invoice images and their corresponding header positions to obtain a header detection model that can identify the invoice image to be processed to obtain the corresponding header area.

[0079] After determining that there is an image code in the invoice picture to be processed, the server locates the header area of ​​the current invoice picture to be processed through the header detection model, and segments the invoice picture to be processed to obtain corresponding header slices.

[0080] In the above embodiment, since the header detection model for detecting the first invoice image is obtained through training, the position of the invoice header can be quickly and automatically identified. In this way, the header of the invoice image can be identified more quickly and accurately through the header detection model.

[0081] In one embodiment, if Figure 6 As shown, Figure 6The step flow of the character recognition model training step in one embodiment is that the classification characters in the recognition header area are obtained by a pre-trained character recognition model; wherein the training method of the character recognition model includes the following steps:

[0082] Step 602: randomly generate text slices of different lengths, and mark the text contents of the text slices.

[0083] Specifically, the text recognition model refers to a machine learning model used to read the text content in the invoice header area. After training, the text recognition model can quickly read the text content of the header slice in the invoice image to be processed. The randomly generated text slices of different lengths refer to the text slice data used to train the text recognition model. Since the text length of the invoice header in each province and region in the real world is not fixed, such as "Tianjin Medical Outpatient Fee Receipt" and "Guangdong Province Medical Fee Receipt", the length of the training data randomly generated by the server also changes randomly according to certain rules, such as evenly generating text slices of different lengths, or generating text slices of corresponding lengths according to the number of characters in the header of the invoice involved in the application area of ​​the text recognition model, rather than generating text slices of every length.

[0084] The server randomly generates a series of text slices of different lengths, and reads the text content in each text slice to mark the corresponding text slice, where the text slices of different lengths are samples of the text recognition model training set, and the corresponding text content is the sample label.

[0085] Step 604: training a text recognition model based on text slices of different lengths and corresponding marked text contents.

[0086] The server inputs a series of text slices of different lengths and their corresponding text content labels into a second machine learning model, wherein the second machine learning model refers to a machine learning model that can recognize content text in an image, wherein optionally, the second machine learning model may select a model such as CRNN (Convolutional Recurrent Neural Network), and the second machine learning model is trained and learned on a series of text slices of different lengths and the corresponding text content to obtain a text recognition model that can recognize the invoice image to be processed to obtain the content of the header area.

[0087] The server uses a pre-trained header detection model to identify the invoice image to be processed and then segments it to obtain corresponding header slices. It then uses a pre-trained text recognition model to identify the header slices to obtain the text content of the header slices of the invoice image to be processed.

[0088] In the above embodiment, since the text recognition model is obtained through training, the text recognition model can quickly and accurately read the text content in the invoice image, thereby avoiding manual reading of the text content contained in the invoice image and saving human resource expenses.

[0089] In one of the embodiments, classifying the invoice image to be processed according to the classification characters includes: obtaining the invoice classification corresponding to the classification characters as the classification of the invoice image to be processed.

[0090] Specifically, the server classifies the invoice image to be processed according to the classification characters recognized by the text recognition model, wherein the classification characters refer to specific characters for classifying the invoice image, which can be adjusted according to different application scenarios.

[0091] Optionally, there may be one or more classification characters. For example, the server may classify the invoice images to be processed according to the word "electronic", or may classify the invoice images to be processed according to the two classification characters "electronic" and "medical". Specifically, when the server determines that the classification character is "electronic", the corresponding invoice to be processed is classified as an electronic invoice, otherwise it is classified as an ordinary invoice.

[0092] The server uses a pre-trained header detection model to identify the invoice image to be processed and then segments it to obtain corresponding header slices. It then uses a pre-trained text recognition model to identify the header slices to obtain the text content of the header area of ​​the invoice image to be processed, and then classifies the invoice image to be processed according to the classification characters included in the text content of the header area of ​​the invoice image to be processed.

[0093] In the above embodiment, since the server can classify the invoice image according to the classification characters in the invoice image header slice recognized by the text recognition model, a large number of invoices can be quickly and accurately classified according to the classification characters for subsequent invoice image recognition.

[0094] In one embodiment, if Figure 7 As shown, Figure 7 This is a flowchart of a pre-trained image code detection model in an embodiment. The image code detection model includes the following steps:

[0095] Step 702: Read the second invoice image and generate a target mark according to whether the second invoice image contains an image code.

[0096] Specifically, the image code detection model refers to a machine learning model used to determine whether the invoice image to be processed includes an image code. After training, the image code detection model can quickly identify the invoice image to be processed to determine whether it includes an image code; the image code refers to a recognizable barcode that includes invoice information, which can be a one-dimensional code, a two-dimensional code or a barcode.

[0097] The server reads each second invoice image and generates a target mark for each second invoice whether it includes an image code. Optionally, the target mark can be "1" or "0". If the second invoice image contains an image code, the target mark of the second image is "1", otherwise it is "0", where the second invoice is a sample of the image code detection model, and the corresponding target mark is the sample label.

[0098] Optionally, the second invoice can be a real invoice image, whose data is more real, so that the trained image code detection model can recognize the image code more accurately. It can also be generated by the server through image generation method, where the image code is processed and then pasted on the invoice image. The purpose of spatial processing is to make the invoice picture closer to the real one. If the second image is generated by image generation method, the coordinates of the image code can be directly obtained, which is more convenient and quick.

[0099] Step 704: Perform model training based on the second invoice image and the target mark to obtain an image code detection model.

[0100] The server inputs the second invoice image and the corresponding target mark into the third machine learning model, wherein the third machine learning model refers to a machine learning model that can identify whether the invoice image contains an image code, wherein optionally, the third machine learning model can select models such as YOLO (You Only Look Once, an object detection algorithm) series models, FasterR-CNN (Faster Convolutional Recurrent Neural Network, regional convolutional neural network) and MaskR-CNN (Mask Convolutional Recurrent Neural Network, an instance segmentation framework), and the third machine learning model is trained and learned on the second invoice image and the corresponding target mark to obtain an image code detection model that can identify whether the invoice image to be processed includes an image code.

[0101] The server uses a pre-trained image code detection model to identify the invoice image to be processed to determine whether the invoice image to be processed includes an image code. If it does, the current invoice image to be processed is sent to the header training model. Otherwise, the judgment process is terminated in time, thereby saving program time.

[0102] In the above embodiment, since the image code detection model is used to quickly determine whether the invoice image to be identified contains an image code, the server can promptly end the identification process for the invoice object to be identified that does not contain an image code, thereby filtering out most of the ordinary invoices, thereby reducing the time consumption of the program.

[0103] In one embodiment, if Figure 8 As shown, the discrimination process of an electronic invoice classification method is as follows:

[0104] The server first obtains the image of the invoice to be processed, where the image of the invoice to be processed can be an electronic invoice uploaded by the terminal or an ordinary invoice; then, the invoice image to be tested is detected by the QR code detection model to determine whether the current invoice image to be processed includes a QR code. If the current invoice image to be processed includes a QR code, the header detection model is entered for the next step of detection, otherwise the judgment process is immediately terminated and the current invoice image to be processed is determined to be an ordinary invoice; the invoice image to be processed including the QR code is located by the header detection model, the header area of ​​the current invoice image to be processed is obtained, and the header area is segmented to obtain the corresponding header slices, and then the text content in the header slice is read by the text recognition model, and the text content is determined whether it contains the word "electronic", where "electronic" is the classification character of the electronic invoice classification method. If the current invoice image to be processed contains the word "electronic", it is determined to be an electronic invoice, otherwise it is an ordinary invoice.

[0105] Among them, the QR code detection model, header detection model and text recognition model are obtained through pre-training, and are used to determine whether the invoice image to be processed includes a QR code, to locate and identify the invoice header area of ​​the invoice to be processed and to segment it to obtain invoice header slices, and to perform text recognition on the invoice header slices to obtain classified characters in the invoice header slices.

[0106] In the above embodiment, the electronic invoice classification method first uses the QR code detection model to detect the invoice image to be tested, and uses the header detection model and the text recognition model to obtain and read the header slice and the text content in the slice in the invoice image to be processed for the invoice image containing the QR code, and finally classifies the invoice image to be processed according to the classification character, that is, "electronic", so that the electronic invoice can be separated from a large number of invoices, so as to lay the foundation for different processing of different types of invoices in the future. Among them, the QR code detection model can promptly end the discrimination process for the invoice image to be identified that does not contain the QR code, so as to save the time-consuming purpose of the program, so that the invoice image to be identified can be classified more quickly.

[0107] It should be understood that although Figure 1-8 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-8At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0108] In one embodiment, Fig. 9 As shown, an invoice classification device is provided, comprising: a receiving module 100, an image code detection module 200, an image recognition module 300, and a classification module 400, wherein:

[0109] Receiving module 100, used to obtain the invoice picture to be processed;

[0110] An image code detection module 200 is used to determine whether the invoice image to be processed contains an image code;

[0111] The classification character recognition module 300 is used to recognize the invoice picture to be processed to obtain the classification characters in the invoice picture to be processed when recognizing the image code;

[0112] The classification module 400 is used to classify the invoice images to be processed according to the classification characters.

[0113] In one embodiment, the classification character recognition module 300 includes:

[0114] A header detection unit, used to segment the invoice image to be processed to obtain a header area;

[0115] The character recognition unit is used to recognize the classification characters in the header area.

[0116] In one embodiment, the header detection unit is used to segment the invoice image to be processed by using a pre-trained header detection model to obtain a header area; the invoice classification device further includes:

[0117] A first image acquisition submodule, used for reading the first invoice image and marking the header position in the first invoice image;

[0118] The header detection submodule is used to obtain a header detection unit through training based on the first invoice image and the corresponding header position.

[0119] In one embodiment, the character recognition unit is used to recognize the classification characters in the header area through a pre-trained character detection model; the invoice classification device also includes:

[0120] Data acquisition submodule: used to randomly generate text slices of different lengths and mark the text content of the text slices;

[0121] The text recognition submodule is used to obtain a text recognition unit through training based on text slices of different lengths and corresponding marked text contents.

[0122] In one embodiment, the classification module 400 includes:

[0123] A receiving unit, used for receiving the classified characters included in the image to be processed;

[0124] The classification unit is used to classify the invoice image to be processed according to the invoice classification corresponding to the classification character.

[0125] In one embodiment, the image code detection module is used to determine whether the invoice image to be processed contains an image code through a pre-trained image code detection model; the invoice classification device also includes:

[0126] A second image acquisition submodule, used for reading the second invoice image and generating a target mark according to whether the second invoice image contains an image code;

[0127] The image code detection submodule is used to perform model training according to the second invoice image and the target mark to obtain the image code detection module.

[0128] The specific definition of an invoice classification device can be found in the definition of the invoice classification method above, which will not be repeated here. Each module in the above-mentioned invoice classification device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules 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 of the above modules.

[0129] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory and a network interface 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, 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 database of the computer device is used to store invoice image data to be identified. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an invoice classification method is implemented.

[0130] Those skilled in the art will understand that Fig.10The 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. In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining an image of an invoice to be processed; performing image code recognition on the image of the invoice to be processed; when the image code is recognized, recognizing the image of the invoice to be processed to obtain the classification characters in the image of the invoice to be processed; and classifying the image of the invoice to be processed according to the classification characters.

[0131] In one embodiment, the processor executes a computer program to recognize the invoice image to be processed to obtain the classification characters in the invoice image to be processed, including: segmenting the invoice image to be processed to obtain a header area; and recognizing the classification characters in the header area.

[0132] In one embodiment, the segmentation of the invoice image to be processed to obtain the header area implemented by the processor when executing the computer program is processed by a pre-trained header detection model; the training method of the header detection model involved in the processor executing the computer program includes: reading the first invoice image and marking the header position in the first invoice image; training according to the first invoice image and the corresponding header position to obtain the header detection model.

[0133] In one embodiment, the classification characters in the recognition header area implemented by the processor when executing a computer program are obtained through a pre-trained text recognition model; the training method of the text recognition model involved when the processor executes the computer program includes: randomly generating text slices of different lengths and marking the text content of the text slices; training according to text slices of different lengths and the corresponding marked text content to obtain a text recognition model.

[0134] In one embodiment, the classification of the invoice image to be processed according to the classification characters implemented by the processor when executing the computer program includes: obtaining the invoice classification corresponding to the classification character as the classification of the invoice image to be processed.

[0135] In one embodiment, the image code recognition of the invoice image to be processed implemented when the processor executes the computer program is obtained through a pre-trained image code detection model; the training method of the image code detection model involved when the processor executes the computer program includes: reading the second invoice image, and generating a target mark according to whether the second invoice image contains the image code; and performing model training based on the second invoice image and the target mark to obtain the image code detection model.

[0136] 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 following steps are implemented: obtaining a picture of an invoice to be processed; performing image code recognition on the picture of the invoice to be processed; when the image code is recognized, recognizing the picture of the invoice to be processed to obtain classification characters in the picture of the invoice to be processed; and classifying the picture of the invoice to be processed according to the classification characters.

[0137] In one embodiment, when the computer program is executed by a processor, the process of identifying the invoice image to be processed to obtain the classified characters in the invoice image to be processed includes: segmenting the invoice image to be processed to obtain a header area; and identifying the classified characters in the header area.

[0138] In one embodiment, the segmentation of the invoice image to be processed to obtain the header area implemented by the computer program when executed by the processor is processed by a pre-trained header detection model; the training method of the header detection model involved when the computer program is executed by the processor includes: reading the first invoice image and marking the header position in the first invoice image; training according to the first invoice image and the corresponding header position to obtain the header detection model.

[0139] In one embodiment, the classification characters in the recognition header area implemented by the computer program when executed by the processor are obtained through a pre-trained text recognition model; the training method of the text recognition model involved when the computer program is executed by the processor includes: randomly generating text slices of different lengths and marking the text content of the text slices; and training the text recognition model according to text slices of different lengths and the corresponding marked text content.

[0140] In one embodiment, the classification of the invoice image to be processed according to the classification characters implemented when the computer program is executed by the processor includes: obtaining the invoice classification corresponding to the classification character as the classification of the invoice image to be processed.

[0141] In one embodiment, the image code recognition of the invoice image to be processed implemented by the computer program when executed by the processor is obtained by a pre-trained image code detection model; the training method of the image code detection model involved in the execution of the computer program by the processor includes: reading the second invoice image, and generating a target mark according to whether the second invoice image contains an image code; training the model according to the second invoice image and the target mark to obtain the image code detection model. A person of ordinary skill in the art can understand that the implementation of 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 memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0142] 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 specification.

[0143] The above-mentioned 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 invention patent. 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 patent of the present application shall be subject to the attached claims.

Claims

1. A method for classifying invoices, characterized in that: The method comprises: Get the image of the invoice to be processed; Performing image code recognition on the invoice picture to be processed; When the image code is not recognized, determining that the invoice corresponding to the invoice image to be processed is a common invoice; When the image code is recognized, the invoice image to be processed is recognized to obtain the classification characters in the invoice image to be processed; Classify the invoice images to be processed according to the classification characters to obtain electronic invoices and ordinary invoices; The step of identifying the invoice image to be processed to obtain the classified characters in the invoice image to be processed includes: Segmenting the invoice image to be processed to obtain a header area; Identifying classification characters in the header area; The identification of the classified characters in the header area is obtained by a pre-trained character recognition model; wherein the training method of the character recognition model includes: Randomly generate text slices of different lengths and mark the text content of the text slices, wherein when randomly generating the text slices, the text slices of different lengths are generated equally, or the text slices of corresponding lengths are generated according to the number of characters in the header of the invoice involved in the application area of ​​the text recognition model; A text recognition model is obtained by training according to the text slices of different lengths and the corresponding marked text contents.

2. The method according to claim 1, characterized in that The segmentation of the invoice image to be processed to obtain the header area is processed by a pre-trained header detection model; wherein the training method of the header detection model includes: Reading a first invoice image and marking a header position in the first invoice image; A header detection model is obtained by training according to the first invoice image and the corresponding header position.

3. The method according to claim 1, characterized in that: The classifying the invoice image to be processed according to the classification characters includes: The invoice classification corresponding to the classification character is obtained as the classification of the invoice image to be processed.

4. The method according to claim 1, characterized in that The image code recognition of the invoice picture to be processed is obtained by a pre-trained image code detection model; wherein the training method of the image code detection model includes: reading the second invoice image, and generating a target mark according to whether the second invoice image contains an image code; Model training is performed based on the second invoice image and the target mark to obtain an image code detection model.

5. An invoice sorting device, characterized in that: The device comprises: A receiving module is used to obtain the invoice image to be processed; An image code detection module is used to determine whether the invoice image to be processed contains an image code. When the image code is not recognized, it is determined that the invoice corresponding to the invoice image to be processed is an ordinary invoice; A classification character recognition module, for recognizing the invoice image to be processed to obtain the classification characters in the invoice image to be processed when the image code is recognized; A classification module, used for classifying the invoice images to be processed according to the classification characters to obtain electronic invoices and ordinary invoices; The classification character recognition module comprises: A header detection unit is used to segment the invoice image to be processed to obtain a header area; A character recognition unit, used for recognizing the classification characters in the header area; The character recognition unit is used to recognize the classification characters in the header area through a pre-trained character detection model; wherein the above device also includes: A data acquisition submodule, for randomly generating text slices of different lengths and marking the text contents of the text slices, wherein when randomly generating text slices, text slices of different lengths are generated equally, or text slices of corresponding lengths are generated according to the number of characters in the header of the invoice involved in the application area of ​​the text recognition model; The text recognition submodule is used to obtain a text recognition model through training based on the text slices of different lengths and the corresponding marked text contents.

6. The device according to claim 5, characterized in that The header detection unit is used to segment the invoice image to be processed by using a pre-trained header detection model to obtain a header area; wherein the device further includes: A first image acquisition submodule, used for reading a first invoice image and marking a header position in the first invoice image; The header detection submodule is used to obtain a header detection model through training based on the first invoice image and the corresponding header position.

7. The device according to claim 5, characterized in that The device also includes: The classification unit is used to obtain the invoice classification corresponding to the classification character as the classification of the invoice image to be processed.

8. The device according to claim 5, characterized in that The image code detection module is used to determine whether the invoice image to be processed contains an image code through a pre-trained image code detection model; wherein the device also includes: A second image acquisition submodule, used for reading a second invoice image and generating a target mark according to whether the second invoice image contains an image code; The image code detection submodule is used to perform model training according to the second invoice image and the target mark to obtain an image code detection model.

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 4 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 4 are implemented.