Accounting document classification method and system based on image recognition

Through image recognition technology, character area recognition and projection feature analysis are used to solve the problem of unfixed format of accounting vouchers, and efficient classification of accounting vouchers is achieved.

CN119904884AInactive Publication Date: 2025-04-29GUANGZHOU HUASHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411909619.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When the accounting voucher format is not fixed, it is difficult for the prior art to effectively identify the keyword characteristics of accounting vouchers, resulting in a reduction in classification effectiveness.

Method used

Through image acquisition, character area recognition, aspect ratio parameters and horizontal projection map analysis, combined with the vertical projection feature map of the character and the projection blank gap between adjacent characters, character segmentation points are extracted for character segmentation and recognition, character recognition features are obtained, and classification information of accounting vouchers is finally determined.

Benefits of technology

When the format of accounting vouchers is not fixed, the character characteristics of accounting vouchers can be accurately identified, which improves the classification validity and accuracy of accounting vouchers, and avoids missed segmentation and classification errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119904884A_ABST
    Figure CN119904884A_ABST
Patent Text Reader

Abstract

The invention provides an accounting document classification method and system based on image recognition. The method comprises the following steps: acquiring an accounting document image; identifying a character region of each character line in the accounting document image, determining aspect ratio parameters of selected characters in each character region, and extracting a target character region from all the character regions based on all the aspect ratio parameters and the horizontal projection drawing of each character region; determining a projection feature map of the target character region, and extracting all character segmentation points from the projection feature map based on projection blank gaps between adjacent characters in the target character region and projection distribution features of the projection feature map; segmenting according to all the character segmentation points to obtain a plurality of character sub-regions, and identifying character identification features of each character sub-region; and determining the document information of the accounting document through all the character recognition features. According to the scheme, the character features of the accounting document can be identified under the condition that the format of the accounting document is not fixed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and more specifically, to an accounting voucher classification method and system based on image recognition. Background Art

[0002] The rapid growth of data and the demand for automated processing have promoted the vigorous development of image recognition technology, among which character recognition, as a key component, plays an important role. Early character recognition was mainly carried out through template matching, but it had poor adaptability to character deformation and noise. Subsequently, the image content was identified by extracting features such as character strokes and endpoints, but the recognition accuracy for complex handwriting and various font styles is still insufficient. With the development of office automation, the demand for converting paper documents into electronic data has increased. For example, financial statements, accounting vouchers, etc., manual entry is inefficient and prone to errors. Text information also needs to be extracted from images in electronic documents. Therefore, it is becoming increasingly important to recognize different types of text images through character recognition in image recognition.

[0003] In the character recognition of images, character recognition first pre-processes the text image to improve the image quality, and then extracts the key character features, including text information and layout structure, through optical character recognition. Then, the image features are combined with the text information through a multimodal fusion method to improve the accuracy of character recognition. In the classification of accounting vouchers, character recognition methods are usually used to identify the text content in the accounting vouchers, and then the accounting vouchers are classified according to the identified text content. However, when performing character recognition on the accounting voucher image, the format of the accounting voucher is not fixed (the voucher templates of different types or sources vary greatly), including the location of the fields and the layout of the form, which makes it difficult to identify the key character features of the accounting vouchers when extracting key information, especially when there are many types of accounting vouchers, thereby reducing the classification effectiveness of the accounting vouchers. Therefore, how to identify the character features of the accounting vouchers when the format of the accounting vouchers is not fixed, so as to improve the classification effectiveness of the accounting vouchers has become a difficult problem faced by the industry. Summary of the invention

[0004] The present application provides an accounting voucher classification method and system based on image recognition, which can identify key character features of accounting vouchers when the format of accounting vouchers is not fixed, thereby improving the classification effectiveness of accounting vouchers.

[0005] In a first aspect, the present application provides an accounting voucher classification method based on image recognition, comprising the following steps: Perform image acquisition on the accounting vouchers to be classified to obtain accounting voucher images; Identify the character areas of each character row in the accounting document image, determine the aspect ratio parameters of the selected characters in each character area, and extract the target character area of ​​the accounting document when classifying from all the character areas based on all the aspect ratio parameters and the horizontal projection map of each character area; Determine a projection feature map of the target character region when the character is vertically projected, and extract all character segmentation points from the projection feature map based on the projection blank spaces between adjacent characters in the target character region and the projection distribution characteristics of the projection feature map; Performing character segmentation on the target character region according to all character segmentation points to obtain multiple character sub-regions, performing character recognition on each character sub-region to obtain character recognition features of each character sub-region; The voucher information when classifying the accounting voucher is determined through all the character recognition features.

[0006] In some embodiments, identifying the character area of ​​each character row in the accounting document image specifically includes: Performing tilt correction on the accounting voucher image to obtain an accounting voucher corrected image; Marking all character lines in the correction image of the accounting document; A bounding box is extracted for each character row to obtain a character region of each character row.

[0007] In some embodiments, determining the aspect ratio parameter of the selected character in each character area specifically includes: Select a character area as the selected character area; Extract the middle character from the selected character area as the selected character, and extract the circumscribed rectangle of the selected character; Determine the aspect ratio parameter of the selected character in the selected character area by using the circumscribed rectangle; Continue to determine the aspect ratio parameters for the selected characters in the remaining character area.

[0008] In some embodiments, extracting the target character area of ​​the accounting document when classifying from all the character areas based on all the aspect ratio parameters and the horizontal projection diagrams of each character area specifically includes: Determine the horizontal projection of each character area; Extracting the largest aspect ratio parameter from all aspect ratio parameters, and taking the character region corresponding to the largest aspect ratio parameter as the first candidate character region; Extracting a horizontal projection map with the largest projection span from all horizontal projection maps, and taking the character region corresponding to the extracted horizontal projection map as the second candidate character region; When the first candidate character area and the second candidate character area are the same area, the character areas corresponding to the first candidate character area and the second candidate character area are boundary compressed to obtain the target character area when classifying the accounting document; otherwise, the second candidate character area is used as the target character area when classifying the accounting document.

[0009] In some embodiments, determining the horizontal projection map of each character area specifically includes: Select a character area as the selected character area; Binarization is performed on the selected character area to obtain a binary character area, black pixels are counted for each row of pixels in the binary character area to obtain a horizontal projection value of each row of pixels, the horizontal projection value of each row of pixels is used as a vertical axis element, and each horizontal pixel position in the binary character area is used as a horizontal axis element, thereby constructing a horizontal projection map of the selected character area; Continue to determine the horizontal projection of the remaining character areas.

[0010] In some embodiments, performing character recognition on each character sub-region to obtain the character recognition features of each character sub-region specifically includes: Get the pre-trained character recognition model; Selecting a character sub-region as a selected character sub-region, inputting the selected character sub-region as an input parameter into the character recognition model, and having the character recognition model output a character recognition feature of the selected character sub-region; Continue to determine the character recognition features of the remaining character sub-regions, and then obtain the character recognition features of each character sub-region.

[0011] In some embodiments, images of the accounting documents to be classified are captured by a camera.

[0012] In a second aspect, the present application provides an accounting voucher classification system based on image recognition, comprising: A collection module, used for collecting images of accounting documents to be classified to obtain images of accounting documents; A processing module, for identifying character regions of each character row in the accounting document image, determining aspect ratio parameters of selected characters in each character region, and extracting target character regions of the accounting document when classifying from all character regions based on all aspect ratio parameters and horizontal projection images of each character region; The processing module is further used to determine a projection feature map of the target character region when the character is vertically projected, and extract all character segmentation points from the projection feature map based on the projection blank spaces between adjacent characters in the target character region and the projection distribution characteristics of the projection feature map; The processing module is further used to perform character segmentation on the target character region according to all the character segmentation points to obtain multiple character sub-regions, perform character recognition on each character sub-region to obtain character recognition features of each character sub-region; The execution module is used to determine the voucher information when classifying the accounting voucher through all the character recognition features.

[0013] In a third aspect, the present application provides a computer device, comprising a memory and a processor, wherein the memory stores codes, and the processor is configured to obtain the codes and execute the above-mentioned accounting voucher classification method based on image recognition.

[0014] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned accounting voucher classification method based on image recognition is implemented.

[0015] The technical solution provided by the embodiments disclosed in this application has the following beneficial effects: In the accounting voucher classification method and system based on image recognition provided by the present application, first, image acquisition is performed on the accounting voucher to be classified to obtain an accounting voucher image; secondly, the character area of ​​each character row in the accounting voucher image is identified, the aspect ratio parameters of the selected characters in each character area are determined, and the target character area of ​​the accounting voucher when being classified is extracted from all the character areas based on all the aspect ratio parameters and the horizontal projection map of each character area; further, the projection feature map of the target character area when the character is vertically projected is determined, and all the character segmentation points are extracted from the projection feature map based on the projection blank gaps between each adjacent character in the target character area and the projection distribution characteristics of the projection feature map; then, the target character area is segmented according to all the character segmentation points to obtain multiple character sub-areas, and character recognition is performed on each character sub-area to obtain the character recognition features of each character sub-area; finally, the voucher information when the accounting voucher is classified is determined through all the character recognition features.

[0016] It can be seen that the present application can identify the character features of accounting documents when the format of accounting documents is not fixed, thereby improving the classification effectiveness of accounting documents; first, the character areas of each character row in the accounting document image are identified, and the text content at different positions is identified, so as to obtain more document information, thereby avoiding the recognition difficulties caused by the non-fixed format of accounting documents; secondly, based on all aspect ratio parameters and the horizontal projection map of each character area, the target character area of ​​the accounting document when classifying is extracted from all character areas, so as to obtain the characteristic character area of ​​the accounting document when classifying, so as to improve the classification accuracy of accounting documents, thereby avoiding the classification errors caused by the wide variety of accounting documents; further , based on the projected blank spaces between adjacent characters in the target character area and the projected distribution features of the projected feature map, all character segmentation points are extracted from the projected feature map to accurately segment subsequent single characters, thereby avoiding classification errors caused by mis-segmentation of single characters; then, the target character area is segmented according to all the character segmentation points to obtain multiple character sub-areas, and character recognition features of each character sub-area are extracted; finally, the voucher information when classifying the accounting voucher is determined through all the character recognition features; in summary, the technical solution provided by the present application can identify the character features of accounting vouchers when the format of the accounting vouchers is not fixed, thereby improving the classification effectiveness of accounting vouchers. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 is an exemplary flow chart of an accounting document classification method based on image recognition according to some embodiments of the present application; Figure 2 is an exemplary flow chart of determining a character area according to some embodiments of the present application; Figure 3 is an exemplary flow chart of determining a projection feature map according to some embodiments of the present application; Figure 4 is a structural schematic diagram of an accounting voucher classification system based on image recognition according to some embodiments of the present application; Figure 5 It is a structural diagram of a computer device for implementing an accounting document classification method based on image recognition according to some embodiments of the present application. DETAILED DESCRIPTION

[0018] In order to better understand the technical solution of the present application, the technical solution of the present application will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0019] refer to Figure 1, which is an exemplary flow chart of an accounting document classification method based on image recognition according to some embodiments of the present application. The accounting document classification method 100 based on image recognition mainly includes the following steps: In step 101, images of accounting documents to be classified are collected to obtain accounting document images.

[0020] In specific implementation, the image of the accounting voucher to be classified is captured by a camera to obtain an accounting voucher image, which represents an image obtained by photographing the accounting voucher to be classified, and the image contains all the contents of the image to be classified. By capturing the accounting voucher image, conditions are provided for the subsequent content recognition of the accounting voucher.

[0021] It should be noted that in other embodiments, other acquisition sensors may be used to acquire images of accounting documents to be classified, which is not limited here.

[0022] In step 102, the character areas of each character row in the accounting voucher image are identified, the aspect ratio parameters of the selected characters in each character area are determined, and the target character areas of the accounting voucher when being classified are extracted from all the character areas based on all the aspect ratio parameters and the horizontal projection diagram of each character area.

[0023] In some embodiments, reference Figure 2 As shown in FIG. 1 , this figure is an exemplary flow chart of determining a character area according to some embodiments of the present application. In this embodiment, identifying the character area of ​​each character row in the accounting voucher image can be achieved by using the following steps: First, in step 1021, the accounting voucher image is subjected to tilt correction to obtain an accounting voucher corrected image; Then, in step 1022, all character lines in the accounting document correction image are marked; Finally, in step 1023, a bounding box is extracted for each character row to obtain a character region of each character row.

[0024] In the specific implementation, first, the accounting voucher image is tilt-corrected by the Hough transform in image processing to obtain the accounting voucher corrected image; then, all the character rows in the accounting voucher corrected image are marked by the contour detection tool OpenCV; finally, each character row is framed by the sliding window in image processing to obtain the character area of ​​each character row.

[0025] It should be noted that, in this embodiment, the character row represents a row of coherent character strings, which is a string of characters that is highly consistent and does not have line breaks. By determining the character row, the character features of different areas can be effectively distinguished, and the content information in the accounting voucher image can be more effectively extracted; the character area of ​​the character row in this embodiment represents the area where a character row is located, which limits the size of a character row. By determining the character area, the text content at different positions can be effectively identified, and more voucher information can be obtained, thereby avoiding the recognition difficulties caused by the non-fixed format of the accounting voucher.

[0026] In some embodiments, the aspect ratio parameters of the selected characters in each character area may be determined by the following steps, namely: Select a character area as the selected character area; Extract the middle character from the selected character area as the selected character, and extract the circumscribed rectangle of the selected character; Determine the aspect ratio parameter of the selected character in the selected character area by using the circumscribed rectangle; Continue to determine the aspect ratio parameters for the selected characters in the remaining character area.

[0027] In the specific implementation, first, the middle character is extracted from the selected character area as the selected character. In addition, since the character sizes in a character row tend to be consistent, in other embodiments, any character in the selected character area can be extracted as the selected character. By extracting the selected character, the size of the character in the current character area is determined; then, the circumscribed rectangle of the selected character is extracted, that is, the leftmost pixel point on the selected character is obtained and a vertical line is drawn through the pixel point, the rightmost pixel point on the selected character is obtained and a vertical line is drawn through the pixel point, the topmost pixel point on the selected character is obtained and a vertical line is drawn through the pixel point. Draw a horizontal line through the pixel points, obtain the lowest pixel point on the selected character and draw a horizontal line with the pixel point, and then construct the circumscribed rectangle of the selected character from the intersection of each line, the circumscribed rectangle represents the minimum rectangle that frames a single character. In addition, in other embodiments, other extraction methods can be used to extract the circumscribed rectangle of the selected character, which is not limited here; finally, determine the aspect ratio parameter of the selected character in the selected character area through the circumscribed rectangle, that is: calculate the ratio of the longitudinal size and the lateral size of the circumscribed rectangle, and use the ratio calculation result as the aspect ratio parameter of the selected character in the selected character area.

[0028] In specific implementation, the aspect ratio parameters of the selected characters in the remaining character areas can be further determined by the determination method of "determining the aspect ratio parameters of the selected characters in the selected character area by using the circumscribed rectangle", which will not be described in detail here.

[0029] It should be noted that the aspect ratio parameter in the present application represents the ratio between the height and width of a single character, and is used to describe the basic geometric features of the character appearance. By determining the aspect ratio parameter, character areas that do not meet the feature requirements can be effectively excluded to extract specific character areas, thereby improving the recognition accuracy of accounting voucher images.

[0030] In some embodiments, based on all aspect ratio parameters and the horizontal projection diagrams of each character area, the target character area of ​​the accounting document when being classified can be extracted from all character areas by the following steps, namely: Determine the horizontal projection of each character area; Extracting the largest aspect ratio parameter from all aspect ratio parameters, and taking the character region corresponding to the largest aspect ratio parameter as the first candidate character region; Extracting a horizontal projection map with the largest projection span from all horizontal projection maps, and taking the character region corresponding to the extracted horizontal projection map as the second candidate character region; When the first candidate character area and the second candidate character area are the same area, the character areas corresponding to the first candidate character area and the second candidate character area are boundary compressed to obtain the target character area when classifying the accounting document; otherwise, the second candidate character area is used as the target character area when classifying the accounting document.

[0031] In some embodiments, the horizontal projection image of each character area may be determined by the following steps, namely: Select a character area as the selected character area; Binarization is performed on the selected character area to obtain a binary character area, black pixels are counted for each row of pixels in the binary character area to obtain a horizontal projection value of each row of pixels, the horizontal projection value of each row of pixels is used as a vertical axis element, and each horizontal pixel position in the binary character area is used as a horizontal axis element, thereby constructing a horizontal projection map of the selected character area; Continue to determine the horizontal projection of the remaining character areas.

[0032] In a specific implementation, the black pixels in each row of the binary character area are counted to obtain the horizontal projection value of each row of pixels, that is: for each row in the binary character area, the number of black pixels is counted, and the counted number is used as the horizontal projection value, thereby obtaining the horizontal projection value of each row of pixels. In this embodiment, the horizontal projection value represents the value obtained after horizontally projecting the target character area, and the black pixels in this embodiment represent the pixels with a pixel value of 0 in the binary character area.

[0033] It should be noted that the horizontal projection map with the largest projection span is extracted from all the horizontal projection maps. The projection span represents the maximum range of the non-zero part of the horizontal projection value of the target character area in the horizontal projection. The projection span represents the height of the character row in the target character area. The projection span can be obtained by processing the horizontal projection map through OpenCV in the image processing tool, which will not be repeated here.

[0034] It should also be noted that the horizontal projection map in the present application represents a map obtained by projecting the character area in the horizontal direction. By determining the horizontal projection map, the upper and lower boundaries of the characters in the character area can be effectively extracted, thereby further narrowing the recognition range of the character area and improving the recognition accuracy of the character content.

[0035] In a specific implementation, the character areas corresponding to the first candidate character area and the second candidate character area are subjected to boundary compression to obtain the target character area of ​​the accounting voucher when being classified, that is, the horizontal projection image of the character area is extracted, and the point with the leftmost horizontal projection value of 0 and the point with the rightmost horizontal projection value of 0 in the horizontal projection image are extracted, and the upper and lower boundaries of the character area are cut by the two extracted points, and the cut area is used as the target character area of ​​the accounting voucher when being classified. In addition, in other embodiments, other boundary compression methods can be used to compress the target character area of ​​the accounting voucher when being classified.

[0036] It should be noted that when the first candidate character area and the second candidate character area are not the same area, it means that there is a certain error in the area recognition at this time. Therefore, the second candidate character area can be used as the target character area, that is, the character area with the largest character height can be used as the target character area.

[0037] It should be noted that the target character area in the present application represents the character area of ​​interest in the accounting voucher image. By identifying the target character area, the location of the key information of the accounting voucher can be accurately located to avoid extracting irrelevant image content. For example, in an accounting voucher image, the character area of ​​the amount column can be accurately found, so that the amount data can be extracted more accurately, reducing data errors caused by misextraction of other areas (such as irrelevant numbers or text on the edge of the voucher). In the classification of accounting vouchers, the versions of accounting vouchers are usually inconsistent, making the classification of accounting vouchers difficult. However, different versions of accounting vouchers have a common feature, that is, the subject characters of the accounting voucher are larger than other characters. For example, the size of the subject characters of "income voucher", "expenditure voucher" and "transfer voucher" are larger than the size of other characters. Therefore, the present application extracts the area with the largest character size from all character areas through the aspect ratio parameter and the horizontal projection map of the character area as the target character area when classifying the accounting voucher, which can effectively improve the classification accuracy of the accounting voucher.

[0038] In step 103, a projection feature map of the target character region when the character is vertically projected is determined, and all character segmentation points are extracted from the projection feature map based on the projection blank spaces between adjacent characters in the target character region and the projection distribution characteristics of the projection feature map.

[0039] In some embodiments, reference Figure 3 As shown in FIG. 1 , this figure is an exemplary flow chart of determining a projection feature map according to some embodiments of the present application. In this embodiment, determining a projection feature map of a target character area when the character is vertically projected can be implemented by the following steps: First, in step 1031, the target character region is binarized to obtain a binarized character image; Next, in step 1032, all vertical pixel positions of the binary character image are obtained; Then, in step 1033, for each vertical pixel position, black pixel statistics are performed on pixels in a column corresponding to the vertical pixel position from the binary character image, thereby obtaining a vertical projection value corresponding to each vertical pixel position; Finally, in step 1034, each vertical pixel position is used as a horizontal coordinate element, and the vertical projection value corresponding to each vertical pixel position is used as a vertical coordinate element, thereby constructing a projection feature map of the target character area when the character is vertically projected.

[0040] It should be noted that, in this embodiment, the vertical pixel position represents the position of the pixel point in the vertical direction of the image; the vertical projection value in this embodiment represents the horizontal projection value of the pixel point in the vertical direction of the image; the black pixel in this embodiment represents a pixel with a pixel value of 0 in the binary character image; the projection feature map in this application represents the map obtained after vertically projecting the target character area, which is used to measure the distribution of characters in the target character area in the vertical direction.

[0041] In some embodiments, all character segmentation points are extracted from the projection feature map based on the projection blank spaces between adjacent characters in the target character region and the projection distribution characteristics of the projection feature map, specifically by the following steps, namely: Determine the projected blank space between each adjacent character in the target character area; Determining a projection distribution feature of the projection feature map; Determine the segmentation intervals between characters in the target character area based on the projection distribution characteristics; For each adjacent character, the distance value between the adjacent characters is determined by the corresponding projected blank gap, and the distance value is mapped to the segmentation interval. If the distance value is within the segmentation interval, the distance value is used as the segmentation scale between the adjacent characters. Otherwise, the distance value is not used as the segmentation scale between the adjacent characters, thereby obtaining the segmentation scale between each adjacent character; The vertical pixel positions corresponding to the two end points of each segmentation scale are taken as character segmentation points, and then all character segmentation points are obtained.

[0042] In a specific implementation, the projected blank gaps between adjacent characters in the target character area are determined, that is, a projection feature map of the target character area is obtained, each column of pixels in the projection feature map is traversed, and the vertical projection value of each column of pixels is recorded. When the vertical projection value is 0, the column is used as a projection blank gap, otherwise, it is not used as a projection blank gap, thereby obtaining the projected blank gaps between adjacent characters. The projected blank gaps between adjacent characters include single projection blank gaps and combined projection blank gaps (a combination of two or more consecutive projection blank gaps). In this embodiment, the projection blank gap represents a blank area projected between adjacent characters. By determining the projection blank gaps, the intervals between characters in the target character area can be effectively identified, thereby further distinguishing single characters to improve the recognition accuracy of character content in the target character area.

[0043] In a specific implementation, the projection distribution characteristics of the projection feature map are determined, that is, the vertical pixel positions in the projection feature map whose vertical projection values ​​are not 0 are extracted, the interval lengths between the extracted adjacent vertical pixel positions are determined, all the interval lengths are obtained, interference is removed from all the interval lengths, the remaining interval lengths are obtained, and the remaining interval lengths are combined into the projection distribution characteristics of the projection feature map.

[0044] In specific implementation, the interval length between each adjacent vertical pixel position extracted can be determined by Euclidean distance, which will not be repeated here; all interval lengths can be interfered with by the standard deviation method in the prior art to obtain the remaining interval length, which will not be repeated here.

[0045] It should be noted that, in this embodiment, the interval length represents the distance between two pixels; the projection distribution feature in this application represents a combination of effective interval values ​​between characters in the target character area. In accounting documents, there are similar intervals between characters, and the interval between each adjacent character varies little, showing a uniform interval distribution. However, in the vertical projection of the characters, some characters with left and right structures will have a small interval in the middle, which causes interference in all the recognized character intervals. By removing interference from all the recognized character intervals, an effective character interval recognition value can be obtained. Therefore, by determining the projection distribution feature, the segmentation accuracy of a single character can be effectively improved.

[0046] In specific implementation, the segmentation intervals between characters in the target character area are determined based on the projection distribution features, that is: the minimum interval length in the projection distribution features is extracted as the lower limit value of the segmentation interval, and the maximum interval length in the projection distribution features is extracted as the upper limit value of the segmentation interval, thereby obtaining the segmentation intervals between characters in the target character area. In addition, in other embodiments, other methods can be used to obtain the segmentation intervals between characters in the target character area, which are not limited here. In this embodiment, the segmentation interval represents the effective length range of the segmentation between characters in the target character area. By determining the segmentation interval, mis-segmentation can be effectively avoided.

[0047] It should be noted that the segmentation scale in this embodiment represents the segmentation length between adjacent characters. In addition, in this embodiment, the two endpoints of the segmentation scale are the left endpoint and the right endpoint of the segmentation scale, which will not be described in detail here.

[0048] It should also be noted that the character segmentation point in the present application represents the point at which the characters in the target character area are segmented. In accounting documents, there are similar intervals between characters, and the intervals between each adjacent character vary little, showing a uniform interval distribution. However, in the segmentation of characters through vertical projection, some left-right structured characters will have a small interval in the middle, which causes interference in the intervals of all recognized characters. Therefore, by effectively determining the character segmentation point, the mis-segmentation of a single character can be avoided, and the key character features of the accounting document can be identified when the accounting document format is not fixed.

[0049] In step 104, character segmentation is performed on the target character region according to all the character segmentation points to obtain a plurality of character sub-regions, and character recognition is performed on each character sub-region to obtain a character recognition feature of each character sub-region.

[0050] In some embodiments, character segmentation is performed on the target character region according to all character segmentation points to obtain multiple character sub-regions by specifically adopting the following steps, namely: The corresponding positions of the target character region are segmented from left to right using the coordinate information of each character segmentation point, thereby obtaining the character sub-regions corresponding to each character.

[0051] It should be noted that the character sub-region in the present application represents the region where a single character is located. By determining the character sub-region, the character features of a single character can be effectively extracted, and then the representation content of the character can be identified, thereby providing conditions for the classification of accounting documents.

[0052] In some embodiments, character recognition is performed on each character sub-region to obtain the character recognition features of each character sub-region by specifically adopting the following steps, namely: Get the pre-trained character recognition model; Selecting a character sub-region as a selected character sub-region, inputting the selected character sub-region as an input parameter into the character recognition model, and having the character recognition model output a character recognition feature of the selected character sub-region; Continue to determine the character recognition features of the remaining character sub-regions, and then obtain the character recognition features of each character sub-region.

[0053] In the specific implementation, the pre-trained character recognition model is a character matching model, which stores all types of characters related to accounting documents. The character matching model measures the similarity between the stored characters of each type and the characters in the input character sub-region to identify the most similar characters as the character recognition features of the character region, which will not be repeated here. In addition, in other embodiments, other characters can also be used to identify each character sub-region by the model, which is not limited here.

[0054] In specific implementation, the character recognition features of the remaining character sub-regions can be continuously determined by the determination method of "taking the selected character sub-region as an input parameter and inputting it into the character recognition model, and the character recognition model outputs the character recognition features of the selected character sub-region", which will not be elaborated here.

[0055] It should be noted that in this application, the character recognition feature represents an attribute feature used to distinguish character structures, that is, the character structure feature obtained after recognizing the character sub-region. That is, one character recognition feature corresponds to one character content. In the process of classifying accounting vouchers, by recognizing the character features in the accounting voucher image, the character content of the accounting voucher can be effectively obtained, so as to accurately classify the accounting voucher according to the character content.

[0056] It should also be noted that in this application, character recognition represents the process of recognizing character structure features. Among them, character recognition is performed on each character sub-region, that is: obtaining a pre-trained character recognition model; selecting a character sub-region as the selected character sub-region, taking the selected character sub-region as an input parameter and inputting it into the character recognition model, and the character recognition model outputs the character recognition features of the selected character sub-region; continuing to determine the character recognition features of the remaining character sub-regions, and then obtaining the character recognition features of each character sub-region, that is, completing the character recognition of each character sub-region.

[0057] In step 105, the voucher information for classifying the accounting voucher is determined through all the character recognition features.

[0058] In specific implementation, the voucher information for classifying the accounting voucher is determined through all the character recognition features, that is: arranging the character contents corresponding to each character recognition feature in sequence to obtain the voucher information for classifying the accounting voucher. For example, there are multiple character recognition features including: "receipt", "voucher", "income", "certificate", then arranging the character contents corresponding to each character recognition feature in sequence, the voucher information for classifying the accounting voucher obtained is: "income voucher", and then setting the classification label of the accounting voucher as "income" type voucher.

[0059] It should be noted that in this application, the voucher information represents the key classification and recognition features in the accounting voucher. By determining the voucher information, the category of the accounting voucher can be accurately divided.

[0060] In addition, on the other hand of this application, in some embodiments, this application provides an accounting voucher classification system based on image recognition. Refer to Figure 4, which is a structural diagram of an accounting voucher classification system based on image recognition according to some embodiments of the present application. The accounting voucher classification system based on image recognition 200 includes: a collection module 201, a processing module 202 and an execution module 203, which are described as follows: The acquisition module 201 in this application is mainly used to acquire images of accounting documents to be classified to obtain images of accounting documents; The processing module 202 in the present application is mainly used to identify the character area of ​​each character row in the accounting document image, determine the aspect ratio parameters of the selected characters in each character area, and extract the target character area of ​​the accounting document when classifying from all the character areas based on all the aspect ratio parameters and the horizontal projection map of each character area; The processing module 202 is further used to determine a projection feature map of the target character region when the character is vertically projected, and extract all character segmentation points from the projection feature map based on the projection blank spaces between adjacent characters in the target character region and the projection distribution characteristics of the projection feature map; In addition, the processing module 202 is further used to perform character segmentation on the target character region according to all the character segmentation points to obtain a plurality of character sub-regions, perform character recognition on each character sub-region to obtain a character recognition feature of each character sub-region; Execution module 203, in the present application, execution module 203 is mainly used to determine the voucher information when classifying the accounting voucher through all character recognition features.

[0061] In addition, the present application also provides a computer device, which includes a memory and a processor, the memory stores a code, and the processor is configured to obtain the code and execute the above-mentioned accounting voucher classification method based on image recognition.

[0062] In some embodiments, reference Figure 5 , which is a schematic diagram of the structure of a computer device that applies an accounting document classification method based on image recognition according to some embodiments of the present application. The accounting document classification method based on image recognition in the above embodiment can be Figure 5 The computer device 300 shown in the figure is implemented, and the computer device 300 includes at least one processor 301, a communication bus 302, a memory 303 and at least one communication interface 304.

[0063] Processor 301 can be a general-purpose central processing unit (CPU), or an application-specific integrated circuit (ASIC) or one or more for controlling the execution of the accounting document classification method based on image recognition in the present application.

[0064] The communication bus 302 may be used to transmit information between the above-mentioned components.

[0065] The memory 303 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compressed optical disc, a laser disc, an optical disc, a digital versatile disc, a Blu-ray disc, etc.), a magnetic disk or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 303 may exist independently and be connected to the processor 301 via the communication bus 302. The memory 303 may also be integrated with the processor 301.

[0066] The memory 303 is used to store the program code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the program code stored in the memory 303. The program code may include one or more software modules. The determination of the accounting voucher classification method based on image recognition in the above embodiment can be implemented by the processor 301 and one or more software modules in the program code in the memory 303.

[0067] The communication interface 304 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.

[0068] In a specific implementation, as an embodiment, a computer device may include multiple processors, each of which may be a single-CPU processor or a multi-CPU processor. The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0069] The above-mentioned computer device may be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the computer device may be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device or an embedded device. The embodiment of the present application does not limit the type of computer device.

[0070] In addition, the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned accounting voucher classification method based on image recognition.

[0071] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0072] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. An accounting voucher classification method based on image recognition, characterized in that: The steps include: Perform image acquisition on the accounting vouchers to be classified to obtain accounting voucher images; Identify the character areas of each character row in the accounting document image, determine the aspect ratio parameters of the selected characters in each character area, and extract the target character area of ​​the accounting document when classifying from all the character areas based on all the aspect ratio parameters and the horizontal projection map of each character area; Determine a projection feature map of the target character region when the character is vertically projected, and extract all character segmentation points from the projection feature map based on the projection blank spaces between adjacent characters in the target character region and the projection distribution characteristics of the projection feature map; Performing character segmentation on the target character region according to all character segmentation points to obtain multiple character sub-regions, performing character recognition on each character sub-region to obtain character recognition features of each character sub-region; The voucher information when classifying the accounting voucher is determined through all the character recognition features.

2. The method according to claim 1, characterized in that Identifying the character area of ​​each character row in the accounting voucher image specifically includes: Performing tilt correction on the accounting voucher image to obtain an accounting voucher corrected image; Marking all character lines in the correction image of the accounting document; A bounding box is extracted for each character row to obtain a character region of each character row.

3. The method according to claim 1, characterized in that Determining the aspect ratio parameters of the selected characters in each character area specifically includes: Select a character area as the selected character area; Extract the middle character from the selected character area as the selected character, and extract the circumscribed rectangle of the selected character; Determine the aspect ratio parameter of the selected character in the selected character area by using the circumscribed rectangle; Continue to determine the aspect ratio parameters for the selected characters in the remaining character area.

4. The method according to claim 1, characterized in that The target character area for classifying the accounting document is extracted from all the character areas based on all the aspect ratio parameters and the horizontal projection diagram of each character area, and specifically includes: Determine the horizontal projection of each character area; Extracting the largest aspect ratio parameter from all aspect ratio parameters, and taking the character region corresponding to the largest aspect ratio parameter as the first candidate character region; Extracting a horizontal projection map with the largest projection span from all horizontal projection maps, and taking the character region corresponding to the extracted horizontal projection map as the second candidate character region; When the first candidate character area and the second candidate character area are the same area, the character areas corresponding to the first candidate character area and the second candidate character area are boundary compressed to obtain the target character area when classifying the accounting document; otherwise, the second candidate character area is used as the target character area when classifying the accounting document.

5. The method according to claim 4, characterized in that Determining the horizontal projection map of each character area specifically includes: Select a character area as the selected character area; Binarization is performed on the selected character area to obtain a binary character area, black pixels are counted for each row of pixels in the binary character area to obtain a horizontal projection value of each row of pixels, the horizontal projection value of each row of pixels is used as a vertical axis element, and each horizontal pixel position in the binary character area is used as a horizontal axis element, thereby constructing a horizontal projection map of the selected character area; Continue to determine the horizontal projection of the remaining character areas.

6. The method according to claim 1, characterized in that Performing character recognition on each character sub-region to obtain the character recognition features of each character sub-region specifically includes: Get the pre-trained character recognition model; Selecting a character sub-region as a selected character sub-region, inputting the selected character sub-region as an input parameter into the character recognition model, and having the character recognition model output a character recognition feature of the selected character sub-region; Continue to determine the character recognition features of the remaining character sub-regions, and then obtain the character recognition features of each character sub-region.

7. The method according to claim 1, characterized in that The image of the accounting documents to be classified is collected through the camera.

8. An accounting voucher classification system based on image recognition, characterized in that: include: A collection module, used for collecting images of accounting documents to be classified to obtain images of accounting documents; A processing module, for identifying character regions of each character row in the accounting document image, determining aspect ratio parameters of selected characters in each character region, and extracting target character regions of the accounting document when classifying from all character regions based on all aspect ratio parameters and horizontal projection images of each character region; The processing module is further used to determine a projection feature map of the target character region when the character is vertically projected, and extract all character segmentation points from the projection feature map based on the projection blank spaces between adjacent characters in the target character region and the projection distribution characteristics of the projection feature map; The processing module is further used to perform character segmentation on the target character region according to all the character segmentation points to obtain multiple character sub-regions, perform character recognition on each character sub-region to obtain character recognition features of each character sub-region; The execution module is used to determine the voucher information when classifying the accounting voucher through all the character recognition features.

9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores codes, and the processor is configured to obtain the codes and execute the accounting document classification method based on image recognition as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the accounting document classification method based on image recognition as described in any one of claims 1 to 7 is implemented.