Method and apparatus for determining duplicate bill and electronic device

By clustering invoice images and calculating text content similarity, the problem of low accuracy in invoice image plagiarism detection has been solved, achieving higher accuracy and resource savings.

CN117197832BActive Publication Date: 2026-03-17PICC INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-25
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In existing technologies, the accuracy of duplicate document image detection is low, mainly because the high similarity of document images makes it easy to miss duplicate documents when setting a large preset threshold.

Method used

By clustering the image set of invoices, images of invoices with the same layout are grouped into the same subset, and the text content similarity is extracted. A threshold is set to identify duplicate invoices, and the deduplication is performed by combining image features and text content.

Benefits of technology

It improves the accuracy of duplicate document image detection, saves computing resources, and reduces the computational requirements for all document images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117197832B_ABST
    Figure CN117197832B_ABST
Patent Text Reader

Abstract

The application discloses a kind of repeated bill determination method, determination device and electronic equipment, the determination method includes: obtaining first bill picture set;The bill pictures in the first bill picture set are clustered, and a predetermined number of bill picture subsets are obtained, wherein each bill picture subset includes bill pictures with the same format;Respectively extract the first text content of first bill picture and the second text content of second bill picture, and calculate the similarity between the first text content and the second text content, wherein the first bill picture and the second bill picture are different bill pictures in target bill picture subset, and the target bill picture subset is any bill picture subset in the predetermined number of bill picture subsets;In the case where the similarity between the first text content and the second text content is greater than a predetermined threshold, the first bill picture and the second bill picture are determined as repeated bill pictures.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image plagiarism detection technology, and in particular to a method, device and electronic device for identifying duplicate invoices. Background Technology

[0002] For image deduplication, current methods mainly rely on image similarity algorithms to calculate the similarity between images. If the similarity between two images exceeds a preset threshold, they are considered duplicate images. However, since invoices are usually filled out based on invoice templates, the similarity between invoice images is already quite high. In this case, to achieve image deduplication, a large preset threshold needs to be set, which can easily lead to the omission of duplicate invoice images, resulting in low accuracy in invoice image deduplication. Summary of the Invention

[0003] This application discloses a method, apparatus, and electronic device for identifying duplicate invoices, in order to improve the accuracy of invoice image deduplication.

[0004] To solve the above problems, this application adopts the following technical solution:

[0005] In a first aspect, embodiments of this application disclose a method for determining duplicate invoices, comprising: acquiring a first invoice image set; clustering the invoice images in the first invoice image set to obtain a preset number of invoice image subsets, wherein each of the invoice image subsets includes invoice images with the same layout; extracting first text content from the first invoice image and second text content from the second invoice image, and calculating the similarity between the first text content and the second text content, wherein the first invoice image and the second invoice image are different invoice images in a target invoice image subset, and the target invoice image subset is any invoice image subset in the preset number of invoice image subsets; and determining that the first invoice image and the second invoice image are duplicate invoice images when the similarity between the first text content and the second text content is greater than a preset threshold.

[0006] Secondly, embodiments of this application disclose an apparatus for determining duplicate invoices, comprising: an acquisition module for acquiring a first set of invoice images; a obtaining module for clustering the invoice images in the first set of invoice images to obtain a preset number of invoice image subsets, wherein each of the invoice image subsets includes invoice images with the same layout; a calculation module for extracting first text content from the first invoice image and second text content from the second invoice image, and calculating the similarity between the first text content and the second text content, wherein the first invoice image and the second invoice image are different invoice images in a target invoice image subset, and the target invoice image subset is any invoice image subset in the preset number of invoice image subsets; and a determination module for determining that the first invoice image and the second invoice image are duplicate invoice images when the similarity between the first text content and the second text content is greater than a preset threshold.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0009] This application provides a method for determining duplicate invoices. By acquiring a first set of invoice images, clustering the images within the set, and identifying invoice images with the same layout as belonging to the same subset, a preset number of subsets are obtained. Then, the first text content of the first invoice image and the second text content of the second invoice image within the target subsets are extracted, and the similarity between the first and second text contents is calculated. If the similarity between the first and second text contents is greater than a preset threshold, the first and second invoice images are determined to be duplicate invoice images. Since the method provided in this application combines image features and text content for deduplication, it can improve the accuracy of invoice image deduplication. Furthermore, by using the method provided in this application, invoice images with the same layout are first placed in the same subset, and then text similarity is calculated for the invoice images within that subset, deduplication can be achieved by only calculating the similarity between a given invoice image and other invoice images within its subset. Because it is not necessary to calculate the similarity between the given invoice image and all invoice images in the first set, computational resources are saved. Attached Figure Description

[0010] Figure 1 This is a flowchart illustrating a method for determining duplicate tickets disclosed in an embodiment of this application;

[0011] Figure 2 This is a schematic diagram of the structure of a device for determining duplicate tickets disclosed in an embodiment of this application;

[0012] Figure 3 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. Detailed Implementation

[0013] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0014] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the electrically connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0015] The following description, in conjunction with the accompanying drawings, details the method, apparatus, and electronic device for determining duplicate tickets disclosed in this application, through specific embodiments and application scenarios.

[0016] Figure 1 This is a flowchart illustrating a method for determining duplicate tickets disclosed in an embodiment of this application. Figure 1 As shown, the method includes the following steps:

[0017] S120. Obtain the first set of ticket images.

[0018] The invoice images in this application may include, but are not limited to, medical invoice images, and the first invoice image set may be a set of medical invoice images to be screened for duplicates.

[0019] S140. Cluster the ticket images in the first ticket image set to obtain a preset number of ticket image subsets.

[0020] Each subset of the ticket images includes ticket images with the same layout.

[0021] In this application, after obtaining the first set of ticket images, a clustering algorithm is used to cluster the ticket images in the first set of ticket images. Ticket images with the same layout format are identified as images in the same subset of ticket images, resulting in a preset number of ticket image subsets. The layout of the ticket images in different subsets of ticket images is different. For example, if the ticket image subset A obtained by clustering includes ticket images a1, a2, and a3, and the ticket image subset B includes ticket images b1, b2, b3, and b4, then ticket images a1, a2, and a3 have the same layout, ticket images b1, b2, b3, and b4 have the same layout, and ticket images a1 and b1 have different layouts.

[0022] It should be noted that this application does not specify the exact value of the preset quantity.

[0023] S160. Extract the first text content of the first ticket image and the second text content of the second ticket image respectively, and calculate the similarity between the first text content and the second text content.

[0024] Wherein, the first ticket image and the second ticket image are different ticket images in the target ticket image subset, and the target ticket image subset is any subset of ticket images in a preset number of ticket image subsets.

[0025] In this application, extracting the text content from a receipt image can include: inputting the receipt image into a text recognition model and obtaining the text content corresponding to the receipt image output by the text recognition model. Alternatively, other methods can be used to extract the text content from the receipt image, such as Optical Character Recognition (OCR) technology; this application does not impose specific limitations on this method.

[0026] In one implementation, calculating the similarity between the first text content and the second text content may include: inputting the first text content and the second text content into a target model, obtaining the similarity between the first text content and the second text content output by the target model, wherein the similarity between the first text content and the second text content is used to characterize the degree of similarity between the first text content and the second text content.

[0027] In one implementation, the similarity between the first text content and the second text content can be calculated using a text similarity algorithm. For example, the text similarity algorithm can use edit distance similarity, and the calculation formula is as follows:

[0028]

[0029]

[0030] Where sim(a,b) represents the similarity between the first and second text contents, a represents the first text content string, b represents the second text content string, and L... a L represents the length of the first text content string. b The length of the second text content string is represented by , where i represents the i-th character of the first text content string, j represents the j-th character of the second text content string, i > 0, j > 0, and ed represents the edit distance function. Furthermore, other methods can be used to calculate the similarity between the first and second text content strings, and this application does not specifically limit these methods.

[0031] S180. If the similarity between the first text content and the second text content is greater than a preset threshold, determine that the first ticket image and the second ticket image are duplicate ticket images.

[0032] It should be noted that the preset threshold can be a value set according to actual needs, and this application does not impose specific restrictions on it.

[0033] This application provides a method for determining duplicate invoices. By acquiring a first set of invoice images, clustering the images within the set, and identifying invoice images with the same layout as belonging to the same subset, a preset number of subsets are obtained. Then, the first text content of the first invoice image and the second text content of the second invoice image within the target subsets are extracted, and the similarity between the first and second text contents is calculated. If the similarity between the first and second text contents is greater than a preset threshold, the first and second invoice images are determined to be duplicate invoice images. Since the method provided in this application combines image features and text content for deduplication, it can improve the accuracy of invoice image deduplication. Furthermore, by using the method provided in this application, invoice images with the same layout are first placed in the same subset, and then text similarity is calculated for the invoice images within that subset, deduplication can be achieved by only calculating the similarity between a given invoice image and other invoice images within its subset. Because it is not necessary to calculate the similarity between the given invoice image and all invoice images in the first set, computational resources are saved.

[0034] In this embodiment, the step of clustering the ticket images in the first ticket image set to obtain a preset number of ticket image subsets may include: obtaining the feature vector corresponding to each ticket image in the first ticket image set; and clustering each feature vector to obtain a preset number of ticket image subsets. For example, deep neural network models such as VGG16, ResNet, and UNet can be used to extract the feature vector corresponding to each ticket image in the first ticket image set, and then the K-Means algorithm can be used to cluster each feature vector to obtain a preset number of ticket image subsets.

[0035] When photographing a ticket, the resulting image may include both the ticket itself and the background. Therefore, in one implementation, obtaining a first set of ticket images may include: obtaining a second set of ticket images; for each ticket image in the second set, obtaining the position information of the ticket itself within the image; and, based on the position information, cropping images of the ticket itself from each image to form the first set of ticket images. In other words, by obtaining the position information of the ticket itself within the image, and then cropping images of the ticket itself based on that information, background interference is removed, thereby improving the accuracy of ticket image deduplication. For example, an image segmentation algorithm model can be used to detect text content regions in the ticket image, obtain the border information of the ticket itself, and then determine the position information of the ticket itself within the image.

[0036] In this embodiment, obtaining the first set of ticket images may include: obtaining a third set of ticket images; for each ticket image in the third set of ticket images, obtaining the text region in the ticket image and preprocessing the text region; and forming the first set of ticket images based on the preprocessed ticket images. In this application, preprocessing the text region may include at least one of image correction, image enhancement, and image denoising. For example, an image segmentation algorithm model can be used to detect the text region in the ticket image, then an affine transformation algorithm can be used to correct the text region, a histogram equalization algorithm can be used to enhance the image of the text region, and mean filtering, Gaussian filtering, etc., can be used to denoise the text region, thereby improving the accuracy of ticket image deduplication.

[0037] The method provided in this application for deduplication of invoices involves first obtaining a set of original invoice images to be deduplicated, then preprocessing the images and cropping the main images of the invoices, and then clustering the images in the processed image set to obtain a preset number of subsets. Each subset includes images with the same layout. The first text content of the first image and the second text content of the second image in the target subset are then extracted, and the similarity between the first and second text contents is calculated. If the similarity between the first and second text contents is greater than a preset threshold, the first and second invoice images are determined to be duplicate invoice images, thereby improving the accuracy of invoice image deduplication and saving computational resources.

[0038] The duplicate ticket determination method provided in this application can be executed by a duplicate ticket determination device. This application uses the example of a duplicate ticket determination device executing the duplicate ticket determination method to illustrate the duplicate ticket determination device provided in this application.

[0039] Figure 2 This is a schematic diagram of the structure of a device for determining duplicate tickets disclosed in an embodiment of this application. Figure 2 As shown, the duplicate ticket determination device 200 includes: an acquisition module 210, a obtaining module 220, a calculation module 230, and a determination module 240.

[0040] In this application, the acquisition module 210 is used to acquire a first set of ticket images; the obtaining module 220 is used to cluster the ticket images in the first set of ticket images to obtain a preset number of ticket image subsets, wherein each of the ticket image subsets includes ticket images with the same layout; the calculation module 230 is used to extract the first text content of the first ticket image and the second text content of the second ticket image respectively, and calculate the similarity between the first text content and the second text content, wherein the first ticket image and the second ticket image are different ticket images in the target ticket image subset, and the target ticket image subset is any ticket image subset in the preset number of ticket image subsets; the determining module 240 is used to determine that the first ticket image and the second ticket image are duplicate ticket images when the similarity between the first text content and the second text content is greater than a preset threshold.

[0041] In one implementation, the obtaining module 220 clusters the ticket images in the first ticket image set to obtain a preset number of ticket image subsets, including: obtaining the feature vectors corresponding to each ticket image in the first ticket image set; and clustering each feature vector to obtain a preset number of ticket image subsets.

[0042] In one implementation, the acquisition module 210 acquires a first set of invoice images, including: acquiring a second set of invoice images; for each invoice image in the second set of invoice images, acquiring the position information of the invoice subject in the invoice image; and extracting images of each invoice subject based on the position information to form the first set of invoice images.

[0043] In one implementation, the acquisition module 210 acquires a first set of ticket images, including: acquiring a third set of ticket images; for each ticket image in the third set of ticket images, acquiring the text region in the ticket image and preprocessing the text region; and forming the first set of ticket images based on the preprocessed ticket images.

[0044] The device for determining duplicate tickets provided in this application embodiment can implement the various processes implemented in the method embodiment for determining duplicate tickets. To avoid repetition, it will not be described again here.

[0045] Optionally, such as Figure 3 As shown, this application embodiment also provides an electronic device 300, including a processor 301 and a memory 302. The memory 302 stores a program or instructions that can run on the processor 301. When the program or instructions are executed by the processor 301, they implement the various steps of the above-described method embodiment for determining duplicate tickets and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0046] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0047] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described method for determining duplicate tickets and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0048] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0049] The above embodiments of this application focus on describing the differences between the various embodiments. As long as the different optimization features between the various embodiments are not contradictory, they can be combined to form a better embodiment. For the sake of brevity, they will not be described in detail here.

[0050] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method of determining duplicate tickets, characterized by, The method comprises the following steps: acquiring a first bill picture set; clustering bill pictures in the first bill picture set to obtain a preset number of bill picture subsets, wherein each bill picture subset comprises bill pictures of the same format; extracting first text content of a first bill picture and second text content of a second bill picture, and calculating similarity between the first text content and the second text content, wherein the first bill picture and the second bill picture are different bill pictures in a target bill picture subset, and the target bill picture subset is any one of the preset number of bill picture subsets; determining that the first bill picture and the second bill picture are repeated bill pictures when the similarity between the first text content and the second text content is greater than a preset threshold. The clustering of the bill pictures in the first bill picture set to obtain the preset number of bill picture subsets comprises the following steps: acquiring feature vectors corresponding to bill pictures in the first bill picture set; clustering the feature vectors to obtain the preset number of bill picture subsets.

2. The determination method according to claim 1, characterized in that, The acquiring of the first bill picture set comprises the following steps: acquiring a second bill picture set; for each bill picture in the second bill picture set, acquiring position information of a bill subject in the bill picture; respectively cutting bill subject pictures according to the position information to form the first bill picture set.

3. The determination method according to claim 1, characterized in that, The acquiring of the first bill picture set comprises the following steps: acquiring a third bill picture set; for each bill picture in the third bill picture set, acquiring a text region in the bill picture and preprocessing the text region; forming the first bill picture set according to the preprocessed bill pictures.

4. A duplicate bill determining apparatus characterized by comprising: The method comprises the following steps: an acquiring module is configured to acquire a first bill picture set; a obtaining module is configured to cluster bill pictures in the first bill picture set to obtain a preset number of bill picture subsets, wherein each bill picture subset comprises bill pictures of the same format; a calculating module is configured to extract first text content of a first bill picture and second text content of a second bill picture, and calculate similarity between the first text content and the second text content, wherein the first bill picture and the second bill picture are different bill pictures in a target bill picture subset, and the target bill picture subset is any one of the preset number of bill picture subsets; a determining module is configured to determine that the first bill picture and the second bill picture are repeated bill pictures when the similarity between the first text content and the second text content is greater than a preset threshold. The clustering of the bill pictures in the first bill picture set to obtain the preset number of bill picture subsets by the obtaining module comprises the following steps: acquiring feature vectors corresponding to bill pictures in the first bill picture set; clustering the feature vectors to obtain the preset number of bill picture subsets.

5. The determination apparatus according to claim 4, characterized in that The acquiring of the first bill picture set by the acquiring module comprises the following steps: acquiring a second bill picture set; for each bill picture in the second bill picture set, acquiring position information of a bill subject in the bill picture; respectively cutting bill subject pictures according to the position information to form the first bill picture set. For each bill picture in the second bill picture set, position information of the bill subject in the bill picture is obtained; According to the position information, each bill subject picture is intercepted to form a first bill picture set.

6. The determination apparatus according to claim 4, characterized in that The obtaining module obtains the first bill picture set, including: A third bill picture set is obtained; For each bill picture in the third bill picture set, a text region in the bill picture is obtained, and the text region is preprocessed; According to each bill picture after preprocessing, a first bill picture set is formed.

7. An electronic device, comprising: The processor and the memory are included, the memory stores programs or instructions which can run on the processor, and the programs or instructions are executed by the processor to realize the steps of the repeated bill determination method in any one of claims 1-3.

8. A readable storage medium, characterized by, The programs or instructions are stored on the readable storage medium, and the programs or instructions are executed by the processor to realize the steps of the repeated bill determination method in any one of claims 1-3.

Citation Information

Patent Citations

  • Bill verification method and apparatus

    CN110634223A