CN113469005A - Recognition method of bank receipt, related device and storage medium - Google Patents

Recognition method of bank receipt, related device and storage medium Download PDF

Info

Publication number
CN113469005A
CN113469005A CN202110706242.2A CN202110706242A CN113469005A CN 113469005 A CN113469005 A CN 113469005A CN 202110706242 A CN202110706242 A CN 202110706242A CN 113469005 A CN113469005 A CN 113469005A
Authority
CN
China
Prior art keywords
receipt
payment
text
distance
position information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110706242.2A
Other languages
Chinese (zh)
Inventor
吕海峰
宁可
胡志成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN202110706242.2A priority Critical patent/CN113469005A/en
Publication of CN113469005A publication Critical patent/CN113469005A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • G06F16/316Indexing structures

Abstract

The embodiment of the application discloses a method for identifying a bank receipt, which is used for improving the identification efficiency of the bank receipt. The method in the embodiment of the application comprises the following steps: acquiring a bank receipt image to be identified; identifying the bank receipt image to obtain N text blocks, wherein each text block comprises corresponding text content, index and position information; splicing the N text blocks according to the indexes and the position information of the N text blocks to obtain a target text block; and identifying the target text block by adopting a natural language processing technology to obtain fixed field information and payment and receipt field information, and determining the payment and receipt direction of the payment and receipt field information. By the mode, in the process of identifying the bank receipt image, the identification template does not need to be customized according to different bank receipt formats, the identification method can be suitable for different bank receipt formats, and the identification efficiency of the bank receipt is improved.

Description

Recognition method of bank receipt, related device and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method for identifying a bank receipt, a related device, and a storage medium.
Background
The bank receipt is the original basis for the enterprise to compile the bookkeeping voucher, and the enterprise has corresponding receipt as the evidence when receiving and paying. The contents of the receipt mainly comprise detailed information such as date, serial number, account number, currency and amount, and each item has a receipt record. A large number of bank receipts are processed in the financial management of an enterprise.
In recent years, with the rapid update iteration of mobile devices and the rapid development of mobile internet, OCR has a wider application scene, such as character recognition of bank receipt scanning files. The method and the device can upload pictures to automatically identify key information such as date and account number of the bank receipt in application scenes such as the bank receipt, are convenient for enterprise cashiers to check and input the receipt information, and improve the working efficiency.
The traditional bank receipt OCR recognition method usually depends on the characteristics of a recognized object and needs to perform personalized template customization of the bank receipt. However, the receipt formats of different banks are not uniform, and even the same bank has the problem that the receipt formats are not uniform, so that a large number of bank receipt templates need to be customized. Therefore, each different type of bank receipt needs to adopt a corresponding customized template to be able to identify the text information, and the identification efficiency is low.
Disclosure of Invention
In view of this, the present application provides a method for identifying a bank receipt, which is used to improve the identification efficiency of the bank receipt.
One aspect of the present application provides a method for identifying a bank receipt, including:
acquiring a bank receipt image to be identified;
identifying the bank receipt image to obtain N text blocks, wherein each text block comprises corresponding text content, index and position information;
splicing the N text blocks according to the indexes and the position information of the N text blocks to obtain a target text block;
and identifying the target text block by adopting a natural language processing technology to obtain fixed field information and payment and receipt field information, and determining the payment and receipt direction of the payment and receipt field information.
In a possible implementation manner, after the determining the payment and receipt direction of the payment and receipt field information, the method further includes:
acquiring field information of a payment and receipt direction to be identified in the payment and receipt field information;
acquiring target position information corresponding to the field information of the payment and receipt direction to be identified;
acquiring field information of the recognized payment and receipt direction in the payment and receipt field information;
acquiring first position information corresponding to the collection direction and second position information corresponding to the payment direction in the field information of the identified collection and payment direction;
and processing the target position information, the first position information and the second position information to obtain the payment and receipt directions corresponding to the field information of the payment and receipt directions to be identified.
In a possible implementation manner, the processing the target location information, the first location information, and the second location information to obtain the payment and receipt directions corresponding to the target text includes:
calculating the minimum distance between the target position information and the first position information to obtain a first distance;
calculating the minimum distance between the target position information and the second position information to obtain a second distance;
comparing the magnitude of the first distance and the second distance;
if the first distance is smaller than the second distance, determining that the first distance is a target distance;
judging whether the target distance is smaller than a preset threshold value or not;
if yes, determining that the target text belongs to a money receiving direction;
if the second distance is smaller than the first distance, determining that the second distance is the target distance;
judging whether the target distance is smaller than the preset threshold value or not;
and if so, determining that the target text belongs to a payment direction.
In a possible implementation manner, after the determining the payment and receipt direction of the payment and receipt field information, the method further includes:
acquiring field information of which the payment and receipt direction is not identified in the payment and receipt field information to obtain a target text;
acquiring target position information of a target text;
acquiring first position information corresponding to a collection direction and second position information corresponding to a payment direction in the collection and payment direction of the collection and payment field information;
and processing the target position information, the first position information and the second position information to obtain a payment and receipt direction corresponding to the target text.
In a possible implementation manner, the splicing the N text blocks according to the indexes and the position information of the N text blocks includes:
obtaining text blocks with negative left index values in the N text blocks to obtain M first text blocks;
determining a text block of which the right index value is not a negative number in the first text block as a current text block;
1) judging whether a left index value of a second text block is the same as a current index value of the current text block, and whether the current index value of the second text block is the same as a right index value of the current text block, wherein the second text block is a text block except the M first text blocks in the N text blocks;
2) if yes, determining the second text block as a new current text block, and re-executing the step 1) to the step 2);
splicing the current text block in the step 1) with the new current text block in the step 2) to obtain a third text block;
acquiring a fourth text block, wherein the fourth text block is the other text blocks except the third text block in the N text blocks;
and splicing the fourth text block and the third text block according to the position information of the fourth text block to obtain a target text block.
Another aspect of the present application provides a bank receipt identification device, including:
the acquisition unit is used for acquiring a bank receipt image to be identified;
the identification unit is used for identifying the bank receipt image to obtain N text blocks, and each text block comprises corresponding text content, index and position information;
the splicing unit is used for splicing the N text blocks according to the indexes and the position information of the N text blocks to obtain a target text block;
the identification unit is further configured to identify the target text block by using a natural language processing technology to obtain fixed field information and payment and receipt field information, and determine a payment and receipt direction of the payment and receipt field information.
In a possible implementation manner, the bank receipt recognition device further comprises a processing unit;
the acquisition unit is further configured to acquire field information of a payment/receipt direction to be identified in the payment/receipt field information;
the acquisition unit is also used for acquiring target position information corresponding to the field information of the payment and receipt direction to be identified;
the acquisition unit is further configured to acquire field information of the recognized payment and receipt direction in the payment and receipt field information;
the acquisition unit is further configured to acquire, in the field information of the identified receiving and payment direction, first location information corresponding to the receiving direction and second location information corresponding to the payment direction;
and the processing unit is used for processing the target position information, the first position information and the second position information to obtain the payment and receipt directions corresponding to the field information of the payment and receipt directions to be identified.
In a possible implementation manner, the processing unit is specifically configured to:
calculating the minimum distance between the target position information and the first position information to obtain a first distance;
calculating the minimum distance between the target position information and the second position information to obtain a second distance;
comparing the magnitude of the first distance and the second distance;
if the first distance is smaller than the second distance, determining that the first distance is a target distance;
judging whether the target distance is smaller than a preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment and receipt direction;
if the second distance is smaller than the first distance, determining that the second distance is the target distance;
judging whether the target distance is smaller than the preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment direction.
Another aspect of the present application provides a computer device, comprising: a memory, a processor, and a bus system; the memory is used for storing program codes; the processor is used for executing the identification method of the bank receipt in any aspect according to instructions in the program code.
Another aspect of the present application provides a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute the method for identifying a bank receipt according to any one of the above aspects.
According to another aspect of the application, a computer program product or computer program is provided, comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to execute the identification method of the bank receipt in any aspect.
According to the technical scheme, the embodiment of the application has the following advantages: acquiring a bank receipt image to be identified; identifying the bank receipt image to obtain N text blocks, wherein each text block comprises corresponding text content, index and position information; splicing the N text blocks according to the indexes and the position information of the N text blocks to obtain a target text block; and identifying the target text block by adopting a natural language processing technology to obtain fixed field information and payment and receipt field information, and determining the payment and receipt direction of the payment and receipt field information. By the mode, in the process of identifying the bank receipt image, the identification template does not need to be customized according to different bank receipt formats, the identification method can be suitable for different bank receipt formats, and the identification efficiency of the bank receipt is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of an identification method for a bank receipt according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating the recognition of the bank receipt image to obtain N text blocks in the embodiment of the present application;
FIG. 3 is a schematic flow chart illustrating splicing of N text blocks to obtain a target text block in the embodiment of the present application
FIG. 4 is an exemplary diagram of a bank receipt image in an embodiment of the present application;
FIG. 5A is a diagram of a text block according to an embodiment of the present application;
FIG. 5B is a diagram of another text block in the embodiment of the present application;
FIG. 6A is a diagram illustrating the processing of DATA1 in the embodiment of the present application;
FIG. 6B is a diagram illustrating the processing of the DATA2 part of the DATA block in the embodiment of the present application;
FIG. 7 is a diagram illustrating a scenario in which field information of the payment and receipt directions to be identified exists in an embodiment of the present application;
fig. 8 is a schematic structural diagram of a bank receipt identification device according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a computer device in an embodiment of the present application.
Detailed Description
The embodiment of the application provides a method for identifying a bank receipt, which is used for improving the identification efficiency of the bank receipt.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "corresponding" and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, fig. 1 is a flowchart of a method for identifying a bank receipt according to an embodiment of the present application, where the embodiment of the present application includes the following steps:
101. acquiring a bank receipt image to be identified;
in the embodiment of the application, the specific format of the bank receipt is not limited, and the corresponding bank receipt image can be acquired aiming at the bank receipts with different formats, so that the identification method of the bank receipt provided by the application is executed.
Optionally, after the bank receipt image to be identified is obtained, in order to facilitate subsequent identification processes, the bank receipt image may be preprocessed, for example, resolution and illumination saturation of the bank receipt image are optimized.
102. Identifying the bank receipt image to obtain N text blocks, wherein each text block comprises corresponding text content, index and position information;
the image of the bank receipt acquired in step 101 includes the complete image information of the bank receipt. Because the bank receipt image contains more text information, the bank receipt image needs to be identified and split to obtain N text blocks, wherein each text block contains corresponding text content, index and position information, the index of each text block represents the relative position of the text block and other text blocks in the original bank receipt image, and the position information of each text block represents the absolute position of the text block in the original bank receipt image.
For convenience of understanding, please refer to fig. 2, where fig. 2 is a flowchart illustrating a process of recognizing a receipt image of a bank to obtain N text blocks in an embodiment of the present application, and as shown in fig. 2, the process of recognizing the receipt image of the bank to obtain N text blocks may specifically include:
a1, identifying the direction of the bank receipt image;
the following situations are often contained in the acquired bank receipt: random photographing, complex background, text background interference, one image containing a plurality of bank receipt or incomplete receipt and the like. The bank receipt image can be segmented, and the segmented bank receipt image is subjected to direction recognition. Specifically, the direction of the segmented image may be identified by using a convolutional network model, and if the directions of identifying the bank receipt image are 0 °, 90 °, 180 °, or 270 °, the identification results are 0,1, 2, and 3, respectively. If the recognition result is 0, the direction of the bank receipt image is determined to be positive, and if the direction of the bank receipt image is not positive, the corrected image is rotated.
A2, detecting a single-line text image in a bank receipt image;
and converting the color image in the bank receipt image into a gray image, and then carrying out gray normalization. The image length and width are configured to be a multiple of 32. The detection network uses resnet50 as a backbone network, and may perform upsamplample four times to obtain 1/2, which is the size of the output image equal to the original image size, in order to obtain the classification of pixels. In order to avoid the adhesion of text images of adjacent lines, three branches are predicted and output, a text branch, a text boundary branch and a text center branch are predicted respectively, and a text circumscribed rectangle box is extracted through the three branches. And carrying out affine transformation on the circumscribed rectangular frame to segment N single-line text images, wherein N is an integer greater than or equal to 1.
A3, identifying a single-line text image;
the height of the N cut single-line text images is configured to be 32 width to be scaled by using a resnet50+ bilstm + ctc network structure algorithm, and then the N cut single-line text images are input into the recognition network to obtain a recognition result, so that N text contents are obtained.
And (3) sequentially drawing each text content on a 0 figure of the size of an original image system to mark the text content as an image M, wherein the filling pixel value of the text content is the sequence number of the text content. The left index of the text is to calculate the slope and the text height of the text content, and extend the text height to the left by T times to obtain a text box B. And extracting pixel values with coordinates of the text content B from the image M, and counting the pixel value with the maximum number of the pixel values as the index value. And finally, outputting text content, index and position information corresponding to the single-line text image, namely the text block in the application.
Specifically, the bank receipt image may generate a list DATA [ item _1, item _2, …, item _ n ] having a DATA structure as follows through the above-described recognition process. The list DATA then comprises N text blocks, each of which may be represented by an item _ i. The index idx starts from 0, where item _ i is in the format:
Figure BDA0003131395870000051
Figure BDA0003131395870000061
the following explains the various fields in the item _ i structure:
text-recognized text content
up _ idx is the index corresponding to the upper data block of the item _ i data block;
down _ idx is the index corresponding to the lower data block of the item _ i data block;
left _ idx is the index corresponding to the data block on the left side of the item _ i data block;
right _ idx is the index corresponding to the data block on the right side of the item _ i data block;
current _ idx is the current index of the item _ i data block;
and point is the position information of the data block of item _ i.
When the index value of up _ idx, down _ idx, left _ idx or right _ idx is negative, it indicates that the distance interval exceeds a specified threshold, for example, when left _ idx in a certain item data block structure is negative, it indicates that there is no corresponding data block on the left side of the data block or the interval is too large, and no connection is needed.
103. Splicing the N text blocks according to the indexes and the position information of the N text blocks to obtain a target text block;
after the index and the position information of each text block are mastered, all the N text blocks can be spliced according to the index and the position information of each text block to obtain the target text block.
For example, the existing text block a is "pay", the text block B is "1234567890123456 (bank card number)" and the text block C is "account number". The text blocks A, B and C can be spliced according to the index and the position information of each text block, and the spliced target text block is "payment account 1234567890123456".
For easy understanding, please refer to fig. 3, where fig. 3 is a schematic flowchart illustrating a process of splicing N text blocks to obtain a target text block in an embodiment of the present application, and as shown in fig. 3, the method specifically includes the following steps:
1031. from the DATA blocks in the DATA list, the DATA block list DATA1 with left _ idx being negative is sorted out, and DATA1 is sorted in the order of DATA. A text information list text _ list and a location information list point _ list are set, respectively.
1032. A failure process of each DATA block in the DATA1 list;
specifically, the following steps are included for each DATA block in the list of the bad processing DATA 1:
(a) assuming that the current data block is item, recording the item current index _ idx, text content text and position information point.
(b) Recycling process steps (b1) to (b 3):
(b1) and (3) condition judgment: if the right _ idx of item is not negative, and left _ idx in the data block item _1 indexed by right _ idx is the same as current _ idx of item, and current _ idx in item _1 is equal to right _ idx of item, jump (b2), otherwise jump (b 3);
(b2) the method comprises the following steps Recording current _ idx, text content text and position information point of the current index of item _ 1; and setting item _1 as the current data block item, namely item _ 1; continuing the cycle of (b);
(b3) exiting the loop of (b).
(c) The method comprises the following steps And (c) splicing the text contents text of the items recorded in the steps (a) and (b) to form a complete character string text _ c, and setting the position information corresponding to the text _ c as the position information point recorded in the step (a).
(d) The character string text _ c is added to the text _ list, and the position information point _ c is added to the point _ list.
1033. The DATA blocks DATA2 that have not been processed, i.e., the DATA list minus the DATA blocks that have been recorded in step (2), are sorted by DATA index.
1034. Circularly processing each DATA block in the DATA2 list;
assuming that the current data block is item, recording the item current index _ idx, text content text and position information point. Text content text is added to the text _ list, and location information point is added to the point _ list.
1035. Splicing the text information list text _ list;
and constructing a splicing format S, and forming the splicing format T _ index _ T by using an index of a certain text message and a certain special character T in the text message list text _ list. And splicing the text information list text _ list according to a splicing format S to form a complete bank receipt text information character string text _ global which is the target text block in the application.
For example, please refer to fig. 4, and fig. 4 is an exemplary diagram of a bank receipt image in an embodiment of the present application. After the bank receipt image is recognized and N text blocks shown in fig. 5A and 5B are obtained, DATA1 partial DATA block processing shown in fig. 6A and DATA2 partial DATA block processing shown in fig. 6B are performed on the text blocks, and the text blocks are spliced according to the results of DATA1 and DATA2 processing, so that text _ list [ [ 3602xxxxxxxxxxxxx ', ' person ' ], and point _ list [ [144.0,124.0], [148.0,140.0] ]areknown. Constructing a splicing format: for example, if T is $, a text information character string text _ global of a DATA block indexed between 12 and 16 is "$ 0$ payment account 3602xxxxxxxxxxxxx $1 person", which is a target text block corresponding to the bank receipt image.
104. Identifying the target text block by adopting a natural language processing technology to obtain fixed field information and payment and receipt field information, and determining the payment and receipt direction of the payment and receipt field information;
after the target text block is obtained through the splicing in step 103, the target text block may be identified through Natural Language Processing (NLP) technology, the field information and the payment and receipt field information are fixed, and the payment and receipt direction of the payment and receipt field information is determined. For the bank receipt, at least the information of the payee and the information of the payer, such as bank account number, account name, bank opening bank and the like, are required, and the information is required to be definitely related to the payee or the payer, namely, the information of the receipt and payment field in the application. The receipt number, the transaction date and the like in the bank receipt do not have information of the payment and receipt direction, namely the fixed field information in the application. After the information of the payment and receipt fields is identified in step 104, the payment and receipt direction corresponding to the information of the payment and receipt fields can also be determined, so as to determine which information, such as the bank account number, the account name, the bank account opening bank and the like, belongs to the payee and which information belongs to the payer.
Specifically, in the embodiment of the present application, the regular expression may be adopted to identify the target text block, so as to obtain the field information and the payment and receipt direction corresponding to the field information. Specifically, a corresponding regular expression needs to be pre-designed for each content of the bank receipt, for example, the form of the regular expression for identifying the account may include but is not limited to: payment account number (\ d {1 }). Taking the field information of the target text block as "payment account 1234567890123456" as an example, if it is determined that the target text block satisfies the regular expression matching the recognition account, a corresponding recognition result can be obtained, where the information belongs to the payment information, that is, the field information is "payment account 1234567890123456", and the payment direction is the payment direction.
In practical application, after the fixed field information, the receipt and payment field information and the receipt and payment direction corresponding to the receipt and payment field information are obtained through the identification in the step 104, the information can be output and fed back, or the information is input into a bank receipt database, so that the management efficiency of the bank receipt is improved.
It should be understood that, in addition to the identification of the target text block through the regular expression given in the above example, in practical applications, other NLP technologies may also be used to identify the target text block, which is not limited herein.
In the embodiment of the application, a bank receipt image to be identified is obtained; identifying the bank receipt image to obtain N text blocks, wherein each text block comprises corresponding text content, index and position information; splicing the N text blocks according to the indexes and the position information of the N text blocks to obtain a target text block; and identifying the target text block by adopting a natural language processing technology to obtain fixed field information and payment and receipt field information, and determining the payment and receipt direction of the payment and receipt field information. By the mode, in the process of identifying the bank receipt image, the identification template does not need to be customized according to different bank receipt formats, the identification method can be suitable for different bank receipt formats, and the identification efficiency of the bank receipt is improved.
Further, in practical applications, for information such as bank accounts, account names and account opening lines, in some cases, due to the problem of format differences of receipt of different banks, specific directions for receiving and paying can not be matched. For example, referring to fig. 7 for easy understanding, fig. 7 is a schematic view of a scenario in which field information of a receipt and payment direction to be identified exists in an embodiment of the present application, as shown in fig. 7, a target text block may match a regular expression of a last username or an account opening line, however, since at the "account name" 701 and the "issuer" 702, no relevant typeface of the receipt and payment information appears, such as "payer name" or "payment issuer," and therefore cannot determine whether to collect or pay in the direction, which, in the present application, for such bank account number, account name and issuer information that cannot identify the direction of receipt or payment after passing through step 104, defined as "field information of the direction of receipt or payment to be identified", however, the receipt number and the transaction date in the bank receipt itself do not have information on the payment and receipt directions (i.e. fixed field information), and do not belong to the "field information on the payment and receipt directions to be identified" in the present application.
In order to solve the problem that the field information of the payment and receipt direction to be identified exists, in the application, after the payment and receipt direction of the payment and receipt field information is determined, the payment and receipt direction can be further determined
Acquiring field information of a payment and receipt direction to be identified in the payment and receipt field information;
acquiring target position information corresponding to the field information of the payment and receipt direction to be identified;
acquiring field information of the recognized payment and receipt direction in the payment and receipt field information;
acquiring first position information corresponding to the collection direction and second position information corresponding to the payment direction in the field information of the identified collection and payment direction;
and processing the target position information, the first position information and the second position information to obtain the payment and receipt directions corresponding to the field information of the payment and receipt directions to be identified.
In this embodiment, the field information of the payment and receipt direction to be identified in the payment and receipt field information is first acquired to obtain the target text, and the position information of the target text, that is, the target position information, is acquired. However, generally, even if there is field information in which the direction of receipt and payment cannot be determined in the current receipt and payment field information, there must be some field information in which the direction of receipt and payment is recognized after step 104, such as "payment direction" 703 and "payment direction" 704 shown in fig. 7. Therefore, it is also necessary to acquire the first location information corresponding to the collection direction (for example, "collection direction" 704) and the second location information corresponding to the payment direction (for example, "payment direction" 703) from the collection and payment direction information identified in step 104. And then, the target position information, the first position information and the second position information are processed, so that the payment and receipt directions corresponding to the field information of the payment and receipt directions to be identified can be obtained.
In the application, the processing of the target location information, the first location information and the second location information to obtain the payment and receipt directions corresponding to the target text may specifically include the following steps:
calculating the minimum distance between the target position information and the first position information to obtain a first distance;
calculating the minimum distance between the target position information and the second position information to obtain a second distance;
comparing the magnitude of the first distance and the second distance;
if the first distance is smaller than the second distance, the correlation degree between the target position information and the first position information is higher, namely the correlation degree between the target text and the money receiving direction is higher, and the first distance can be determined as the target distance;
judging whether the target distance is smaller than a preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment and receipt direction;
if the second distance is smaller than the first distance, the correlation degree between the target position information and the second position information is higher, namely the correlation degree between the target text and the payment direction is higher, and the second distance can be determined as the target distance;
judging whether the target distance is smaller than a preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment direction.
Specifically, in order to improve the accuracy of identifying the direction of receipt and payment of the field information of the direction of receipt and payment to be identified, for example, in the embodiment of the present application, the following takes as an example that the minimum euclidean distances between the first location information, the second location information, and the target location information are respectively calculated, and the first distance and the second distance are respectively obtained. It should be understood that in practical applications, other ways of calculating the distance may be used, and are not limited herein.
Assume that the location information of the collection direction is: the first position information [ [ x1, y1], [ x2, y2], … ], and the position information of the payment direction is: the second position information [ [ a1, b1], [ a2, b2], … ], and the position information corresponding to the target text is: the target position information is [ x, y ]. The specific steps for judging the direction of payment and receipt are as follows:
the euclidean distances of each position coordinate of the target position information [ x, y ] and the first position information [ x1, y1], [ x2, y2], … ] are calculated, respectively, and the shortest distance (first distance) among them is calculated.
The euclidean distances of each position coordinate of the target position information [ x, y ] and the second position information [ a1, b1], [ a2, b2], … ] are calculated, respectively, and the shortest distance (second distance) among them is calculated.
The smaller of the first distance and the second distance is selected as the target distance.
If the target distance is smaller than the preset threshold value, whether the direction of the account name is a collection direction or a payment direction can be judged.
In the embodiment, when the field information of the payment and receipt direction to be identified exists, the auxiliary judgment can be carried out by combining the position information of the field information, so that the specific payment and receipt direction is identified, and the accuracy of the scheme is improved.
Furthermore, after the fixed field information and the payment and receipt field information are obtained through identification, further post-processing can be carried out on the fixed field information and the payment and receipt field information. For example: according to the characteristics of each field of the bank receipt, selective stop word processing is carried out, such as punctuation marks or spaces; and carrying out error correction processing on the field information, such as field information of an account opening bank and the like. The text recognized by the OCR may have a chinese recognition error, and in order to reduce the recognition error probability, a text similarity algorithm, an edit distance or a length difference process may be used.
Illustratively, a given List of correctly-opening banks is known to contain the following opening banks:
'Gongchang Victoria square branch line'
China Industrial and commercial Bank sports Xilu branch line "
High and new branches of Bingchun "
The field value content text to be corrected is 'Gongduo Li production field branch' of the industry and traffic.
The specific error correction flow is as follows:
(a) if the field value content text to be corrected is in the known and given correct account opening bank List, returning the field value content; otherwise, jumping to (b);
(b) and after N candidate texts are obtained through inverted indexing of the vocabulary for the field value content text to be corrected, k candidate texts most similar to the text are calculated by using a text similarity method, wherein k is less than N. The text similarity calculation method may be one of TFIDF, BM25 algorithm, and elastic search.
(c) Screening out a text to be corrected and a public character sequence text1 of k candidate texts; for k candidate texts, a candidate text list n containing all the text1 (all the characters or t characters, the larger t, the lower the probability of error correction) is found, wherein n < k. If n is empty, returning the field value content text to be corrected, otherwise jumping to (d).
(d) Respectively calculating the editing distance similarity of the field value content text to be corrected and n candidate texts to obtain a text containing n editing distance contentsAnd editing the distance similarity list. The edit distance, i.e., the Levenshtein distance, is a measure for calculating the degree of difference between two strings. The edit distance can be considered to be the minimum number of times required to edit a single character when modifying from one character string to another. Typically by operations such as replacement, insertion, deletion, etc. Mathematically, the edit distance between two strings A and B is defined as levA,B(a, B), wherein a, B are the lengths of A and B, respectively,
Figure BDA0003131395870000101
editing distance similarity: simliarity ═ 1-levA,B(a,b)/max(a,b)
Such as: a is the branch of the Gongduoli production place of the industry and the B is the branch of the Victoria square of the industry and the industry. The edit distance of A and B is calculated as follows:
and (3) replacing: business operation (Yong- > Wei)
And (3) replacing: i 'o'm Wei duo Li (Li- > Li)
Inserting: utilia (a-a)
And (3) replacing: industrial and commercial Uygur Asia Guang (product- > Guang)
Therefore, only 4 editing operations are required to modify from A to B, so the editing distance is 4. the similarity is: 1-4/max (9,10) ═ 0.6.
Selecting the maximum similarity p from the list containing n editing distance similarities, and if p is larger than a preset threshold value, selecting a candidate text with the index corresponding to the maximum similarity p from the n candidate texts as the corrected text content for replacement; otherwise, the replacement is not performed.
In this embodiment, the obtained field information may be further subjected to error correction, so as to improve the accuracy of implementation of the scheme.
In order to better implement the above-mentioned aspects of the embodiments of the present application, the following also provides related apparatuses for implementing the above-mentioned aspects. Referring to fig. 8, fig. 8 is a schematic structural diagram of a bank receipt identification device according to an embodiment of the present application, where the bank receipt identification device includes:
an obtaining unit 801, configured to obtain a bank receipt image to be identified;
the identifying unit 802 is configured to identify the bank receipt image to obtain N text blocks, where each text block includes corresponding text content, index, and position information;
the splicing unit 803 is configured to splice the N text blocks according to the indexes and the position information of the N text blocks to obtain a target text block;
the identifying unit 802 is further configured to identify the target text block by using a natural language processing technology, obtain fixed field information and payment and receipt field information, and determine a payment and receipt direction of the payment and receipt field information.
Optionally, on the basis of the embodiment corresponding to fig. 8, the bank receipt identification apparatus further includes a processing unit 804;
the obtaining unit 801 is further configured to obtain field information of a payment/receipt direction to be identified in the payment/receipt field information;
the obtaining unit 801 is further configured to obtain target location information corresponding to the field information of the payment and receipt direction to be identified;
the acquiring unit 801 is further configured to acquire field information of the payment and receipt direction identified in the field information of payment and receipt;
the obtaining unit 801 is further configured to obtain, in the field information of the identified receiving and payment direction, first location information corresponding to the receiving direction and second location information corresponding to the payment direction;
the processing unit 804 is configured to process the target location information, the first location information, and the second location information to obtain a payment/receipt direction corresponding to the field information of the payment/receipt direction to be identified.
Optionally, on the basis of the embodiment corresponding to fig. 8, the processing unit 804 is specifically configured to:
calculating the minimum distance between the target position information and the first position information to obtain a first distance;
calculating the minimum distance between the target position information and the second position information to obtain a second distance;
comparing the magnitude of the first distance and the second distance;
if the first distance is smaller than the second distance, determining that the first distance is a target distance;
judging whether the target distance is smaller than a preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment and receipt direction;
if the second distance is smaller than the first distance, determining that the second distance is the target distance;
judging whether the target distance is smaller than the preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment direction.
In this embodiment, the bank receipt identification device may perform the operations of any one of the embodiments shown in fig. 1 to 6B, which will not be described herein again.
The embodiment of the present application further provides a computer device, configured to perform the operations of any one of the embodiments shown in fig. 1 to 6B. Referring to fig. 9, fig. 9 is a schematic structural diagram of a computer apparatus 900 according to an embodiment of the present application. As shown, the computer device 900 may vary widely in configuration or performance, and may include one or more Central Processing Units (CPUs) 922 (e.g., one or more processors) and memory 932, one or more storage media 930 (e.g., one or more mass storage devices) storing applications 942 or data 944. Memory 932 and storage media 930 can be, among other things, transient storage or persistent storage. The program stored on the storage medium 930 may include one or more modules (not shown), each of which may include a series of instruction operations for a computer device. Still further, central processor 922 may be disposed in communication with storage medium 930 to execute a series of instruction operations in storage medium 930 on computer device 900.
The computer device 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input-output interfaces 958, and/or one or more operating systems 941, such as a Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTMAnd so on.
The steps performed in the above-described embodiment may be based on the structure of the computer apparatus shown in fig. 9.
Embodiments of the present application also provide a computer-readable storage medium, in which a computer program is stored, and when the computer program runs on a computer, the computer is caused to execute the method described in the foregoing embodiments.
Embodiments of the present application also provide a computer program product including a program, which, when run on a computer, causes the computer to perform the methods described in the foregoing embodiments. It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a management apparatus for interactive video, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A bank receipt recognition method is characterized by comprising the following steps:
acquiring a bank receipt image to be identified;
identifying the bank receipt image to obtain N text blocks, wherein each text block comprises corresponding text content, index and position information;
splicing the N text blocks according to the indexes and the position information of the N text blocks to obtain a target text block;
and identifying the target text block by adopting a natural language processing technology to obtain fixed field information and payment and receipt field information, and determining the payment and receipt direction of the payment and receipt field information.
2. The method of claim 1, wherein after determining the direction of receipt and payment of the receipt and payment field information, the method further comprises:
acquiring field information of a payment and receipt direction to be identified in the payment and receipt field information;
acquiring target position information corresponding to the field information of the payment and receipt direction to be identified;
acquiring field information of the recognized payment and receipt direction in the payment and receipt field information;
acquiring first position information corresponding to the collection direction and second position information corresponding to the payment direction in the field information of the identified collection and payment direction;
and processing the target position information, the first position information and the second position information to obtain the payment and receipt directions corresponding to the field information of the payment and receipt directions to be identified.
3. The method as claimed in claim 2, wherein the processing the target location information, the first location information and the second location information to obtain the payment and receipt directions corresponding to the field information of the payment and receipt directions to be identified comprises:
calculating the minimum distance between the target position information and the first position information to obtain a first distance;
calculating the minimum distance between the target position information and the second position information to obtain a second distance;
comparing the magnitude of the first distance and the second distance;
if the first distance is smaller than the second distance, determining that the first distance is a target distance;
judging whether the target distance is smaller than a preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment and receipt direction;
if the second distance is smaller than the first distance, determining that the second distance is the target distance;
judging whether the target distance is smaller than the preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment direction.
4. The method of claim 1, 2 or 3, wherein the recognizing the bank receipt image to obtain N text blocks comprises:
dividing the bank receipt image into N single-line text images;
adopting an image identification network to identify the N single-line text images to obtain N text contents;
according to the position information of each text content on the bank receipt image, determining the index and the position information corresponding to each text block to obtain the index and the position information corresponding to the N text contents;
and outputting the N text contents and indexes and position information corresponding to the N text contents to obtain N text blocks.
5. The method according to claim 1, 2 or 3, wherein the splicing the N text blocks according to the indexes and the position information of the N text blocks comprises:
obtaining text blocks with negative left index values in the N text blocks to obtain M first text blocks;
determining a text block of which the right index value is not a negative number in the first text block as a current text block;
1) judging whether a left index value of a second text block is the same as a current index value of the current text block, and whether the current index value of the second text block is the same as a right index value of the current text block, wherein the second text block is a text block except the M first text blocks in the N text blocks;
2) if yes, determining the second text block as a new current text block, and re-executing the step 1) to the step 2);
splicing the current text block in the step 1) with the new current text block in the step 2) to obtain a third text block;
acquiring a fourth text block, wherein the fourth text block is the other text blocks except the third text block in the N text blocks;
and splicing the fourth text block and the third text block according to the position information of the fourth text block to obtain a target text block.
6. A bank receipt identifying device, comprising:
the acquisition unit is used for acquiring a bank receipt image to be identified;
the identification unit is used for identifying the bank receipt image to obtain N text blocks, and each text block comprises corresponding text content, index and position information;
the splicing unit is used for splicing the N text blocks according to the indexes and the position information of the N text blocks to obtain a target text block;
the identification unit is further configured to identify the target text block by using a natural language processing technology to obtain fixed field information and payment and receipt field information, and determine a payment and receipt direction of the payment and receipt field information.
7. The bank receipt identifying device according to claim 6, wherein the bank receipt identifying device further comprises a processing unit;
the acquisition unit is further configured to acquire field information of a payment/receipt direction to be identified in the payment/receipt field information;
the acquisition unit is also used for acquiring target position information corresponding to the field information of the payment and receipt direction to be identified;
the acquisition unit is further configured to acquire field information of the recognized payment and receipt direction in the payment and receipt field information;
the acquisition unit is further configured to acquire, in the field information of the identified receiving and payment direction, first location information corresponding to the receiving direction and second location information corresponding to the payment direction;
and the processing unit is used for processing the target position information, the first position information and the second position information to obtain the payment and receipt directions corresponding to the field information of the payment and receipt directions to be identified.
8. The device of claim 7, wherein the processing unit is specifically configured to:
calculating the minimum distance between the target position information and the first position information to obtain a first distance;
calculating the minimum distance between the target position information and the second position information to obtain a second distance;
comparing the magnitude of the first distance and the second distance;
if the first distance is smaller than the second distance, determining that the first distance is a target distance;
judging whether the target distance is smaller than a preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment and receipt direction;
if the second distance is smaller than the first distance, determining that the second distance is the target distance;
judging whether the target distance is smaller than the preset threshold value or not;
if yes, determining that the field information of the payment and receipt direction to be identified belongs to the payment direction.
9. A computer device, the computer device comprising a processor and a memory:
the memory is used for storing program codes; the processor is configured to execute the method for identifying a bank receipt according to any one of claims 1 to 5 according to instructions in the program code.
10. A computer-readable storage medium having stored therein instructions which, when run on a computer, cause the computer to perform the method of identifying bank statements of any of the above claims 1 to 5.
CN202110706242.2A 2021-06-24 2021-06-24 Recognition method of bank receipt, related device and storage medium Pending CN113469005A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110706242.2A CN113469005A (en) 2021-06-24 2021-06-24 Recognition method of bank receipt, related device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110706242.2A CN113469005A (en) 2021-06-24 2021-06-24 Recognition method of bank receipt, related device and storage medium

Publications (1)

Publication Number Publication Date
CN113469005A true CN113469005A (en) 2021-10-01

Family

ID=77872790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110706242.2A Pending CN113469005A (en) 2021-06-24 2021-06-24 Recognition method of bank receipt, related device and storage medium

Country Status (1)

Country Link
CN (1) CN113469005A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113938481A (en) * 2021-11-12 2022-01-14 中国建设银行股份有限公司 Receipt processing method, processing device, electronic equipment and readable storage medium
CN114419640A (en) * 2022-02-25 2022-04-29 北京百度网讯科技有限公司 Text processing method and device, electronic equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113938481A (en) * 2021-11-12 2022-01-14 中国建设银行股份有限公司 Receipt processing method, processing device, electronic equipment and readable storage medium
CN114419640A (en) * 2022-02-25 2022-04-29 北京百度网讯科技有限公司 Text processing method and device, electronic equipment and storage medium
CN114419640B (en) * 2022-02-25 2023-08-11 北京百度网讯科技有限公司 Text processing method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN105528604B (en) A kind of bill automatic identification and processing system based on OCR
US11514698B2 (en) Intelligent extraction of information from a document
CN108717543B (en) Invoice identification method and device and computer storage medium
CN104217203B (en) Complex background card face information identifying method and system
US20220375245A1 (en) System for Information Extraction from Form-Like Documents
US11501344B2 (en) Partial perceptual image hashing for invoice deconstruction
CN113469005A (en) Recognition method of bank receipt, related device and storage medium
CN113591866B (en) Special operation certificate detection method and system based on DB and CRNN
CN112036145A (en) Financial statement identification method and device, computer equipment and readable storage medium
CN110516664A (en) Bank slip recognition method, apparatus, electronic equipment and storage medium
US20210256097A1 (en) Determination of intermediate representations of discovered document structures
CN112418812A (en) Distributed full-link automatic intelligent clearance system, method and storage medium
CN112766255A (en) Optical character recognition method, device, equipment and storage medium
CN115223166A (en) Picture pre-labeling method, picture labeling method and device, and electronic equipment
CN110688998A (en) Bill identification method and device
CN109670162A (en) The determination method, apparatus and terminal device of title
CN114998920B (en) Supply chain financial file management method and system based on NLP semantic recognition
CN110147516A (en) The intelligent identification Method and relevant device of front-end code in Pages Design
US20230138491A1 (en) Continuous learning for document processing and analysis
TWM575887U (en) Intelligent accounting system
CN115294593A (en) Image information extraction method and device, computer equipment and storage medium
CN115147847A (en) Text recognition result determining method and device, storage medium and computer equipment
TWM626292U (en) Business-oriented key item key-value identification system
CN113269101A (en) Bill identification method, device and equipment
CN110413659B (en) General shopping ticket data accurate extraction method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination