Invoice detection method, invoice detection device, equipment and storage medium
By performing image correction and feature extraction on invoice images and identifying invoice information and types, the problem of invoice information being unable to quickly and accurately identify invoice information in the prior art is solved, and accurate detection and interception of invoice risks are achieved.
Patent Information
- Application Number
- CN202411097288.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-12-13
AI Technical Summary
The prior art cannot quickly and accurately identify invoice information, and it is difficult to detect invoice risks, such as false invoice issuance, fake invoices, repeated verification and red rush after issuance.
By obtaining invoice images, the invoice information is extracted, including text information and seal information is included, and the invoice detection results are generated, and the invoice type and risk are identified.
It realizes the rapid and accurate identification of invoice information and can accurately identify abnormal invoices, thereby prompting and intercepting them, and improving the accuracy of detection of invoice risks.
Smart Images

Figure CN119131824A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to an invoice detection method, an invoice detection device, a computer device, and a computer-readable storage medium. Background Art
[0002] Invoices are important documents for production, sale or purchase of goods, provision or receipt of services and other activities. They can be used for tax deduction, reimbursement, and after-sales service. In the daily invoice management of enterprises, there is a risk of false invoices. However, due to the complexity of the current invoice styles and types, and the different locations of key fields, it is impossible to quickly and accurately identify invoice information, and there may be false detection. Summary of the invention
[0003] The present application provides an invoice detection method, an invoice detection device, a computer device and a computer-readable storage medium, aiming to solve the problem that invoice information cannot be quickly and accurately identified, and whether an invoice is risky cannot be accurately detected.
[0004] To achieve the above objectives, the present application provides an invoice detection method, the method comprising:
[0005] Acquire an invoice image, and perform image correction processing on the invoice image to obtain a target invoice image;
[0006] Extracting features of the target invoice image to obtain invoice information, wherein the invoice information includes invoice text information and invoice seal information;
[0007] Classify the invoice according to the invoice text information to obtain the invoice type;
[0008] Obtaining historical invoices corresponding to the invoice type, detecting the target invoice image according to the invoice text information and the historical invoices, and obtaining frame detection information;
[0009] Detect the invoice seal information according to the invoice type to obtain seal detection information;
[0010] The detection result of the invoice is generated according to the frame detection information and the seal detection information.
[0011] To achieve the above-mentioned purpose, the present application provides an invoice detection device, which includes:
[0012] An image processing module is used to obtain an invoice image, and perform image correction processing on the invoice image to obtain a target invoice image;
[0013] A feature extraction module, used to extract features from the target invoice image to obtain invoice information, wherein the invoice information includes invoice text information and invoice seal information;
[0014] An invoice classification module, used to classify the invoice according to the invoice text information to obtain the invoice type;
[0015] A frame detection module, used to obtain historical invoices corresponding to the invoice type, detect the target invoice image according to the invoice text information and the historical invoices, and obtain frame detection information;
[0016] A seal detection module, used to detect the invoice seal information according to the invoice type to obtain seal detection information;
[0017] A risk assessment module is used to generate a detection result of the invoice according to the frame detection information and the seal detection information.
[0018] To achieve the above-mentioned purpose, the present application provides a computer device, which includes a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the invoice detection method as described above when executing the computer program.
[0019] To achieve the above objectives, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the invoice detection method as described above.
[0020] The invoice detection method, invoice detection device, computer equipment and computer-readable storage medium disclosed in the embodiment of the present application obtain an invoice image, perform image correction processing on the invoice image, and obtain a target invoice image; perform feature extraction on the target invoice image to obtain invoice information, which includes invoice text information and invoice seal information; classify invoices according to the invoice text information to obtain invoice types; obtain historical invoices corresponding to the invoice type, detect the target invoice image according to the invoice text information and historical invoices, and obtain frame detection information; detect the invoice seal information according to the invoice type to obtain seal detection information; generate invoice detection results according to the frame detection information and seal detection information. In this way, the invoice information can be quickly and accurately identified, and various possible invoice risks can be detected according to the invoice information, and abnormal invoices can be accurately identified, so as to provide prompts and interceptions. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 It is a scenario diagram of an invoice detection method provided in an embodiment of the present application;
[0023] Figure 2 It is a flowchart of an invoice detection method provided in an embodiment of the present application;
[0024] Figure 3 is a schematic block diagram of an invoice detection device provided in one embodiment of the present application;
[0025] Figure 4 It is a schematic block diagram of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0027] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor do they have to be executed in the order described. For example, some operations / steps can also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions. In addition, although the functional modules are divided in the device schematic, in some cases, the module division can be different from that in the device schematic.
[0028] The term "and / or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0029] In the relevant technologies, there are mainly the following types of invoice risks:
[0030] 1. False invoices: For example, false VAT invoices cannot be verified on the national platform.
[0031] 2. Forging invoices: using PS and other means to modify the amount, name, date, invoicing unit and other information, or splicing the QR code of the real invoice with self-filled information.
[0032] 3. Duplicate write-offs, such as using the same invoice for multiple claims in the insurance industry.
[0033] 4. Red rush after opening.
[0034] The following are the invoice risk control management technical means and their shortcomings in related technologies:
[0035] (1) Query and verify the consistency through the VAT invoice verification platform or the fiscal electronic invoice verification platform, and conduct multiple verifications and round-trip inspections within the cycle to check the red clearance. The shortcoming is that there is no query platform for ordinary invoices, which makes it impossible to query.
[0036] (2) Analyzing the image metadata EXIF information has the disadvantage that the information can be modified and erased, and it is impossible to confirm the specific modification location.
[0037] (3) Detection and segmentation through PS traces. The disadvantage is that when the counterfeiter has high technology, the modified part and the background are well integrated, and the visual difference can be weakened by introducing moiré patterns through multiple compression or shooting the screen, so it is often difficult to detect the traces of PS.
[0038] (4) Duplicate submission is checked through the image duplication checking system. The disadvantage is that it is very easy to escape the detection of the image duplication checking system by changing the background of the same invoice.
[0039] (5) Duplicate submissions are checked through the invoice number duplication checking system. The disadvantage is that the information is single and the invoice number is the most common object of tampering.
[0040] (6) The disadvantage of establishing dishonest enterprises is information lag.
[0041] (7) Through information verification, such as verification of the total amount and the sum of expense items; item, quantity and amount analysis, the rationality of the expense name and amount can be judged based on historical data. The disadvantage is that it is difficult to distinguish when there are only major items but no detailed items. For example, if only "Western medicine fee 1,230 yuan" is printed without listing the specific Western medicine information, it is impossible to judge whether the amount is reasonable.
[0042] (8) Check the rationality of the issue date and ticket number, and recheck the serial number.
[0043] The above-mentioned invoice risk control management technical means all have certain defects. The present application proposes an invoice detection method, an invoice detection device, a computer device and a computer-readable storage medium, which can quickly and accurately identify invoice information, and detect various possible invoice risks based on the invoice information, and can accurately identify abnormal invoices, thereby providing prompts and interception.
[0044] The method can be applied to a server, and of course, can also be applied to a terminal device to generate a corresponding image classification model, wherein the terminal device may include a fixed terminal such as a mobile phone, a tablet computer, a personal digital assistant (PDA), etc. The server can be, for example, a separate server or a server cluster. However, for ease of understanding, the following embodiments will be described in detail with the invoice detection method applied to the server.
[0045] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0046] like Figure 1 As shown, the invoice detection method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. The application environment includes a terminal device 110 and a server 120, wherein the terminal device 110 can communicate with the server 120 through a network. Specifically, the server 120 obtains an invoice image, performs image correction processing on the invoice image, and obtains a target invoice image; performs feature extraction on the target invoice image to obtain invoice information, and the invoice information includes invoice text information and invoice seal information; classifies the invoice according to the invoice text information to obtain the invoice type; obtains the historical invoice corresponding to the invoice type, detects the target invoice image according to the invoice text information and the historical invoice, and obtains the frame detection information; detects the invoice seal information according to the invoice type to obtain the seal detection information; generates the invoice detection result according to the frame detection information and the seal detection information, and sends the invoice detection result to the terminal device 110. Among them, the server 120 can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal device 110 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0047] See also Figure 2 , Figure 2 This is a schematic flow chart of an invoice detection method provided in an embodiment of the present application. The invoice detection method can quickly and accurately identify invoice information, detect various possible invoice risks based on the invoice information, and accurately identify abnormal invoices, thereby providing prompts and interception.
[0048] like Figure 2 As shown, the invoice detection method includes steps S101 to S106.
[0049] S101, acquiring an invoice image, and performing image correction processing on the invoice image to obtain a target invoice image.
[0050] The invoice image is an image corresponding to an electronic invoice or a common invoice, for example, a photo corresponding to the invoice, etc. The target invoice image is an invoice image with a regular shape after being processed and the background removed.
[0051] In some embodiments, based on the bill body detection model, the invoice image is detected to obtain a mask corresponding to the invoice body area; the invoice is deformed and corrected according to the mask corresponding to the invoice body area to obtain a target invoice image. In this way, an invoice image with a regular shape and without background can be obtained, avoiding interference from image background and paper distortion, which may lead to inaccurate invoice detection.
[0052] Among them, the bill body detection model can be used to detect the main area of the invoice.
[0053] Specifically, the mask of the invoice body area can be obtained through the bill body detection model, so that the background can be removed by using the mask of the invoice body area. Based on the deformation correction network, the invoice is deformed according to the mask corresponding to the invoice body area, so as to obtain an invoice image with the background removed and regular shape, that is, the target invoice image. By performing image correction processing on the invoice image, the target invoice image is obtained, which is not affected by the shooting background, angle and paper distortion, and risk warning can be provided even if the counterfeiter tampers with the invoice number.
[0054] In some embodiments, after the invoice image is corrected and the target invoice image is obtained, the image features of the historical invoice image and the target invoice image are obtained; the similarity between the target invoice image and the historical invoice image is determined based on the image features; if the similarity exceeds a first similarity threshold, risk warning information of the invoice is generated. In this way, the repeatability verification of the phenomenon of obtaining a fake invoice based on partial tampering of a real invoice can be improved through image features, and risk warnings can be issued even if the counterfeiter tampers with the invoice number and other information through means such as PS.
[0055] The historical invoice image is an image corresponding to the historical invoice, and the image features may include contour features and regional features in the invoice image. The similarity between the target invoice image and the historical invoice image is used to indicate the similarity between the image features of the target invoice image and the historical invoice image. The first similarity threshold may be any similarity threshold, such as 0.8, which is not specifically limited here.
[0056] Specifically, after obtaining the target invoice image, the similarity between the target invoice image and the historical invoice image is determined based on the image features; if the similarity exceeds a first similarity threshold, risk warning information for the invoice is generated; if the similarity does not exceed the first similarity threshold, it is determined that there is no risk of reusing historical invoices, so that subsequent invoice detection can be performed.
[0057] Exemplarily, if the first similarity threshold is 0.8, it can be determined based on the image features that the similarity between the target invoice image and the historical invoice image is 0.9. At this time, it can be determined that the similarity between the target invoice image and the historical invoice image exceeds the first similarity threshold, and risk warning information of the invoice is generated to remind the user that there may be a risk of reusing historical invoices.
[0058] S102: Extract features of the target invoice image to obtain invoice information, which includes invoice text information and invoice seal information.
[0059] The invoice information may include invoice text information and invoice seal information. The invoice text information may include the invoice header and invoice content, and the invoice seal information may include the seal quantity, seal position, seal shape and seal text content.
[0060] In some embodiments, text extraction is performed on the target invoice image to obtain invoice text information, which includes the invoice header and invoice content; seal recognition is performed on the target invoice image to obtain invoice seal information, which includes the number of seals, seal positions, seal shapes and seal text content. In this way, the invoice text information and invoice seal information can be accurately extracted from the target invoice image.
[0061] Specifically, text recognition processing is performed on the target invoice image to obtain the text area of the target invoice image, and text extraction processing is performed on the text area to obtain the invoice text information including the invoice header and invoice content; seal recognition processing is performed on the target invoice image to obtain the seal area of the target invoice image, and feature extraction processing is performed on the text area to obtain features such as the number of seals, seal positions, seal shapes and seal text content.
[0062] In some embodiments, the invoice header and invoice content are checked for duplicates to determine whether there are invoices with identical invoice headers and invoice content. If there are invoices with identical invoice headers and invoice content, risk warning information for the invoice is generated to remind the user that there may be a risk of reusing historical invoices.
[0063] Specifically, it can be determined whether the invoice header and invoice content of the target invoice image are consistent with those of the historical invoice image. If the invoice header and invoice content of the target invoice image are consistent with those of the historical invoice image, risk warning information of the invoice is generated to remind the user that there may be a risk of reusing historical invoices.
[0064] For example, the invoice header, such as the name of the reimbursement company and the tax number, can be checked for duplication, and the invoice date and total amount can also be checked for duplication. If the above information is consistent, a risk warning message for the invoice is generated to remind the user that there may be a risk of reusing historical invoices.
[0065] S103. Classify the invoice according to the invoice text information to obtain the invoice type.
[0066] Among them, invoice types can include value-added tax invoices, electronic invoices, ordinary invoices and other types.
[0067] Specifically, the invoices may be classified by invoice contents such as invoice titles to obtain invoice types.
[0068] For example, text recognition can be used to determine whether the invoice content contains relevant words such as "value-added tax". If the invoice content contains relevant words such as "value-added tax", the invoice type is determined to be a value-added tax invoice.
[0069] S104, obtaining historical invoices corresponding to the invoice type, detecting the target invoice image according to the invoice text information and the historical invoices, and obtaining frame detection information.
[0070] Among them, since the text content of invoices issued by the same invoicing unit in a short period of time is similar, the historical invoices can be selected from the invoices issued by the same invoicing unit in a short period of time. The frame detection information is used to indicate whether the invoice layout of the historical invoice is consistent with that of the target invoice image. If the invoice layout is consistent, a risk warning message of invoice splicing and reuse is generated. If the invoice layout is inconsistent, it is determined that there is no risk of invoice splicing and reuse, so that subsequent invoice detection can be performed.
[0071] In some embodiments, layout feature information is extracted from historical invoices; the invoice text information and layout feature information are spliced to obtain a spliced invoice; the similarity between the spliced invoice and the target invoice image is determined; if the similarity exceeds a second similarity threshold, frame detection information indicating verification failure is generated. This allows detection of invoices that are globally forged but not locally tampered with, such as those obtained through computer typesetting, self-filling, or privately engraved seals, and makes full use of historical bill layout information from different invoicing units to automatically verify and intercept seals, text content, and invoice types, even for ordinary invoices with no traces of P-images on the face of the invoice.
[0072] The layout feature information is used to represent the basic framework and style content of the invoice, such as the location where the invoice information is filled in. Generally, different types of invoices correspond to different layout feature information. The spliced invoice is obtained by splicing the layout feature information with the invoice text information. The similarity between the spliced invoice and the target invoice image is used to represent the similarity between the layout features of the spliced invoice and the target invoice image. The second similarity threshold can be any similarity threshold, such as 0.8, which is not specifically limited here.
[0073] Specifically, layout feature information can be obtained from historical invoices through framework recognition processing; the invoice text information is spliced with the invoice framework information and the invoice layout information to obtain a spliced invoice; the similarity between the spliced invoice and the target invoice image is determined based on the Layoutlmv3 binary classification model; if the similarity exceeds a second similarity threshold, framework detection information of failed verification is generated; if the similarity does not exceed the second similarity threshold, framework detection information of successful verification is generated.
[0074] Exemplarily, if the second similarity threshold is 0.85, it can be determined based on the image features that the similarity between the spliced invoice and the target invoice image is 0.95. At this time, it can be determined that the similarity between the spliced invoice and the target invoice image exceeds the second similarity threshold, and a verification failed framework detection information is generated to remind the user that there may be a risk of splicing and reusing historical invoices.
[0075] S105. Detect the invoice seal information according to the invoice type to obtain seal detection information.
[0076] The invoice seal information may include the number of seals, seal positions, seal shapes and seal text content. The seal detection information is used to indicate whether the seal of the target invoice image is abnormal. If the seal of the target invoice image is abnormal, a risk warning message of seal abnormality is generated. If the seal of the target invoice image is not abnormal, a warning message of normal seal is generated.
[0077] In some embodiments, the target seal quantity, target seal position and target seal shape are determined according to the invoice type; whether the seal quantity is the target seal quantity is determined; if the seal quantity is the target seal quantity, the offset distance between the seal position and the target seal position is determined; if the offset distance is less than the preset offset distance, the similarity between the seal shape and the target seal shape is determined; if the similarity is greater than a third similarity threshold, the seal detection information of successful verification is generated. In this way, the seal quantity, seal position and seal shape can be accurately detected for abnormality, so as to determine whether the seal is abnormal.
[0078] Among them, the target seal quantity is the seal quantity corresponding to the invoice of this invoice type; the target seal position is the position of the seal corresponding to the invoice of this invoice type; the target seal shape is the seal shape corresponding to the invoice of this invoice type. The preset offset distance is used to represent the position difference between the seal position and the target seal position, which can be any offset distance, such as 1mm, and is not specifically limited here. The similarity between the seal shape and the target seal shape is used to represent the shape and similarity between the seal shape and the target seal shape. The third similarity threshold can be any similarity threshold, such as 0.8, and is not specifically limited here.
[0079] Specifically, according to the invoice type, the seal quantity, seal position and seal shape corresponding to the invoice are determined as the target seal quantity, target seal position and target seal shape, and it is determined whether the seal quantity is the target seal quantity; if the seal quantity is not the target seal quantity, seal detection information of failed verification is generated; if the seal quantity is the target seal quantity, the offset distance between the seal position and the target seal position is determined; if the offset distance is not less than the preset offset distance, seal detection information of failed verification is generated; if the offset distance is less than the preset offset distance, the similarity between the seal shape and the target seal shape is determined; if the similarity is not greater than a third similarity threshold, seal detection information of failed verification is generated; if the similarity is greater than the third similarity threshold, seal detection information of successful verification is generated.
[0080] For example, if the number of seals corresponding to the invoice is 3 and the target number of seals is 4, and the number of seals is less than the target number of seals, then seal detection information of failed verification is generated; if the number of seals corresponding to the invoice and the target number of seals are both 4, then seal detection information of successful verification is generated.
[0081] For example, assuming that the preset offset distance is 1 mm, if the offset distance between the seal position and the target seal position is 0.5 mm, and the offset distance is less than the preset offset distance, then seal detection information of successful verification is generated; if the offset distance between the seal position and the target seal position is 1.5 mm, and the offset distance is greater than the preset offset distance, then seal detection information of failed verification is generated.
[0082] Exemplarily, assuming that the third similarity threshold is 0.8, if the similarity between the seal shape and the target seal shape is 0.9, and the similarity is greater than the third similarity, then seal detection information of successful verification is generated; if the similarity between the seal shape and the target seal shape is 0.7, and the similarity is less than the third similarity, then seal detection information of failed verification is generated.
[0083] In some embodiments, keyword information is obtained to determine whether the seal text content includes keyword information; if the seal text content includes keyword information, seal detection information indicating that verification failed is generated. Thus, risk warnings can be issued for keywords contained in the seal, thereby improving the accuracy of invoice detection.
[0084] The keyword information is pre-set words, such as insurance or claims.
[0085] Specifically, the seal text content can be obtained from the invoice seal information, and it can be determined whether the seal text content includes keyword information. If the seal text content includes keyword information, seal detection information of failed verification is generated; if the seal text content does not include keyword information, seal detection information of successful verification is generated. In this way, multiple claims risk warnings can be made based on keywords such as "insurance" and "claims" in the health insurance scenario, thereby improving the accuracy of invoice detection.
[0086] It should be noted that as long as any one of the seal quantity, seal position, seal shape and seal text content fails to pass the verification, seal detection information indicating verification failure will be generated.
[0087] S106: Generate an invoice detection result based on the frame detection information and the seal detection information.
[0088] Among them, the invoice inspection results are used to determine whether there are risks in the invoice.
[0089] Specifically, if both the frame detection information and the seal detection information are verified successfully, a detection result that the invoice does not have risks can be generated; if the frame detection information verification fails and the seal detection information verification succeeds, a detection result that the invoice has risks can be generated, and the specific reasons for the possible risks can be displayed, such as the layout is similar to historical invoices; if the frame detection information verification succeeds and the seal detection information verification fails, a detection result that the invoice has risks can be generated, and the specific reasons for the possible risks can be displayed, such as the unequal number of seals.
[0090] The invoice detection method disclosed in the embodiment of the present application obtains an invoice image, performs image correction processing on the invoice image, and obtains a target invoice image; extracts features from the target invoice image to obtain invoice information, which includes invoice text information and invoice seal information; classifies invoices according to the invoice text information to obtain invoice types; obtains historical invoices corresponding to the invoice type, detects the target invoice image according to the invoice text information and the historical invoices, and obtains frame detection information; detects the invoice seal information according to the invoice type to obtain seal detection information; generates invoice detection results according to the frame detection information and the seal detection information. In this way, the invoice information can be quickly and accurately identified, and various possible invoice risks can be detected according to the invoice information, and abnormal invoices can be accurately identified, so as to provide prompts and interceptions.
[0091] See also Figure 3 , Figure 3 It is a schematic block diagram of an invoice detection device provided in an embodiment of the present application. The invoice detection device can be configured in a server to execute the aforementioned invoice detection method.
[0092] like Figure 3 As shown, the invoice detection device 200 includes: an image processing module 201, a feature extraction module 202, an invoice classification module 203, a frame detection module 204, a seal detection module 205 and a risk assessment module 206.
[0093] The image processing module 201 is used to obtain an invoice image and perform image correction processing on the invoice image to obtain a target invoice image;
[0094] A feature extraction module 202 is used to extract features from the target invoice image to obtain invoice information, wherein the invoice information includes invoice text information and invoice seal information;
[0095] An invoice classification module 203, used to classify the invoice according to the invoice text information to obtain the invoice type;
[0096] A frame detection module 204 is used to obtain the historical invoice corresponding to the invoice type, detect the target invoice image according to the invoice text information and the historical invoice, and obtain frame detection information;
[0097] A seal detection module 205 is used to detect the invoice seal information according to the invoice type to obtain seal detection information;
[0098] The risk assessment module 206 is used to generate a detection result of the invoice according to the frame detection information and the seal detection information.
[0099] In some embodiments, the image processing module 201 is further used to detect the invoice image based on the bill body detection model to obtain a mask corresponding to the invoice body area; and to perform deformation correction on the invoice according to the mask corresponding to the invoice body area to obtain a target invoice image.
[0100] In some embodiments, the image processing module 201 is also used to obtain image features of the historical invoice image and the target invoice image; determine the similarity between the target invoice image and the historical invoice image based on the image features; if the similarity exceeds a first similarity threshold, generate risk warning information for the invoice.
[0101] In some embodiments, the feature extraction module 202 is also used to perform text extraction processing on the target invoice image to obtain invoice text information, and the invoice text information includes the invoice header and invoice content; perform seal recognition processing on the target invoice image to obtain invoice seal information, and the invoice seal information includes the number of seals, seal positions, seal shapes and seal text content.
[0102] In some embodiments, the frame detection module 204 is further used to extract layout feature information from the historical invoice; splice the invoice text information with the layout feature information to obtain a spliced invoice; determine the similarity between the spliced invoice and the target invoice image; if the similarity exceeds a second similarity threshold, generate frame detection information of verification failure.
[0103] In some embodiments, the seal detection module 205 is also used to determine the target seal quantity, target seal position and target seal shape according to the invoice type; determine whether the seal quantity is the target seal quantity; if the seal quantity is the target seal quantity, determine the offset distance between the seal position and the target seal position; if the offset distance is less than the preset offset distance, determine the similarity between the seal shape and the target seal shape; if the similarity is greater than a third similarity threshold, generate seal detection information of successful verification.
[0104] In some embodiments, the seal detection module 205 is further used to obtain keyword information and determine whether the seal text content includes the keyword information; if the seal text content includes the keyword information, then generate seal detection information indicating verification failure.
[0105] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0106] The method and apparatus of the present application can be used in many general or special computing system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer terminal devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices.
[0107] Exemplarily, the above method and apparatus may be implemented in the form of a computer program. The computer program may be implemented in the form of a computer program. Figure 4 Runs on the computer device shown.
[0108] See also Figure 4 , Figure 4 1 is a schematic diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.
[0109] like Figure 4 As shown, the computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a volatile storage medium, a non-volatile storage medium and an internal memory.
[0110] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any invoice detection method.
[0111] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0112] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any invoice detection method.
[0113] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art can understand that the structure of the computer device 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.
[0114] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0115] Wherein, in some embodiments, the processor is used to run a computer program stored in a memory to implement the following steps: obtaining an invoice image, performing image correction processing on the invoice image to obtain a target invoice image; performing feature extraction on the target invoice image to obtain invoice information, wherein the invoice information includes invoice text information and invoice seal information; classifying the invoice according to the invoice text information to obtain an invoice type; obtaining historical invoices corresponding to the invoice type, detecting the target invoice image according to the invoice text information and the historical invoices to obtain frame detection information; detecting the invoice seal information according to the invoice type to obtain seal detection information; and generating a detection result of the invoice according to the frame detection information and the seal detection information.
[0116] In some embodiments, the processor is further used to detect the invoice image based on a bill body detection model to obtain a mask corresponding to the invoice body area; and perform deformation correction on the invoice according to the mask corresponding to the invoice body area to obtain a target invoice image.
[0117] In some embodiments, the processor is also used to obtain image features of the historical invoice image and the target invoice image; determine the similarity between the target invoice image and the historical invoice image based on the image features; if the similarity exceeds a first similarity threshold, generate risk warning information for the invoice.
[0118] In some embodiments, the processor is further used to perform text extraction processing on the target invoice image to obtain invoice text information, wherein the invoice text information includes the invoice header and the invoice content; and perform seal recognition processing on the target invoice image to obtain invoice seal information, wherein the invoice seal information includes the number of seals, seal positions, seal shapes and seal text content.
[0119] In some embodiments, the processor is further used to extract layout feature information from the historical invoice; splice the invoice text information with the layout feature information to obtain a spliced invoice; determine the similarity between the spliced invoice and the target invoice image; if the similarity exceeds a second similarity threshold, generate verification failed framework detection information.
[0120] In some embodiments, the processor is also used to determine the target seal quantity, target seal position and target seal shape according to the invoice type; determine whether the seal quantity is the target seal quantity; if the seal quantity is the target seal quantity, determine the offset distance between the seal position and the target seal position; if the offset distance is less than the preset offset distance, determine the similarity between the seal shape and the target seal shape; if the similarity is greater than a third similarity threshold, generate seal detection information of successful verification.
[0121] In some implementations, the processor is further configured to obtain keyword information and determine whether the seal text content includes the keyword information; if the seal text content includes the keyword information, then generate seal detection information indicating verification failure.
[0122] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions, and when the program instructions are executed, any one of the invoice detection methods provided in the embodiments of the present application is implemented.
[0123] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0124] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0125] The present invention refers to a new application model of computer technologies such as storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. of the blockchain language model. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.
[0126] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for detecting invoices, It is characterized in that The method comprises: Acquire an invoice image, and perform image correction processing on the invoice image to obtain a target invoice image; Extracting features of the target invoice image to obtain invoice information, wherein the invoice information includes invoice text information and invoice seal information; Classify the invoice according to the invoice text information to obtain the invoice type; Obtaining historical invoices corresponding to the invoice type, detecting the target invoice image according to the invoice text information and the historical invoices, and obtaining frame detection information; Detect the invoice seal information according to the invoice type to obtain seal detection information; The detection result of the invoice is generated according to the frame detection information and the seal detection information.
2. The method according to claim 1, It is characterized in that The performing image correction processing on the invoice image to obtain a target invoice image includes: Based on the bill body detection model, the invoice image is detected to obtain a mask corresponding to the invoice body area; The invoice is deformed and corrected according to the mask corresponding to the invoice body area to obtain a target invoice image.
3. The method according to claim 1, It is characterized in that After performing image correction processing on the invoice image to obtain the target invoice image, the method further includes: Acquire image features of the historical invoice image and the target invoice image; Determining the similarity between the target invoice image and the historical invoice image according to the image features; If the similarity exceeds a first similarity threshold, risk warning information of the invoice is generated.
4. The method according to claim 1, It is characterized in that The step of extracting features from the target invoice image to obtain invoice information includes: Performing text extraction processing on the target invoice image to obtain invoice text information, wherein the invoice text information includes the invoice title and invoice content; The target invoice image is subjected to seal recognition processing to obtain invoice seal information, wherein the invoice seal information includes the number of seals, seal positions, seal shapes and seal text contents.
5. The method according to claim 1, It is characterized in that The detecting the target invoice image according to the invoice text information and the historical invoice to obtain frame detection information includes: Extracting layout feature information from the historical invoices; Splicing the invoice text information with the layout feature information to obtain a spliced invoice; Determining the similarity between the spliced invoice and the target invoice image; If the similarity exceeds a second similarity threshold, framework detection information indicating verification failure is generated.
6. The method according to claim 1, It is characterized in that The invoice seal information includes the number of seals, the position of the seals and the shape of the seals. The invoice seal information is detected according to the invoice type to obtain the seal detection information, including: Determine the target seal quantity, target seal position and target seal shape according to the invoice type; Determine whether the number of seals is the target number of seals; If the seal quantity is the target seal quantity, determining the offset distance between the seal position and the target seal position; If the offset distance is less than the preset offset distance, determining the similarity between the seal shape and the target seal shape; If the similarity is greater than a third similarity threshold, seal detection information indicating successful verification is generated.
7. The method according to claim 1, It is characterized in that The invoice seal information also includes seal text content. The invoice seal information is detected according to the invoice type to obtain seal detection information, including: Acquire keyword information and determine whether the seal text content includes the keyword information; If the seal text content includes the keyword information, seal detection information indicating verification failure is generated.
8. An invoice detection device, It is characterized in that The invoice detection device comprises: An image processing module is used to obtain an invoice image, and perform image correction processing on the invoice image to obtain a target invoice image; A feature extraction module, used to extract features from the target invoice image to obtain invoice information, wherein the invoice information includes invoice text information and invoice seal information; An invoice classification module, used to classify the invoice according to the invoice text information to obtain the invoice type; A frame detection module, used to obtain historical invoices corresponding to the invoice type, detect the target invoice image according to the invoice text information and the historical invoices, and obtain frame detection information; A seal detection module, used to detect the invoice seal information according to the invoice type to obtain seal detection information; A risk assessment module is used to generate a detection result of the invoice according to the frame detection information and the seal detection information.
9. A computer device, It is characterized in that The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and implement, when executing the computer program: An invoice detection method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the invoice detection method according to any one of claims 1 to 7.
