Financial bill processing method, device and equipment based on image processing

By performing edge detection, closed operations and connected domain analysis on the initial image, the image is iteratively adjusted to solve the problem of noise removal in handwritten character processing and improve the accuracy of financial bill processing.

CN118658164APending Publication Date: 2024-09-17SHANDONG INST OF INFORMATION TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410693337.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

Existing financial note processing methods are difficult to effectively remove noise when processing handwritten characters, resulting in low processing accuracy.

Method used

By performing edge detection, closed operation processing and connected domain analysis on the initial image, the image is iteratively adjusted until the number of connected domains meets the preset threshold, and multiplied point by point to remove noise to obtain a more reliable bill image.

Benefits of technology

Effectively remove noise points in the initial image and improve the accuracy of financial bill processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118658164A
    Figure CN118658164A
Patent Text Reader

Abstract

The invention relates to a financial bill processing method and device based on image processing and computer equipment. The method comprises the following steps: acquiring an initial image of a to-be-identified bill, performing edge detection on the initial image to obtain an edge detection image, taking the edge detection image as a basic image, performing closed operation processing on the basic image, taking a closed operation processing result as a temporary image, performing connected domain analysis on the temporary image, and obtaining the to-be-identified bill. If the number of the connected domains is larger than a preset number threshold value, updating the basic image through the temporary image, returning to the step of carrying out closed operation processing on the basic image until the number of the connected domains contained in the temporary image is smaller than or equal to the preset number threshold value, and multiplying the temporary image by the initial image point by point to obtain the final image. A point-by-point multiplication result is used as a bill image, so that a connected domain analysis result after closed operation processing conforms to prior information, noise points in an initial image are effectively removed, and a more reliable bill image is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention is applicable to the field of financial bill processing, and in particular relates to a financial bill processing method, device and equipment based on image processing. Background Art

[0002] At present, optical character recognition technology has been widely used in the scene of financial bill processing. By processing the bill image corresponding to the financial bill, the text information contained in the financial bill can be extracted. The character recognition process can be roughly divided into four processes: image preprocessing, text area extraction, character segmentation and character recognition. Usually, character recognition can be achieved through convolutional neural networks for classification. The existing character recognition model is relatively reliable when there is a large number of character data sets.

[0003] However, when the existing image preprocessing method is used for handwritten characters, it is difficult to effectively remove noise from the initial image, resulting in a low accuracy rate in financial document processing. Therefore, how to improve the accuracy rate in financial document processing has become an urgent problem to be solved. Summary of the invention

[0004] In view of this, embodiments of the present invention provide a financial bill processing method, apparatus, and computer equipment based on image processing to solve the problem of low accuracy in financial bill processing.

[0005] In a first aspect, a financial bill processing method based on image processing is provided, the method comprising: Step S101, obtaining an initial image of the bill to be identified, performing edge detection on the initial image, and obtaining an edge detection image; S102, using the edge detection image as a basic image; S103, performing a closing operation on the basic image, and using the closing operation result as a temporary image; S104, performing connected domain analysis on the temporary image to obtain the number of connected domains contained in the temporary image; S105: If the number of connected domains is greater than a preset threshold, the basic image is updated with the temporary image, and the process returns to step S103 to step S104 until the number of connected domains contained in the temporary image is less than or equal to the preset threshold. The temporary image is point-by-point multiplied with the initial image, and the result of the point-by-point multiplication is used as the bill image.

[0006] In a second aspect, a financial bill processing device based on image processing is provided, the device comprising: Step S101, obtaining an initial image of the bill to be identified, performing edge detection on the initial image, and obtaining an edge detection image; S102, using the edge detection image as a basic image; S103, performing a closing operation on the basic image, and using the closing operation result as a temporary image; S104, performing connected domain analysis on the temporary image to obtain the number of connected domains contained in the temporary image; S105: If the number of connected domains is greater than a preset threshold, the basic image is updated with the temporary image, and the process returns to step S103 to step S104 until the number of connected domains contained in the temporary image is less than or equal to the preset threshold. The temporary image is point-by-point multiplied with the initial image, and the result of the point-by-point multiplication is used as the bill image.

[0007] In a third aspect, an embodiment of the present invention provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the financial document processing method based on image processing as described in the first aspect is implemented.

[0008] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the financial document processing method based on image processing as described in the first aspect is implemented.

[0009] Compared with the prior art, the present invention has the following beneficial effects: By iteratively performing closing operations on the initial image, the connected domain analysis results of the closing operation processing results are consistent with the prior information of the bill image. The iterative closing operation process can effectively remove noise points in the initial image and obtain a more reliable bill image, thereby improving the accuracy of financial bill processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0011] Figure 1 This is a schematic diagram of an application environment of a financial bill processing method based on image processing provided by the first embodiment of the present invention; Figure 2 It is a flowchart of a financial bill processing method based on image processing provided by the first embodiment of the present invention; Figure 3It is a structural schematic diagram of a financial bill processing device based on image processing provided by the second embodiment of the present invention; Figure 4 It is a structural diagram of a computer device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0012] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0013] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0014] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0015] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.

[0016] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0017] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0018] The embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0019] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0020] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0021] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.

[0022] A financial bill processing method based on image processing provided by the first embodiment of the present invention can be applied in the following aspects: Figure 1 In the application environment, the image acquisition device communicates with the data processing terminal. The data processing terminal includes but is not limited to PDA, desktop computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, cloud terminal device, personal digital assistant (PDA) and other computer devices. The image acquisition device includes but is not limited to video camera, mobile terminal with video function, camera, video recorder, scanner and other terminals.

[0023] See also Figure 2 , is a flow chart of a financial bill processing method based on image processing provided by the first embodiment of the present invention. The financial bill processing method can be applied to Figure 1 The data processing terminal in the data processing terminal is connected to the image acquisition device in communication. When the computer device corresponding to the data processing terminal receives the image acquired by the image acquisition device, it triggers the execution of the corresponding financial bill processing task. Figure 2 As shown, the financial bill processing method may include the following steps: Step S101, obtaining an initial image of the bill to be identified, performing edge detection on the initial image, and obtaining an edge detection image; S102, using the edge detection image as a basic image; S103, performing a closing operation on the basic image, and using the closing operation result as a temporary image; S104, performing connected domain analysis on the temporary image to obtain the number of connected domains contained in the temporary image; S105, if the number of connected domains is greater than the preset threshold, the basic image is updated with the temporary image, and the process returns to step S103 to step S104 until the number of connected domains contained in the temporary image is less than or equal to the preset threshold, and the temporary image is point-by-point multiplied with the initial image, and the result of the point-by-point multiplication is used as the bill image.

[0024] Among them, edge detection can be implemented by edge detection operators such as Roberts operator, Prewitt operator, Sobel operator, Laplacian operator, etc., and the closing operation processing can refer to first performing an expansion operation on the basic image and then performing an erosion operation. The preset quantity threshold can be determined according to the prior information of the bill.

[0025] Optionally, the financial note processing method further includes: Step S201, extracting text regions from the bill image to obtain M text regions, where M is an integer greater than zero.

[0026] Among them, the bill image to be identified can be acquired by an image acquisition device. In this embodiment, the image acquisition device can be a scanner. It should be noted that the bill image has undergone conventional preprocessing operations by default. The preprocessing operations may include tilt correction, image denoising, image smoothing and image binarization, etc., that is, the bill image is a binary image. Usually, the bill image contains at least one text area. Therefore, after the text area is extracted from the bill image, M text areas are obtained, and one text area corresponds to a rectangular bounding box.

[0027] Specifically, text area extraction can adopt image processing-based methods, neural network-based methods, etc. When adopting image processing-based methods, the bill image can be morphologically processed, and then connected domain analysis or contour analysis can be performed to obtain a rectangular bounding box corresponding to the text area. When adopting neural network-based methods, implementers can choose to implement it using existing neural network architectures such as CTPN, TextBoxes, EAST, etc.

[0028] Optionally, the text area is a regular rectangular area in an image coordinate system corresponding to the bill image.

[0029] Among them, a regular rectangular area may refer to a regular rectangular area whose wide side is parallel to the horizontal axis of the image coordinate system and whose high side is perpendicular to the vertical axis of the image coordinate system. A regular rectangular area can be represented by the coordinates of its lower left corner and upper right corner in the image coordinate system where the bill image is located.

[0030] Step S202: for any text area, count the pixels of the text area to obtain the number of pixels corresponding to each column in the text area.

[0031] Among them, a single text area can be regarded as a matrix with R rows and S columns, and the R*S elements contained in the matrix are the pixel values ​​corresponding to the pixel points in the text area.

[0032] Specifically, since the bill image is a binary image, when counting the pixels of the text area by column, it is only necessary to add the elements corresponding to the text area, and the addition result can represent the number of non-zero pixels contained in the corresponding column.

[0033] Step S203, forming an initial character region from a number of continuous columns corresponding to a number of pixel points greater than a preset number threshold, to obtain N initial character regions, where N is an integer greater than zero.

[0034] Among them, the preset number threshold can be used to distinguish whether the corresponding column belongs to a character or an interval. When the number of pixels is less than or equal to the preset number threshold, the corresponding column can be considered to belong to an interval. When the number of pixels is greater than the preset number threshold, the corresponding column can be considered to belong to a character. N groups of character columns with a continuous relationship are combined into N initial character areas.

[0035] Specifically, in order to avoid the situation where there is a misjudgment of the character column obtained by threshold comparison, the implementer can add a correction strategy according to the actual situation. This embodiment provides a correction strategy as an example. When the columns adjacent to the left and the right of a column are both character columns, and the column is an interval column, the column can be corrected to be a character column. Similarly, when the columns adjacent to the left and the right of a column are both interval columns, and the column is, the column can be corrected to be an interval column. After the correction, the implementer can determine whether the correction process is reasonable based on the number of initial character areas and the number of columns corresponding to different initial character areas. For example, when the number of initial character areas after correction is too small, it means that the correction process divides multiple characters into the same initial character area, that is, the correction strategy is stopped, or the number of columns corresponding to each initial character area after correction is too different, and the correction strategy is also stopped.

[0036] Step S204: using a preset correction coefficient, respectively correct the N initial character regions to obtain target character regions corresponding to the N initial character regions.

[0037] The correction coefficient may be used to adjust the number of columns corresponding to the initial character region, and the target character region is the character region after the number of columns corresponding to the initial character region is adjusted.

[0038] Optionally, the N initial character regions are corrected respectively using a preset correction coefficient to obtain target character regions corresponding to the N initial character regions respectively, including: For any initial character region, determine the starting column and the ending column corresponding to the initial character region; According to the starting column and the ending column, the center column and the width of one side of the initial character area are determined; Add the correction coefficient to the area unilateral width to obtain the corrected unilateral width; Determine the target character area corresponding to the initial character area according to the center column and the corrected unilateral width; All initial character regions are traversed to obtain target character regions corresponding to the N initial character regions.

[0039] Among them, according to general writing and reading habits, the starting column can refer to the leftmost column of the initial character area, and the ending column can refer to the rightmost column of the initial character area. Let the starting column be the i-th column and the ending column be the j-th column, then the center column f can be expressed as (i+j) / 2, and the area unilateral width d can be expressed as (ji) / 2. It should be noted that the above-mentioned center column and area unilateral width are rounded after calculation.

[0040] The correction coefficient is expressed as g, and the corrected single-side width is d+g. Accordingly, the corrected starting column corresponding to the target character area is the fdg-th column, and the corrected ending column corresponding to the target character area is the f+d+g-th column.

[0041] This embodiment uses a correction coefficient to correct the initial character area so that the target character area corresponding to a single character can contain more image information to avoid missing character information and improve the accuracy of character recognition.

[0042] Step S205, inputting the N target character regions into the trained character classification network respectively, and forming a reference recognition result corresponding to the text region from the character recognition results corresponding to the N target character regions respectively.

[0043] Among them, the input of the character classification network is the sub-image corresponding to the target character area, and the output is the character recognition result corresponding to the target character area. The character classification network realizes the character recognition function through classification.

[0044] Specifically, according to the positional relationship of the N target character areas in the bill image, the front-to-back order of the N target character areas is determined. The closer to the left the target character area is, the higher the order is. According to the front-to-back order of the N target character areas, the character recognition results corresponding to the N target character areas are spliced ​​to obtain the reference recognition result corresponding to the text area.

[0045] Step S206, determining S text region sets having an associated relationship from the M text regions, where S is an integer less than M / 2, and one text region set includes two text regions.

[0046] Among them, it is allowed that a text area does not exist in the text area set. According to the characteristic that printed characters and handwritten characters in financial documents usually have correlation, a text area belongs to at most one text area set, and a text area set includes two text areas.

[0047] Optionally, determining a set of S text regions having an associated relationship from the M text regions includes: Get the center coordinate points corresponding to the M text areas respectively; For any two text areas, the actual distance between the two text areas is calculated based on the center coordinate points corresponding to the two text areas. If the actual distance meets the preset condition, it is determined that the two text regions form a text region set.

[0048] Among them, since the coordinates of the lower left corner point and the upper right corner point of the text area are known, the horizontal coordinates of the lower left corner point and the upper right corner point can be averaged to obtain the horizontal coordinate of the center coordinate point, and the vertical coordinates of the lower left corner point and the upper right corner point can be averaged to obtain the vertical coordinate of the center coordinate point. The actual distance can be calculated using the Euclidean distance, and the preset conditions can be used to determine the positional relevance between two text areas. Since in financial documents, text areas that are usually associated in position are also associated in semantics, this embodiment uses positional relevance to represent semantic relevance.

[0049] Optionally, if the actual distance satisfies a preset condition, determining that the two text regions form a text region set includes: According to the center coordinate points corresponding to the two text areas, the projection distances corresponding to the two text areas are calculated; Mapping the difference between the actual distance and the projected distance to an adjustment factor; Multiply the adjustment coefficient by the actual distance to obtain the multiplication result; If the multiplication result is less than the preset distance threshold, it is determined that the two text regions form a text region set.

[0050] Among them, the projection distance can refer to the absolute value of the difference between the horizontal coordinates of the center coordinate points corresponding to the two text areas. It is also based on the prior reading habits and writing habits, and the distance between the corresponding projection points on the horizontal axis of the image coordinate system is used as the projection distance.

[0051] The actual distance is greater than or equal to the projection distance, so the adjustment coefficient is obtained by mapping the difference between the actual distance and the projection distance. The specific mapping function can adopt y=exp(kx)-1, where k is a mapping parameter, which is usually set to a value greater than zero. In this embodiment, it can be set to 0.2. exp(kx) represents an exponential function with kx as the exponent, x is the input of the mapping function, and y is the output of the mapping function. In this embodiment, x corresponds to the difference between the actual distance and the projection distance, and y corresponds to the adjustment coefficient.

[0052] The preset distance threshold may be used to determine whether two text regions are close enough, and further determine whether to treat the two text regions as a text region set.

[0053] Specifically, when the difference between the actual distance and the projected distance is small, it means that the two text areas can be approximately regarded as being in the same row. At this time, if the actual distance is also small, it can be considered that the two text areas are close enough in the horizontal direction and can be regarded as a text area set. In this embodiment, only two text areas that are close enough in the horizontal direction are regarded as a text area set.

[0054] For example, if two text areas can be approximately regarded as being in the same column, the difference between the actual distance and the projected distance is large. Even if the actual distance between the two text areas is small, after adjustment by the adjustment coefficient, it will be greater than the preset distance threshold and will not be divided into a text area set.

[0055] Step S207: for any character region set, the reference recognition results corresponding to two character regions in the character region set are used to form a text to be verified.

[0056] The text to be verified can be used for subsequent text semantic verification.

[0057] Optionally, the reference recognition results corresponding to two text regions in the text region set form the text to be verified, including: According to the horizontal coordinates of the central coordinate points corresponding to the two text areas, the text area corresponding to the smaller horizontal coordinate is used as the front area, and the other text area is used as the back area; The reference recognition result corresponding to the rear area is spliced ​​to the end of the reference recognition result corresponding to the front area to form the text to be verified.

[0058] Step S208, performing an occlusion operation on the text to be verified using the occlusion item to obtain the occluded text, inputting the occluded text into the trained text reconstruction model to predict the occlusion item, and obtaining several prediction items with the highest prediction probability.

[0059] The masking item can be expressed as [mask]. When the masking item is used to mask the text to be verified, a character can be randomly selected from the text to be verified to replace the masking item, and the replaced text can be used as the masking text.

[0060] Specifically, the text reconstruction model can be trained using the text information corresponding to the bill as a training sample. Any character in the training sample can be replaced with an occluded item, and reconstruction training can be performed using the character as a label to achieve training of the text reconstruction model.

[0061] Optionally, the occluded text is input into a trained text reconstruction model to predict the occluded items, and several predicted items with the highest prediction probabilities are obtained, including: Input the occluded text into the trained text reconstruction model to predict the part of speech of the occluded item and obtain the predicted part of speech; According to a preset mapping table, determine the number P of prediction items corresponding to the predicted part of speech, where P is an integer greater than zero; Input the occluded text into the trained text reconstruction model to predict the occluded items, and obtain several predicted items and their corresponding prediction probabilities; Arrange all predicted terms in descending order of predicted probability to obtain a predicted term sequence; The first P predicted terms in the predicted term sequence are used as predicted terms.

[0062] Among them, the text reconstruction model may include an encoder and two fully connected layers, and the two fully connected layers correspond to part-of-speech prediction and word item prediction respectively.

[0063] The preset mapping table can be pre-defined by the implementer. It should be noted that this embodiment also uses letters and numbers as outputs for part-of-speech prediction. For example, when the predicted part-of-speech is a number, the number of predicted items is 3, when the predicted part-of-speech is the subject, the number of predicted items is 2, and when the predicted part-of-speech is a letter, the number of predicted items is 5, etc. The implementer can adjust the mapping relationship between the predicted part-of-speech and the predicted items in the mapping table according to actual conditions.

[0064] Step S209, if the character recognition result corresponding to the occluded item is different from all the predicted items, adjust the correction coefficient and return to execute steps S204 to S208 until the character recognition result corresponding to the occluded item is the same as any predicted item, and use the reference recognition result as the text recognition result corresponding to the bill image.

[0065] The correction coefficient may be adjusted by using an existing optimization algorithm, such as a simulated annealing algorithm, a greedy algorithm, etc., which is not limited here.

[0066] In this embodiment, a correction coefficient is used to correct the initial character area so that the target character area corresponding to a single character can contain more image information to avoid missing character information and improve the accuracy of character recognition. The text to be verified is determined by a set of text areas with associated relationships. By occluding and reconstructing the text to be verified, the semantic rationality of the text to be verified can be effectively characterized, and the correction coefficient is then fed back to adjust the accuracy of character segmentation, thereby effectively improving the accuracy of financial document text recognition.

[0067] Corresponding to the method of the above embodiment, Figure 3 The structural block diagram of the financial bill processing device based on image processing provided by the second embodiment of the present invention is shown. The financial bill processing device based on image processing is applied to a data processing terminal. The data processing terminal is connected to the image processing device for communication. When the computer device corresponding to the data processing terminal receives the image collected by the image collection device, it triggers the execution of the corresponding financial bill processing task. For the convenience of explanation, only the part related to the embodiment of the present invention is shown.

[0068] See also Figure 3 , the financial bill processing device based on image processing comprises: The edge detection module 31 is used to obtain an initial image of the bill to be identified, perform edge detection on the initial image, and obtain an edge detection image; A basic image determination module 32, configured to use the edge detection image as a basic image; A closing operation module 33, used for performing a closing operation on the basic image, and using the closing operation result as a temporary image; A connected domain analysis module 34 is used to perform connected domain analysis on the temporary image to obtain the number of connected domains contained in the temporary image; The bill image determination module 35 is used to update the basic image with a temporary image if the number of connected domains is greater than a preset threshold value, and return to execute steps S103 to S104 until the number of connected domains contained in the temporary image is less than or equal to the preset threshold value, and multiply the temporary image with the initial image point by point, and use the point-by-point multiplication result as the bill image.

[0069] Optionally, the financial bill processing device further includes: The text region extraction module 41 is used to extract the text region from the bill image to obtain M text regions, where M is an integer greater than zero; A pixel point counting module 42 is used for counting the pixel points of any text area to obtain the number of pixel points corresponding to each column in the text area; The character region determination module 43 is used to form an initial character region from a number of consecutive columns corresponding to a number of pixel points greater than a preset number threshold, to obtain N initial character regions, where N is an integer greater than zero; The character region correction module 44 is used to correct the N initial character regions respectively using a preset correction coefficient to obtain target character regions corresponding to the N initial character regions respectively; The character recognition module 45 is used to input the N target character regions into the trained character classification network respectively, and form a reference recognition result corresponding to the text region from the character recognition results corresponding to the N target character regions respectively; A set determination module 46 is used to determine S text region sets having an associated relationship from the M text regions, where S is an integer less than M / 2, and one text region set includes two text regions; A text forming module 47, for forming a text to be verified from reference recognition results corresponding to two text regions in the text region set for any text region set; The text prediction module 48 is used to perform a masking operation on the text to be verified using the masking item to obtain the masked text, and input the masked text into the trained text reconstruction model to predict the masked item, and obtain several predicted items with the highest prediction probability; The text verification module 49 is used to adjust the correction coefficient if the character recognition result corresponding to the occluded item is different from all the predicted items, and return to execute the character area correction module 44 to the text prediction module 48 until the character recognition result corresponding to the occluded item is the same as any predicted item, and use the reference recognition result as the text recognition result corresponding to the bill image.

[0070] Optionally, the text area is a regular rectangular area in an image coordinate system corresponding to the bill image.

[0071] Optionally, the character area correction module 44 includes: A column determination submodule, for determining, for any initial character region, a start column and an end column corresponding to the initial character region; The center column calculation submodule is used to determine the center column and the single-side width of the initial character area according to the starting column and the ending column; The width correction submodule is used to add the correction coefficient to the single-side width of the area to obtain the corrected single-side width; A target region submodule, for determining a target character region corresponding to the initial character region according to the center column and the corrected unilateral width; The region traversal submodule is used to traverse all initial character regions to obtain target character regions corresponding to the N initial character regions.

[0072] Optionally, the set determination module 46 includes: The center point acquisition submodule is used to obtain the center coordinate points corresponding to the M text areas respectively; The actual distance calculation submodule is used to calculate the actual distance between any two text areas according to the center coordinate points corresponding to the two text areas; The conditional determination submodule is used to determine that two text regions form a text region set if the actual distance meets a preset condition.

[0073] Optionally, the above-mentioned condition determination submodule includes: A projection distance calculation unit, used to calculate the projection distances corresponding to the two text areas according to the center coordinate points corresponding to the two text areas respectively; A coefficient mapping unit, used for mapping the difference between the actual distance and the projected distance into an adjustment coefficient; A distance adjustment unit, used for multiplying the adjustment coefficient by the actual distance to obtain a multiplication result; The threshold judgment unit is used to determine that the two text regions form a text region set if the multiplication result is less than a preset distance threshold.

[0074] Optionally, the text forming module 47 includes: A coordinate comparison submodule, for determining, based on the horizontal coordinates of the central coordinate points corresponding to the two text areas, the text area corresponding to the smaller horizontal coordinate as the front area and the other text area as the back area; The text splicing submodule is used to splice the reference recognition result corresponding to the rear area to the end of the reference recognition result corresponding to the front area to form the text to be verified.

[0075] Optionally, the text prediction module 48 includes: The part-of-speech prediction submodule is used to input the occluded text into the trained text reconstruction model to predict the part-of-speech of the occluded item and obtain the predicted part-of-speech; A number mapping submodule, used to determine the number P of predicted items corresponding to the predicted part of speech according to a preset mapping table, where P is an integer greater than zero; The term prediction submodule is used to input the occluded text into the trained text reconstruction model to perform term prediction of the occluded term, and obtain a number of predicted terms and their corresponding prediction probabilities; The term ranking submodule is used to arrange all predicted terms in descending order of predicted probability to obtain a predicted term sequence; The prediction item determination submodule is used to take the first P prediction items in the prediction item sequence as the prediction items.

[0076] It should be noted that the information interaction, execution process, etc. between the above-mentioned modules, sub-modules, and units are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0077] Figure 4 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention. Figure 4 As shown, the computer device of this embodiment includes: at least one processor ( Figure 4 Only one is shown in the figure), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, the steps in any of the above-mentioned embodiments of the financial document processing method based on image processing are implemented.

[0078] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Figure 4 This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.

[0079] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0080] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments, it may also be an external storage device of the computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Further, the memory may also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of a computer program, etc. The memory may also be used to temporarily store data that has been output or is to be output.

[0081] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0082] The present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing.

[0083] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0084] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0085] In the embodiments provided by the present invention, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0086] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0087] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.

Claims

1. A financial bill processing method based on image processing, characterized in that: The method comprises: S101, obtaining an initial image of a bill to be identified, and performing edge detection on the initial image to obtain an edge detection image; S102, using the edge detection image as a basic image; S103, performing a closing operation on the basic image, and using the closing operation result as a temporary image; S104, performing connected domain analysis on the temporary image to obtain the number of connected domains contained in the temporary image; S105: If the number of connected domains is greater than a preset threshold, the basic image is updated with the temporary image, and the process returns to step S103 to step S104 until the number of connected domains contained in the temporary image is less than or equal to the preset threshold. The temporary image is point-by-point multiplied with the initial image, and the result of the point-by-point multiplication is used as the bill image.

2. The financial bill processing method according to claim 1, characterized in that: The method further comprises: Step S201, extracting text regions from the bill image to obtain M text regions, where M is an integer greater than zero; Step S202, for any text area, counting the pixels of the text area to obtain the number of pixels corresponding to each column in the text area; Step S203, forming an initial character region from a number of continuous columns corresponding to a number of pixels greater than a preset number threshold, to obtain N initial character regions, where N is an integer greater than zero; Step S204, using a preset correction coefficient, respectively correcting the N initial character regions to obtain target character regions corresponding to the N initial character regions; Step S205, inputting the N target character regions into the trained character classification network respectively, and forming a reference recognition result corresponding to the text region from the character recognition results corresponding to the N target character regions respectively; Step S206, determining S text region sets having an associated relationship from the M text regions, where S is an integer less than M / 2, and one text region set includes two text regions; Step S207, for any character region set, forming a text to be verified from reference recognition results corresponding to two character regions in the character region set; Step S208, performing an occlusion operation on the text to be verified using an occlusion item to obtain an occlusion text, inputting the occlusion text into a trained text reconstruction model to predict the occlusion item, and obtaining a plurality of prediction items with the highest prediction probabilities; Step S209, if the character recognition result corresponding to the occluded item is different from all the predicted items, adjust the correction coefficient and return to execute steps S204 to S208 until the character recognition result corresponding to the occluded item is the same as any predicted item, and use the reference recognition result as the text recognition result corresponding to the bill image.

3. The financial bill processing method according to claim 2, characterized in that: The text area is a regular rectangular area in the image coordinate system corresponding to the bill image.

4. The financial bill processing method according to claim 2, characterized in that: The method of using a preset correction coefficient to correct the N initial character regions respectively to obtain target character regions corresponding to the N initial character regions respectively includes: For any initial character region, determining a start column and an end column corresponding to the initial character region; Determine the center column and one-side width of the initial character area according to the start column and the end column; Adding the correction coefficient to the unilateral width of the region to obtain a corrected unilateral width; Determining a target character area corresponding to the initial character area according to the center column and the corrected single-side width; All initial character regions are traversed to obtain target character regions corresponding to the N initial character regions respectively.

5. The financial bill processing method according to claim 2, characterized in that: The step of determining a set of S text regions having an associated relationship from the M text regions comprises: Obtain the center coordinate points corresponding to the M text areas respectively; For any two text areas, the actual distance between the two text areas is calculated based on the center coordinate points respectively corresponding to the two text areas; If the actual distance meets a preset condition, it is determined that the two text regions form a text region set.

6. The financial bill processing method according to claim 5, characterized in that: If the actual distance satisfies a preset condition, determining that the two text regions form a text region set includes: Calculating the projection distances corresponding to the two text areas according to the center coordinate points corresponding to the two text areas respectively; Mapping the difference between the actual distance and the projected distance into an adjustment coefficient; Multiplying the adjustment coefficient by the actual distance to obtain a multiplication result; If the multiplication result is less than a preset distance threshold, it is determined that the two text regions form a text region set.

7. The financial bill processing method according to claim 5, characterized in that: The forming of the to-be-verified text by the reference recognition results corresponding to the two text regions in the text region set comprises: According to the horizontal coordinates of the central coordinate points respectively corresponding to the two text areas, the text area corresponding to the smaller horizontal coordinate is used as the front area, and the other text area is used as the back area; The reference recognition result corresponding to the latter region is concatenated to the end of the reference recognition result corresponding to the former region to form the text to be verified.

8. The financial bill processing method according to any one of claims 2 to 7, characterized in that: The occluded text is input into the trained text reconstruction model to predict the occluded item, and several predicted items with the highest prediction probabilities are obtained, including: Inputting the blocked text into a trained text reconstruction model to predict the part of speech of the blocked item to obtain a predicted part of speech; Determine, according to a preset mapping table, the number P of predicted items corresponding to the predicted part of speech, where P is an integer greater than zero; Inputting the blocked text into a trained text reconstruction model to perform term prediction of the blocked item, and obtaining a plurality of predicted terms and their corresponding prediction probabilities; Arrange all predicted terms in descending order of predicted probability to obtain a predicted term sequence; The first P predicted terms in the predicted term sequence are used as the predicted terms.

9. A financial bill processing device based on image processing, characterized in that: The device comprises: An edge detection module is used to obtain an initial image of the bill to be identified, perform edge detection on the initial image, and obtain an edge detection image; A basic image determination module, used to use the edge detection image as a basic image; A closing operation module, used for performing a closing operation on the basic image, and using the closing operation result as a temporary image; A connected domain analysis module, used for performing connected domain analysis on the temporary image to obtain the number of connected domains contained in the temporary image; The bill image determination module is used to update the basic image with the temporary image if the number of connected domains is greater than a preset threshold value, and return to execute steps S103 to S104 until the number of connected domains contained in the temporary image is less than or equal to the preset threshold value, and multiply the temporary image with the initial image point by point, and use the point-by-point multiplication result as the bill image.

10. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the financial document processing method based on image processing as described in any one of claims 1 to 8 is implemented.