A bill identification method, device and equipment
By combining the cutting of the bill image and optical character recognition technology, matching the key fields in the feature information set, the problem of difficult to efficiently classify bills in the prior art is solved, and fast and low-cost bill recognition and classification are achieved.
Patent Information
- Application Number
- CN202110591829.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-28
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2041-05-28
AI Technical Summary
The prior art is difficult to efficiently classify bills with close layouts, resulting in the inability to effectively respond to business needs.
By cutting the target image, extracting the image of the target area, identifying the image of the target area using optical character recognition technology, obtaining the target recognition information set, and matching the key fields in the feature information set with the fields in the target recognition information set to determine the ticket type.
It achieves rapid response to business needs, short development cycle and low cost, can effectively distinguish bill types, improve identification efficiency, and reduce data processing volume.
Smart Images

Figure CN113269101B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of artificial intelligence technology, and in particular to a bill recognition method, device and equipment. Background Art
[0002] The current electronic financial reimbursement system requires unified electronic image scanning and entry of financial reimbursement bills within the company or organization, as well as external financial reimbursement bills such as value-added tax invoices and train tickets, and then the various structured data in the bills are entered. In the process of unified collection of paper bills, there are often cases where various paper bills are not classified and need to be batch-entered with structured data. This requires the classification of batch-entered electronic images of bills and automated bill information entry.
[0003] In the prior art, computer vision algorithms such as convolutional neural networks and other artificial intelligence neural networks are usually used to classify images. Such methods require the collection of a large amount of training data, have a high development cycle and cost, and are difficult to effectively distinguish bills with very similar formats. It can be seen that the technical solutions in the prior art cannot efficiently respond to business needs to classify bills.
[0004] To address the above problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of this specification provide a bill identification method, device and equipment to solve the problem in the prior art that it is impossible to efficiently respond to business needs to classify bills.
[0006] The embodiments of the present specification provide a bill recognition method, comprising: cutting a target image to obtain an image of a target area in the target image; wherein the target area is the portion of the overall target image area that records a title; using optical character recognition technology to recognize the image of the target area to obtain a target recognition information set; wherein the target recognition information set contains at least one recognized field; matching each key field in a feature information set with a field in the target recognition information set to obtain a matching result; wherein the feature information set contains multiple groups of data, each group of data containing a key field of a title and a corresponding bill type; and determining the bill type corresponding to the target image according to the matching result.
[0007] The embodiments of the present specification also provide a bill recognition device, including: a cutting module, used to cut a target image to obtain an image of a target area in the target image; wherein the target area is the part of the overall area of the target image that records the title; an identification module, used to use optical character recognition technology to identify the image of the target area to obtain a target identification information set; wherein the target identification information set contains at least one field obtained by identification; a matching module, used to match each key field in a feature information set with a field in the target identification information set to obtain a matching result; wherein the feature information set contains multiple groups of data, each group of data contains a key field of the title and a corresponding bill type; a determination module, used to determine the bill type corresponding to the target image according to the matching result.
[0008] The embodiment of the present specification also provides a bill recognition device, including a processor and a memory for storing processor executable instructions, and the processor implements the steps of the bill recognition method described in the embodiment of the present specification when executing the instructions.
[0009] The embodiments of the present specification also provide a computer-readable storage medium on which computer instructions are stored. When the instructions are executed, the steps of the bill identification method described in the embodiments of the present specification are implemented.
[0010] The embodiment of this specification provides a bill recognition method, which can obtain an image of a target area in the target image by cutting the target image, wherein the target area can be the part of the target image as a whole that records the title. The fields contained in the image of the target area can be recognized by optical character recognition technology to obtain a target recognition information set. Further, each key field in the feature information set can be matched with the field in the target recognition information set to obtain a matching result; wherein the feature information set records the correspondence between the key field of the title and the bill type. Since the feature information set records the association between the key field and the bill type, after obtaining the matching result, the bill type corresponding to the target image can be determined according to the matching result. The bills can be classified in advance, and the correspondence between the key field used for matching and the bill type can be recorded in the feature information set to add the requirements of the newly added support type, without collecting data to retrain the model, with a short development cycle and low cost, and can quickly respond to business needs. And it can only be recognized for a part of the area in the target image, which effectively improves the efficiency of recognition and reduces the amount of data processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings described herein are used to provide a further understanding of the embodiments of this specification, constitute a part of the embodiments of this specification, and do not constitute a limitation of the embodiments of this specification. In the drawings:
[0012] Figure 1 It is a schematic diagram of the steps of the bill recognition method provided in the embodiment of this specification;
[0013] FIG. 2( a ) is a schematic diagram of a basic type of note provided according to an embodiment of the present specification;
[0014] FIG. 2( b ) is a schematic diagram of a double-line header type note provided according to an embodiment of the present specification;
[0015] FIG2( c ) is a schematic diagram of a C1 type note provided according to an embodiment of this specification;
[0016] FIG2( d ) is a schematic diagram of a C2 type note provided according to an embodiment of the present specification;
[0017] Figure 3 is a schematic diagram of the structure of a bill recognition device provided according to an embodiment of this specification;
[0018] Figure 4 It is a structural schematic diagram of a bill recognition device provided according to an embodiment of this specification. DETAILED DESCRIPTION
[0019] The principles and spirit of the embodiments of this specification will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the embodiments of this specification, and are not intended to limit the scope of the embodiments of this specification in any way. On the contrary, these embodiments are provided to make the disclosure of the embodiments of this specification more thorough and complete, and to fully convey the scope of the disclosure to those skilled in the art.
[0020] Those skilled in the art know that the implementation of the embodiments of this specification can be implemented as a system, device, method or computer program product. Therefore, the embodiments disclosed in this specification can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0021] Although the processes described below include multiple operations that occur in a particular order, it should be clear that these processes may include more or fewer operations, which may be performed sequentially or in parallel (eg, using parallel processors or a multi-threaded environment).
[0022] See also Figure 1 This embodiment can provide a bill recognition method. The bill recognition method can be used to efficiently identify the bill type corresponding to the target image. The bill recognition method can include the following steps.
[0023] S101: cutting a target image to obtain an image of a target area in the target image; wherein the target area is a portion of the entire target image where a title is recorded.
[0024] In this embodiment, since the key information for distinguishing the bill type usually only occupies a part of the entire image, the target image can be cut first to obtain an image of the target area in the target image, wherein the target area can be the part of the entire target image where the title is recorded.
[0025] In this embodiment, the electronic image of the target paper bill can be obtained by using an image scanning system to obtain a target image. The target image can be an electronic image of the target paper bill of the bill type to be confirmed, or an overall electronic image of the target paper bill.
[0026] In this embodiment, the target area can be determined by analyzing the position of the title in different types of bills. Preferably, the target area can be an area with a height of more than 30% in the bill. Of course, the method of setting the target area is not limited to the above examples. Under the inspiration of the technical essence of the embodiments of this specification, technicians in the relevant field may make other changes, but as long as the functions and effects achieved are the same or similar to those of the embodiments of this specification, they should be covered within the protection scope of the embodiments of this specification.
[0027] In this embodiment, when the bill preferably does not use the title to determine the category, the target area may also be an area where other key information is located, which may be determined based on actual conditions and is not limited in this embodiment of the specification.
[0028] In some embodiments, bills can be divided into 6 types: basic type (A) matching key field is the main title of the bill, and it is a line of text, as shown in Figure 2 (a); double-line title type (B) matching key field is the main title of the bill, but the field is divided into two lines, as shown in Figure 2 (b); C1 type bills contain main titles and subtitles, where the main titles are consistent and the subtitles are different, and the subtitles are distinguished by subtitles, as shown in Figure 2 (c); C2 type bills contain main titles and subtitles, where the main titles and subtitles are completely consistent, only the layout and key fields are different, and other key fields are distinguished by subclassification, as shown in Figure 2 (d); untitled type (D) bill content has no title text, but there are fixed fields in relatively fixed positions that can match the key, such as train tickets, plane tickets, etc.; other types (Z) are not yet supported bill types. In this embodiment, the bills can be classified in advance to determine the key fields for matching to add the requirements of newly supported types, without collecting data to retrain the model, with a short development cycle and low cost, and can quickly respond to business needs.
[0029] S102: Using optical character recognition technology to recognize an image of a target area, and obtaining a target recognition information set; wherein the target recognition information set includes at least one recognized field.
[0030] In this embodiment, the image of the target area can be identified by optical character recognition technology to obtain a target identification information set; wherein the above target identification information set can include at least one field obtained by identification. In some embodiments, the above target identification information set can also be empty. When the target identification information set is empty, it means that the target image is not suitable for identification using the image of the target area or the target image is a missing or erroneous image. At this time, an abnormality can be fed back, or the optical character recognition technology can be used to identify the target image as a whole to determine its type. The specific type can be determined according to the actual situation, and the embodiments of this specification do not limit this.
[0031] In this embodiment, optical character recognition (OCR) refers to the process of scanning text data and then analyzing and processing the image file to obtain text and layout information. Using optical character recognition technology, at least one field contained in the image of the target area can be identified.
[0032] S103: Match each key field in the feature information set with the field in the target identification information set to obtain a matching result; wherein the feature information set includes multiple groups of data, each group of data includes the key field of the title and the corresponding bill type.
[0033] In this embodiment, each key field in the feature information set can be matched with the field in the target identification information set to obtain a matching result; wherein the above-mentioned feature information set can contain multiple groups of data, each group of data can contain the key fields of the title and the corresponding bill type.
[0034] In this embodiment, the feature information set may be an association between key fields recorded in various types of bills and bill types, and the data in the feature information set may be used as module data for matching. Each key field in the feature information set may be matched with a field in the target identification information set to determine whether the key field recorded in the feature information set exists in the target identification information set, thereby obtaining a matching result.
[0035] In this embodiment, the above matching result can be used to indicate whether the match is successful. If the match is successful, the above matching result can also include specific fields that match the feature information set and the target identification information set. Of course, it can be understood that the above matching result can also include other information, such as: matching degree, etc. The specific information can be determined according to the actual situation, and the embodiments of this specification are not limited to this.
[0036] S104: Determine the bill type corresponding to the target image according to the matching result.
[0037] In this embodiment, since the characteristic information set records the association between the key field and the bill type, after obtaining the matching result, the bill type corresponding to the target image can be determined according to the matching result. In the case of a successful match, the bill type corresponding to the key field matched in the characteristic information set can be used as the bill type corresponding to the target image; in the case of a failed match, it can be determined that the bill type corresponding to the target image is another type, and optical character recognition can be used to perform full text recognition on the target image to further confirm the bill type, or it can be transferred to manual processing. The specific determination can be based on actual conditions, and this specification embodiment does not limit this.
[0038] From the above description, it can be seen that the embodiment of this specification achieves the following technical effects: the image of the target area in the target image can be obtained by cutting the target image, wherein the target area can be the part of the target image as a whole that records the title. The fields contained in the image of the target area can be identified by optical character recognition technology to obtain a target identification information set. Further, each key field in the feature information set can be matched with the field in the target identification information set to obtain a matching result; wherein the feature information set records the corresponding relationship between the key field of the title and the bill type. Since the feature information set records the association relationship between the key field and the bill type, after obtaining the matching result, the bill type corresponding to the target image can be determined according to the matching result. The bills can be classified in advance, and the corresponding relationship between the key field used for matching and the bill type can be recorded in the feature information set to add the requirements of the newly added support type, without collecting data to retrain the model, with a short development cycle and low cost, and can quickly respond to business needs. And only part of the area in the target image can be identified, which effectively improves the efficiency of identification and reduces the amount of data processing.
[0039] In one embodiment, using optical character recognition technology to identify the image of the target area to obtain a target identification information set may include: using optical character recognition technology to identify the image of the target area to obtain a first identification information set; wherein the first identification information set may contain at least one field obtained by identification. According to the coordinates of each field in the first identification information set, the order of each field in the target image may be determined. Furthermore, based on the order of each field in the target image, the fields may be sorted in descending order to obtain a second identification information set, and the second identification information set may be used as the target identification information set.
[0040] In this embodiment, since the image of the target area may be recognized by using optical character recognition technology to obtain multiple fields, in order to make the field of the title recorded at the front of the target recognition information set as much as possible, so that the field of the title can be matched first during matching, thereby improving the matching efficiency. Therefore, the recognized fields can be sorted.
[0041] In this embodiment, the coordinates of each field in the first identification information set can be obtained, so that the order of each field in the target image and the left-right order can be determined according to the coordinates of each field. The fields can be sorted by row based on the order of each field in the target image to obtain the target identification information set.
[0042] In one embodiment, the feature information set may also include coordinates corresponding to each key field, and matching each key field in the feature information set with the field in the target identification information set to obtain a matching result may include: determining the matching degree between each primary key field in the feature information set and each field in the target identification information set based on an edit distance algorithm. In the case where it is determined that the matching degree between a target primary key field and a first target field in the target identification information set is greater than or equal to a first preset threshold, the coordinates of the first target field may be determined. And based on the coordinates of the target primary key field and the coordinates of the first target field, the coordinate matching degree is determined. In the case where the coordinate matching degree is greater than or equal to a second preset threshold, it may be determined whether the target primary key field has an associated target secondary key field. In the case where it is determined that it does not exist, it may be determined that the target primary key field successfully matches the first target field.
[0043] In this embodiment, the key fields can be graded in the feature information set. For example, in FIG. 2(d), the main title can be a primary key field, the subtitle can be a secondary key field, and other key fields can be tertiary key fields. Of course, it can be understood that more or fewer levels can be included, which can be determined according to the structure of the bill, and this specification embodiment does not limit this.
[0044] In this embodiment, the first-level key fields can be matched preferentially. The above-mentioned edit distance (EditDistance) refers to the minimum number of editing operations required to convert one string into another. Permitted editing operations include replacing one character with another, inserting a character, and deleting a character. Generally speaking, the smaller the edit distance, the greater the similarity between the two strings. Therefore, the matching degree of each first-level key field in the feature information set and each field in the target identification information set can be determined based on the edit distance algorithm. The smaller the edit distance, the higher the corresponding matching degree.
[0045] In this embodiment, the first preset threshold value can be determined according to the bill type. For example, some bill titles may contain place names (e.g., Shanghai VAT special invoices, Beijing taxi special invoices, etc.). Therefore, an error of 1-2 characters can be allowed. In some cases, a recognition error of one character can also be allowed. At this time, the first preset threshold value can be set to 0.9, 0.88, etc. Some bill titles are relatively short and there are no qualifiers in the titles. In order to make the recognition result accurate, the first preset threshold value can be set to 1, 0.99. The specific value can be determined according to the actual situation, and the embodiments of this specification do not limit this.
[0046] In this embodiment, when the key field matches successfully, in order to ensure the accuracy of the matching result, the coordinates can be matched. Since the key fields specific to the same type of bills are usually in a fixed position, the coordinate matching degree can be determined based on the coordinates of the target primary key field and the coordinates of the first target field.
[0047] In this embodiment, the above coordinates may be the coordinates of each character in the field, or the coordinates of the geometric center point of the field, which may be determined according to actual conditions, and are not limited in this embodiment of the specification.
[0048] In this embodiment, the circumscribed matrix of the target primary key field can be determined according to the coordinates of the target primary key field and the number of characters of the target primary key field, and the circumscribed matrix of the first target field can be determined according to the coordinates of the first target field and the number of characters of the first target field. Further, the overlap between the circumscribed matrix of the target primary key field and the circumscribed matrix of the first target field can be calculated, and the overlap can be used as the coordinate matching degree. The higher the overlap, the higher the coordinate matching degree. In some embodiments, the coordinate matching degree can also be determined according to the distance between the coordinates of the target primary key field and the coordinates of the first target field. The shorter the distance, the higher the coordinate matching degree. Of course, the method for determining the coordinate matching degree is not limited to the above examples. Under the inspiration of the technical essence of the embodiments of this specification, the technicians in the relevant field may also make other changes, but as long as the functions and effects achieved are the same or similar to the embodiments of this specification, they should be covered within the protection scope of the embodiments of this specification.
[0049] In this embodiment, when the coordinate matching degree is greater than or equal to the second preset threshold, it means that the coordinates of the target primary key field and the first target field are matched. At this time, it can be determined whether the target primary key field has an associated target secondary key field. If it does not exist, it means that the bill type can be uniquely determined based on the matching result of the primary key field, thereby obtaining a matching result. If it exists, it means that a secondary matching is still required, and the bill type cannot be determined at this time.
[0050] In this embodiment, the second preset threshold may be a value greater than 0, such as 0.05, 0.12, etc. The specific value may be determined according to actual accuracy requirements, and the embodiments of this specification do not limit this.
[0051] In one embodiment, determining the bill type corresponding to the target image according to the matching result may include: determining the bill type corresponding to the target first-level key field based on the feature information set; and using the bill type corresponding to the target first-level key field as the bill type corresponding to the target image.
[0052] In this embodiment, since the characteristic information concentrates on recording the association between the key field and the bill type, after obtaining the matching result, the bill type corresponding to the target image can be determined according to the matching result. In the case of a successful match, the bill type corresponding to the target primary key field can be used as the bill type corresponding to the target image; in the case of a failed match, it can be determined that the bill type corresponding to the target image is another type, and optical character recognition can be used to perform full text recognition on the target image to further confirm the bill type, or it can be transferred to manual processing. The specific determination can be based on actual conditions, and this specification embodiment does not limit this.
[0053] In one embodiment, after determining the matching degree of each primary key field in the feature information set with each field in the target identification information set based on the edit distance algorithm, the method may further include: determining the distance from the circumscribed matrix of each field in the target identification information set to the origin when it is determined that there is no target primary key field with a matching degree greater than or equal to the first preset threshold value with the first target field in the target identification information set. Two fields whose distance difference is less than or equal to the third preset threshold value may be spliced in descending order to obtain the preprocessed target identification information set. And based on the edit distance algorithm, determining the matching degree of each primary key field in the feature information set with each field in the preprocessed target identification information set. When it is determined that there is a target primary key field with a matching degree greater than or equal to the second preset threshold value with the second target field in the preprocessed target identification information set, the coordinates of the second target field may be determined. And according to the coordinates of the target primary key field and the coordinates of the second target field, the coordinate matching degree is determined. Further, when the coordinate matching degree is greater than or equal to the second preset threshold value, it may be determined whether the target primary key field has an associated target secondary key field. In the case where it is determined that it does not exist, it is determined that the target primary key field matches the second target field successfully.
[0054] In this embodiment, when it is determined that there is no target primary key field whose matching degree with the first target field in the target identification information set is greater than or equal to the first preset threshold, it indicates that there may be a situation as shown in FIG2(b). It may be due to line breakage that the match cannot be successful. At this time, the sorting algorithm can be used to splice the two fields of the line break to obtain a preprocessed target identification information set, and then match again based on the preprocessed target identification information set.
[0055] In this embodiment, the distance from the circumscribed matrix of each field in the target identification information set to the origin can be determined, and two fields whose distance difference is less than or equal to the third preset threshold are spliced in descending order, so as to splice the two fields of the broken lines to obtain the preprocessed target identification information set. Among them, the above-mentioned origin can be the upper left corner position of the target image. Of course, it can be understood that it can also be any other position and can be determined according to actual conditions, and this embodiment of the specification does not limit this.
[0056] In this embodiment, the first-level key fields can be matched preferentially. The above-mentioned edit distance (EditDistance) refers to the minimum number of editing operations required to convert one string into another. Permitted editing operations include replacing one character with another, inserting a character, and deleting a character. Generally speaking, the smaller the edit distance, the greater the similarity between the two strings. Therefore, the matching degree of each first-level key field in the feature information set and each field in the preprocessed target recognition information set can be determined based on the edit distance algorithm. The smaller the edit distance, the higher the corresponding matching degree.
[0057] In this embodiment, when the key field matches successfully, in order to ensure the accuracy of the matching result, the coordinates can be matched. Since the key fields specific to the same type of bills are usually in a fixed position, the coordinate matching degree can be determined based on the coordinates of the target first-level key field and the coordinates of the second target field. The above coordinates can be the coordinates of each character in the field, or the coordinates of the geometric center point of the field. The specific coordinates can be determined according to the actual situation, and the embodiments of this specification do not limit this.
[0058] In this embodiment, the circumscribed matrix of the target primary key field can be determined according to the coordinates of the target primary key field and the number of characters of the target primary key field, and the circumscribed matrix of the second target field can be determined according to the coordinates of the second target field and the number of characters of the second target field. Further, the overlap between the circumscribed matrix of the target primary key field and the circumscribed matrix of the second target field can be calculated, and the overlap can be used as the coordinate matching degree. The higher the overlap, the higher the coordinate matching degree. In some embodiments, the coordinate matching degree can also be determined according to the distance between the coordinates of the target primary key field and the coordinates of the second target field. The shorter the distance, the higher the coordinate matching degree. Of course, the method for determining the coordinate matching degree is not limited to the above examples. Under the inspiration of the technical essence of the embodiments of this specification, the technicians in the relevant field may also make other changes, but as long as the functions and effects achieved are the same or similar to the embodiments of this specification, they should be covered within the protection scope of the embodiments of this specification.
[0059] In this embodiment, when the coordinate matching degree is greater than or equal to the second preset threshold, it means that the coordinates of the target primary key field and the second target field are matched. At this time, it can be determined whether the target primary key field has an associated target secondary key field. If it does not exist, it means that the bill type can be uniquely determined based on the matching result of the primary key field, thereby obtaining a matching result. At this time, the determined bill type can be shown in Figure 2 (a) and Figure 2 (b). If it exists, it means that a secondary match is still required, and the bill type cannot be determined at this time.
[0060] In this embodiment, the second preset threshold may be a value greater than 0, such as 0.05, 0.12, etc. The specific value may be determined according to actual accuracy requirements, and the embodiments of this specification do not limit this.
[0061] In one embodiment, after determining the matching degree between each primary key field in the feature information set and each field in the preprocessed target identification information set, it may also include: when it is determined that there is no target primary key field and the matching degree between the second target field in the preprocessed target identification information set is greater than or equal to a first preset threshold, using optical character recognition technology to perform full text recognition on the target image to obtain a third identification information set. Further, each key field in the feature information set may be matched with each field in the third identification information set to obtain a matching result.
[0062] In this embodiment, when it is determined that there is no target first-level key field and the degree of match between the second target field in the preprocessed target identification information set is greater than or equal to the first preset threshold, it means that the target image may be an untitled type of bill. At this time, optical character recognition technology can be used to perform full-text recognition on the target image to obtain a third identification information set.
[0063] In this embodiment, each key field in the feature information set can be matched with each field in the third identification information set to obtain a matching result. The specific matching method can refer to the above embodiment, and the repeated parts will not be repeated. If the match still fails at this time, it may be other bill types that have not been entered into the feature information set, and it can be transferred to manual processing to improve the feature information set.
[0064] In one embodiment, after determining whether the target primary key field has an associated target secondary key field, the method may further include: if it is determined that there is an associated target primary key field, the matching degree between the target secondary key field associated with the target primary key field and each field in the target identification information set may be determined based on an edit distance algorithm. If it is determined that there is a third target field in the target identification information set and the matching degree between the target secondary key field and the third target field is greater than or equal to a first preset threshold, the coordinates of the third target field may be determined. The coordinate matching degree may be determined based on the coordinates of the target secondary key field and the coordinates of the third target field. If the coordinate matching degree is greater than or equal to a third preset threshold, it is determined whether the target secondary key field has an associated target third key field. If it is determined that there is no associated target third key field, it is determined that the target secondary key field successfully matches the third target field.
[0065] In this embodiment, when it is determined that the target primary key field has an associated target secondary key field, it indicates that the target secondary key field needs to be further matched to determine whether there is a third target field in the target identification information set that matches the target secondary key field.
[0066] In this implementation manner, the field matching and coordinate matching methods can refer to the above embodiments, and the repeated parts will not be repeated.
[0067] In this embodiment, when the coordinates of the target secondary key field and the third target field are successfully matched, it can be further determined whether the target secondary key field has an associated target tertiary key field. If it does not exist, it means that the bill type can be uniquely determined based on the matching result of the secondary key field, thereby obtaining a matching result. At this time, the determined bill type can be shown in Figure 2 (c). If it exists, it means that a third-level match is still required, and the bill type cannot be determined at this time.
[0068] In one embodiment, after determining whether the target secondary key field has an associated target third-level key field, the method may further include: when determining that the target secondary key field has an associated target third-level key field, the target image may be fully recognized using optical character recognition technology to obtain a third identification information set. Further, the target third-level key field may be matched with each field in the third identification information set to obtain a matching result.
[0069] In this embodiment, when it is determined that the target secondary key field has an associated target third-level key field, it means that the target image may be of the type shown in FIG. 2( d ). Since the third-level key field is usually not in the title area but in the content part, the target image can be fully recognized using optical character recognition technology to obtain a third recognition information set.
[0070] In this embodiment, each key field in the feature information set can be matched with each field in the third identification information set to obtain a matching result. The specific matching method can refer to the above embodiment, and the repeated parts will not be repeated. If the match still fails at this time, it may be other bill types that have not been entered into the feature information set, and it can be transferred to manual processing to improve the feature information set.
[0071] In one embodiment, after determining the coordinate matching degree, the method may further include: when the coordinate matching degree is less than a second preset threshold, determining a comprehensive matching degree according to the field matching degree and the coordinate matching degree. When the comprehensive matching degree is less than or equal to a fourth preset threshold, determining that the match fails. Further, the target image may be fully recognized using optical character recognition technology to obtain a third identification information set. And each key field in the feature information set is matched with each field in the third identification information set to obtain a matching result.
[0072] In this embodiment, when the field match is successful but the coordinate match fails, the comprehensive matching degree can be further determined based on the field matching degree and the coordinate matching degree to avoid the situation where the original scanned image is distorted or part of the original bill is missing, resulting in errors in the coordinate matching degree calculation.
[0073] In this embodiment, the field matching degree and the coordinate matching degree can be multiplied or added to obtain the comprehensive matching degree. Of course, the calculation method of the comprehensive matching degree is not limited to the above example. The technicians in the relevant field may make other changes under the inspiration of the technical essence of the embodiments of this specification, but as long as the functions and effects achieved are the same or similar to the embodiments of this specification, they should be covered within the protection scope of the embodiments of this specification.
[0074] In this embodiment, when the comprehensive matching degree is greater than the fourth preset threshold, it can be determined that the match is successful. At this time, it can be further confirmed whether there are associated secondary key fields and tertiary key fields according to the above embodiment, and the corresponding bill type can be determined according to the matching result, and the repeated parts will not be repeated.
[0075] In this embodiment, if the comprehensive matching degree is less than or equal to the fourth preset threshold, it is determined that the matching fails, indicating that the target image may be a bill of untitled type. In this case, the optical character recognition technology can be used to perform full text recognition on the target image to obtain a third recognition information set.
[0076] In this embodiment, each key field in the feature information set can be matched with each field in the third identification information set to obtain a matching result. At this time, only the key field of the bill of the untitled type in the feature information set can be used for matching. The specific matching method can refer to the above embodiment, and the repeated parts will not be repeated. If the match still fails at this time, it means that it may be other bill types that have not been entered into the feature information set, and it can be transferred to manual processing to improve the feature information set.
[0077] In the embodiments of this specification, automatic classification of bill images can be achieved, which improves the automation level of the system and reduces manual intervention; for most scenarios where the bill types are A, B, and C1, the image is sliced, which effectively reduces the computational complexity of optical character recognition and improves the efficiency of classification; the development and implementation cycle is short, the cost is low, the demand for newly supported bills can be responded to quickly, and the scalability is strong; the bill text information, font size information, and text position information are comprehensively utilized, and it has strong robustness and accuracy; overall, a good balance is achieved in accuracy, speed, and robustness, and the solution implementation and system maintenance are simpler and more practical.
[0078] Based on the same inventive concept, a bill identification device is also provided in the embodiments of this specification, as described in the following embodiments. Since the principle of solving the problem by the bill identification device is similar to that of the bill identification method, the implementation of the bill identification device can refer to the implementation of the bill identification method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived. Figure 3 is a structural block diagram of a bill recognition device according to an embodiment of this specification. Figure 3 As shown, it may include: a cutting module 301, a recognition module 302, a matching module 303, and a determination module 304. The structure is described below.
[0079] The cutting module 301 can be used to cut the target image to obtain an image of a target area in the target image; wherein the target area is a portion of the target image as a whole area where the title is recorded;
[0080] The recognition module 302 may be used to recognize the image of the target area using optical character recognition technology to obtain a target recognition information set; wherein the target recognition information set includes at least one recognized field;
[0081] The matching module 303 can be used to match each key field in the feature information set with the field in the target identification information set to obtain a matching result; wherein the feature information set includes multiple groups of data, each group of data includes the key field of the title and the corresponding bill type;
[0082] The determination module 304 may be configured to determine the bill type corresponding to the target image according to the matching result.
[0083] The embodiment of this specification also provides an electronic device, which can be specifically referred to in Figure 4The electronic device composition structure diagram of the bill recognition method provided by the embodiment of this specification is shown, and the electronic device may specifically include an input device 41, a processor 42, and a memory 43. Among them, the input device 41 can be specifically used to input a target image. The processor 42 can be specifically used to cut the target image to obtain an image of a target area in the target image; wherein the target area is the part of the overall area of the target image where the title is recorded; the image of the target area is recognized by optical character recognition technology to obtain a target recognition information set; wherein the target recognition information set contains at least one recognized field; each key field in the feature information set is matched with a field in the target recognition information set to obtain a matching result; wherein the feature information set contains multiple groups of data, each group of data contains a key field of the title and a corresponding bill type; the bill type corresponding to the target image is determined according to the matching result. The memory 43 can be specifically used to store parameters such as the bill type corresponding to the target image.
[0084] In this embodiment, the input device may specifically be one of the main devices for information exchange between the user and the computer system. The input device may include a keyboard, a mouse, a camera, a scanner, a light pen, a handwriting input board, a voice input device, etc.; the input device is used to input the original data and the program for processing these numbers into the computer. The input device can also obtain and receive data transmitted from other modules, units, and devices. The processor can be implemented in any appropriate manner. For example, the processor can take the form of a computer-readable medium, a logic gate, a switch, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable logic controller, and an embedded microcontroller, etc., such as a microprocessor or a processor and a computer-readable program code (such as software or firmware) that can be executed by the (micro) processor. The memory may specifically be a memory device used to store information in modern information technology. The memory may include multiple levels. In a digital system, anything that can store binary data can be a memory; in an integrated circuit, a circuit with a storage function without a physical form is also called a memory, such as a RAM, a FIFO, etc.; in a system, a storage device with a physical form is also called a memory, such as a memory stick, a TF card, etc.
[0085] In this embodiment, the functions and effects specifically realized by the electronic device can be explained in comparison with other embodiments and will not be described in detail here.
[0086] In the implementation manner of the embodiments of this specification, a computer storage medium based on the bill recognition method is also provided, and the computer storage medium stores computer program instructions, which can achieve the following when executed: cutting the target image to obtain an image of the target area in the target image; wherein the target area is the part of the overall area of the target image that records the title; using optical character recognition technology to recognize the image of the target area to obtain a target recognition information set; wherein the target recognition information set contains at least one recognized field; matching each key field in the feature information set with the field in the target recognition information set to obtain a matching result; wherein the feature information set contains multiple groups of data, each group of data contains the key fields of the title and the corresponding bill type; determining the bill type corresponding to the target image according to the matching result.
[0087] In this embodiment, the storage medium includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a cache, a hard disk (HDD), or a memory card. The memory may be used to store computer program instructions. The network communication unit may be an interface for network connection communication set in accordance with the standard specified by the communication protocol.
[0088] In this embodiment, the functions and effects specifically implemented by the program instructions stored in the computer storage medium can be explained in comparison with other embodiments and will not be repeated here.
[0089] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of this specification can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of this specification are not limited to any specific combination of hardware and software.
[0090] Although the embodiments of this specification provide method operation steps as described in the above embodiments or flowcharts, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided by the embodiments of this specification. When the device or terminal product of the method described in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or drawings (for example, a parallel processor or a multi-threaded processing environment).
[0091] It should be understood that the above description is for illustration and not for limitation. By reading the above description, many embodiments and many applications beyond the examples provided will be apparent to those skilled in the art. Therefore, the scope of the embodiments of this specification should not be determined with reference to the above description, but should be determined with reference to the full scope of the aforementioned claims and the equivalents possessed by these claims.
[0092] The above is only a preferred embodiment of the embodiment of this specification, and is not intended to limit the embodiment of this specification. For those skilled in the art, the embodiment of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiment of this specification shall be included in the protection scope of the embodiment of this specification.
Claims
1. A bill recognition method, characterized in that: include: Cutting the target image to obtain an image of a target area in the target image; wherein the target area is a portion of the entire target image in which the title is recorded; Recognize the image of the target area using optical character recognition technology to obtain a target recognition information set; wherein the target recognition information set includes at least one recognized field; Matching each key field in the feature information set with the field in the target identification information set to obtain a matching result; wherein the feature information set includes multiple groups of data, each group of data includes the key field of the title and the corresponding bill type; Determining the bill type corresponding to the target image according to the matching result; Among them, the feature information set also includes coordinates corresponding to each key field, and each key field in the feature information set is matched with the field in the target identification information set to obtain a matching result, including: based on the edit distance algorithm, determining the matching degree of each first-level key field in the feature information set with each field in the target identification information set; when it is determined that there is a target first-level key field and the first target field in the target identification information set, the coordinates of the first target field are determined to be greater than or equal to a first preset threshold; according to the coordinates of the target first-level key field and the coordinates of the first target field, the coordinate matching degree is determined; when the coordinate matching degree is greater than or equal to a second preset threshold, determining whether the target first-level key field has an associated target second-level key field; when it is determined that there is no associated target second-level key field, determining that the target first-level key field successfully matches the first target field.
2. The method according to claim 1, characterized in that The image of the target area is recognized by using optical character recognition technology to obtain a target recognition information set, including: Recognize the image of the target area using optical character recognition technology to obtain a first identification information set; wherein the first identification information set includes at least one field obtained by recognition; Determine the order of the fields in the target image according to the coordinates of the fields in the first identification information set; Based on the order of the fields in the target image, sort the fields in descending order to obtain a second identification information set; The second identification information set is used as a target identification information set.
3. The method according to claim 1, characterized in that Determining the bill type corresponding to the target image according to the matching result includes: Based on the feature information set, determining the bill type corresponding to the target primary key field; The bill type corresponding to the target primary key field is used as the bill type corresponding to the target image.
4. The method according to claim 1, characterized in that: After determining the matching degree between each primary key field in the feature information set and each field in the target identification information set based on the edit distance algorithm, the method further includes: In the case where it is determined that there is no target primary key field and the first target field in the target identification information set has a matching degree greater than or equal to a first preset threshold, determining the distance from the circumscribed matrix of each field in the target identification information set to the origin; The two fields whose distance difference is less than or equal to the third preset threshold are concatenated in descending order to obtain a preprocessed target recognition information set; Based on the edit distance algorithm, determining the matching degree between each primary key field in the feature information set and each field in the preprocessed target recognition information set; In the case where it is determined that the matching degree between the target primary key field and the second target field in the preprocessed target identification information set is greater than or equal to a second preset threshold, determining the coordinates of the second target field; Determining a coordinate matching degree according to the coordinates of the target primary key field and the coordinates of the second target field; When the coordinate matching degree is greater than or equal to a second preset threshold, determining whether the target primary key field has an associated target secondary key field; In the case where it is determined that it does not exist, it is determined that the target primary key field matches the second target field successfully.
5. The method according to claim 4, characterized in that After determining the matching degree between each primary key field in the feature information set and each field in the preprocessed target identification information set, the method further includes: When it is determined that there is no target primary key field and the matching degree of the second target field in the preprocessed target identification information set is greater than or equal to the first preset threshold, the target image is fully identified by using optical character recognition technology to obtain a third identification information set; Each key field in the feature information set is matched with each field in the third identification information set to obtain a matching result.
6. The method according to claim 1, characterized in that After determining whether the target primary key field has an associated target secondary key field, the method further includes: If it is determined that the target secondary key field exists, determining the matching degree between the target secondary key field associated with the target primary key field and each field in the target identification information set based on the edit distance algorithm; In the case where it is determined that there is a third target field in the target identification information set and the matching degree between the third target field and the target secondary key field is greater than or equal to a first preset threshold, determining the coordinates of the third target field; Determining a coordinate matching degree according to the coordinates of the target secondary key field and the coordinates of the third target field; When the coordinate matching degree is greater than or equal to a third preset threshold, determining whether the target secondary key field has an associated target third key field; In the case where it is determined that it does not exist, it is determined that the target secondary key field matches the third target field successfully.
7. The method according to claim 6, characterized in that After determining whether the target secondary key field has an associated target third-level key field, the method further includes: In the case where it is determined that the target secondary key field has an associated target third-level key field, the target image is fully recognized using optical character recognition technology to obtain a third recognition information set; The target third-level key field is matched with each field in the third identification information set to obtain a matching result.
8. The method according to claim 1, 4 or 6, characterized in that: After determining the coordinate matching degree, it also includes: When the coordinate matching degree is less than a second preset threshold, determining a comprehensive matching degree according to the field matching degree and the coordinate matching degree; When the comprehensive matching degree is less than or equal to a fourth preset threshold, determining that the matching fails; Performing full text recognition on the target image using optical character recognition technology to obtain a third recognition information set; The key fields in the feature information set are matched with the fields in the third identification information set to obtain a matching result.
9. A bill recognition device, characterized in that: include: A cutting module, used for cutting the target image to obtain an image of a target area in the target image; wherein the target area is a portion of the target image as a whole area in which the title is recorded; A recognition module, used to recognize the image of the target area by using optical character recognition technology to obtain a target recognition information set; wherein the target recognition information set includes at least one recognized field; A matching module, used to match each key field in the feature information set with the field in the target identification information set to obtain a matching result; wherein the feature information set includes multiple groups of data, each group of data includes the key field of the title and the corresponding bill type; A determination module, used to determine the bill type corresponding to the target image according to the matching result; Among them, the feature information set also includes coordinates corresponding to each key field, and the matching module is specifically used to: determine the matching degree between each first-level key field in the feature information set and each field in the target identification information set based on the edit distance algorithm; determine the coordinates of the first target field in the target identification information set when it is determined that the matching degree between the target first-level key field and the first target field is greater than or equal to a first preset threshold; determine the coordinate matching degree based on the coordinates of the target first-level key field and the coordinates of the first target field; determine whether the target first-level key field has an associated target second-level key field when the coordinate matching degree is greater than or equal to a second preset threshold; if it is determined that there is no associated target second-level key field, determine that the target first-level key field successfully matches the first target field.
10. A bill recognition device, characterized in that: The method comprises a processor and a memory for storing processor-executable instructions, wherein the processor implements the steps of the method according to any one of claims 1 to 8 when executing the instructions.
11. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Bill identification method based on OCR, equipment, storage medium and device
CN111444793A
Insurance policy identification method and device and computer equipment
CN111666868A
Method and device for extracting structured information of text, equipment and medium
CN111753717A