Fiscal Bill Classification and Detection System Based on Image Recognition

By differentiating the bill image and using edge detection and adaptive filtering technology, the problem of poor enhancement effect of bill image is solved, and the precise classification and recognition of bills is achieved.

CN120148058BActive Publication Date: 2025-08-05CHONGQING BAIWANG JIUFU SOFTWARE SERVICE CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510621677.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-15
Publication Date
2025-08-05
Estimated Expiration
2045-05-15

AI Technical Summary

Technical Problem

The prior art cannot perform differentiated optimization for different areas in the bill image, resulting in poor image enhancement effect and affecting the accuracy of bill classification.

Method used

The initial image is obtained through the image acquisition module, the expansion area determination module performs edge detection and expands non-linear edges, the expansion area classification module calculates the effective probability and divides the area, the detection module enhances the effective area contrast and adapts to filter the invalid area, and uses the pre-trained classification detection model to identify the ticket type.

Benefits of technology

It realizes the precise classification of ticket images, improves the image enhancement effect, enhances the contrast between fields and invalid information, and improves the accuracy of subsequent recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120148058B_ABST
    Figure CN120148058B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and more specifically, to a fiscal and tax bill classification and detection system based on image recognition. The system comprises: an image acquisition module for acquiring an initial image; an expansion region determination module for performing a horizontal expansion operation on non-linear edges in the initial image to obtain each expansion region; an expansion region classification module for dividing the expansion region into valid regions and invalid regions based on the probability that each expansion region is a field edge region; and a detection module for increasing the grayscale contrast within each valid region and filtering each invalid region to obtain a target image, thereby identifying the bill type based on the detection results of the target image using a pre-trained classification detection model. The present invention improves the image enhancement effect by enhancing the contrast of valid information in the bill image and reducing the interference of invalid information, providing an accurate image foundation for bill classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and more particularly to a fiscal and tax bill classification and detection system based on image recognition. Background Art

[0002] In the digital economy, the digital management of fiscal and tax invoices has become a core component for businesses and government agencies to improve operational efficiency and optimize resource allocation. As digital transformation deepens, businesses must efficiently classify, detect, and identify massive volumes of fiscal and tax invoices to support financial accounting, tax compliance, and intelligent decision-making. However, the key prerequisite for digitizing invoices is obtaining high-quality image data. However, the image quality of original invoices often degrades due to the acquisition environment (such as uneven lighting and equipment noise) or physical condition (such as stains and wrinkles). This can manifest as defects such as blurred text, background noise, and insufficient local contrast.

[0003] At present, the preprocessing technology for bill images mainly relies on traditional filtering algorithms (such as mean filtering and Gaussian filtering) and contrast enhancement methods (such as gamma transform and histogram equalization). However, when suppressing noise, traditional filtering algorithms can easily cause blurred edges of key bill information (such as small-size text and digital symbols), reducing the accuracy of subsequent optical character recognition (OCR). Although enhancement technologies such as gamma transform can improve the distinction between text and background, they will simultaneously amplify invalid information on the bill surface (such as stains and scratches), and even introduce artifacts, exacerbating image semantic noise.

[0004] Existing methods mostly use fixed parameters or global operations, which makes it difficult to perform differentiated optimization based on the characteristics of different regions in the bill image (such as text-dense areas and blank background areas), resulting in local imbalance in the enhancement effect. Summary of the Invention

[0005] In order to solve the problem that it is impossible to perform differentiated optimization for different areas in bill images, resulting in poor bill image enhancement and thus affecting the accuracy of bill classification results, the present invention provides a fiscal and tax bill classification detection system based on image recognition. The system includes:

[0006] The image acquisition module is used to acquire the front image of the bill to be classified and perform grayscale processing to obtain the initial image;

[0007] The expansion region determination module is used to perform edge detection on the initial image and perform horizontal expansion operations on the non-straight edges in the detection results to obtain the expansion regions of each non-straight edge;

[0008] The expansion region classification module is used to select the target expansion region. Based on the various different characteristics of the field edge and the defect edge, the effective probability of the target expansion region is calculated. By comparing the effective probability with the preset value, all expansion regions are divided into effective regions and invalid regions. The effective probability represents the probability that the target expansion region is the region where the field edge is located.

[0009] The detection module is used to increase the grayscale contrast of each valid area through gamma transformation based on the effective probability of each valid area, and adaptively adjust the filter window to perform mean filtering on each invalid area. The filter window size is negatively correlated with the effective probability of the corresponding invalid area, so as to input the obtained target image into the pre-trained classification detection model and identify the bill type according to the output text area and content.

[0010] The present invention can accurately distinguish between the areas where fields are located and the areas where defects are located in the bill image, thereby providing accurate data support for the differentiated optimization of different areas in the bill image, and by increasing the contrast of the grayscale within each valid area, it can increase the contrast between valid information and other information. By adaptively adjusting the filter window, each invalid area is mean filtered, which can effectively filter out the invalid information and improve the image enhancement effect, so that the accurate classification of the bill image can be achieved based on the enhanced target image.

[0011] Preferably, the method for obtaining the effective probability of the target expansion area includes:

[0012] Calculate the first index of the target expansion area : Where, is the area of the edge of the target expansion region; is the area of the target expansion region; is the median length of all edges in the target expansion area; is the width of the bounding rectangle of the target expansion area; is the information entropy of the target expansion area;

[0013] The width of the bounding rectangle of the target expansion area is extended from both ends, and the newly added area is used as the expansion area. A second index of the target expansion area is calculated. The second index is positively correlated with the difference in information entropy between the target expansion area and the expansion area, and negatively correlated with the width of the bounding rectangle and the degree of deviation from the overall level. The average of the first and second indexes is used as the effective probability of the target expansion area.

[0014] The present invention integrates multiple difference characteristics of field edges and defect edges, calculates the effective probability of each expansion area, and ensures the accuracy of the calculation results.

[0015] Preferably, the method for obtaining the second indicator of the target expansion area includes:

[0016] Calculate the difference between the width of the bounding rectangle of the target expansion area and the median of the widths of the bounding rectangles of all expansion areas, and normalize the difference to obtain the degree of deviation between the width of the bounding rectangle of the target expansion area and the overall level;

[0017] The difference between 1 and the degree of deviation is calculated, and the difference is multiplied by the difference in information entropy between the target expansion area and the expansion area to obtain a second indicator of the target expansion area.

[0018] Preferably, the method for obtaining the information entropy of the target expansion area or the extended area includes:

[0019] The target expansion area or extended area is divided into several square sub-areas with a set width. The information entropy of the target expansion area or extended area is calculated based on the probability of the number of edge pixels in all sub-areas taking different values and the information entropy calculation formula.

[0020] Preferably, based on the effective probability of each effective area, increasing the contrast of the grayscale inside each effective area by gamma transformation includes:

[0021] The sum of the effective probability of each effective area and 1 is used as a weight to weight the preset gamma coefficient to obtain an updated gamma coefficient for each effective area;

[0022] The updated gamma coefficient is used to adjust the grayscale value of the pixels in each valid area through gamma transformation.

[0023] The present invention can enhance the contrast of the grayscale inside the effective area with a larger effective probability to a greater extent, thereby ensuring the highest contrast between the field and other information.

[0024] Preferably, the filter window is adaptively adjusted to satisfy the following relationship:

[0025] ;

[0026] Where, For the The width of the adaptive filtering window of the invalid area; For the The effective probability of an invalid area; is the preset initial filter window width; The preset magnification factor; is the ceiling function.

[0027] The present invention sets a larger filtering window for an invalid area with a low validity probability, which can smooth the invalid information to a greater extent, thereby reducing the interference of the invalid information.

[0028] Preferably, the horizontal acquisition method includes:

[0029] Hough line detection is performed on the initial image, and all detected straight line edges with a length greater than a preset length are clustered based on the slope, so that the straight line direction corresponding to the cluster center of the category with the smaller average slope is used as the horizontal direction, and the straight line direction corresponding to the cluster center of the other category is used as the vertical direction.

[0030] Preferably, the method for obtaining a non-straight edge includes:

[0031] Obtain all edges obtained by edge detection on the initial image, and all straight line edges obtained by Hough line detection on the initial image;

[0032] All edges except straight edges are defined as non-straight edges.

[0033] The present invention filters non-straight edges in order to remove invalid information such as boundary lines in bill images, thereby improving edge analysis efficiency.

[0034] Preferably, the length direction of the circumscribed rectangle of the target expansion area is parallel to the horizontal direction, and the width direction is parallel to the vertical direction.

[0035] Preferably, the classification detection model is an algorithm model that combines the target detection model of YOLOv10 with the OCR recognition model.

[0036] The present invention has the following effects:

[0037] The present invention utilizes the distribution characteristics of fields (i.e., fields are usually distributed row by row in a bill image) to perform a horizontal expansion operation on each non-straight edge, which can ensure that all fields are found. Subsequently, the probability of each expanded area being a field edge is calculated by utilizing multiple difference characteristics of field edges and defect edges, and valid areas and invalid areas are distinguished, which can achieve the distinction between field areas and defect areas. Then, the grayscale contrast within the valid area is increased, which can increase the contrast between the field and other information. Mean filtering is performed on each invalid area, which can effectively smooth the invalid information, thereby improving the enhancement effect of the initial image, providing an accurate image basis for subsequent bill type recognition, and further achieving accurate bill classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an illustrative and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0039] Figure 1 It is a structural diagram of a fiscal and tax bill classification and detection system based on image recognition according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.

[0041] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0042] Reference Figure 1 The fiscal and tax bill classification and detection system 100 based on image recognition includes an acquisition module 110, an expansion region determination module 120, an expansion region classification module 130, and a detection module 140, specifically as follows:

[0043] The acquisition module 110 is used to acquire the front image of the bill to be classified and perform grayscale processing to obtain an initial image.

[0044] Specifically, you can use a high-resolution scanner (recommended ≥300dpi), a digital camera, or a mobile phone camera to capture the front image of the bill to be classified, which is laid out on a solid color background (such as white). The four corners of the bill must be aligned with the edge of the picture. Use the weighted average method or the average method to merge the RGB three channels of the collected color image into a single-channel grayscale image to obtain the initial image.

[0045] It should be noted that the process of grayscale processing by weighted average method and average method is a prior art and will not be described in detail in this embodiment.

[0046] The expansion region determination module 120 is configured to perform edge detection on the initial image and perform a horizontal expansion operation on the non-linear edges in the detection result to obtain the expansion region of each non-linear edge.

[0047] It should be noted that information on bills often appears as edges in bill images. By performing edge detection on the initial image, all information on the bill can be obtained. Straight edges are typically the boundaries of the bill. Therefore, the present invention only analyzes non-straight edges, improving edge analysis efficiency while extracting key text information from bill images.

[0048] It should be further explained that, since the text information in the bill is usually distributed horizontally in rows, and the distance between words in the same field is small, and each field can be contained in a rectangular frame, and the invalid information in the bill (such as stains, scratches and other defects) does not have the above characteristics, the present invention can surround the same field with a rectangular frame by performing a horizontal expansion operation on each non-straight edge. Afterwards, the rectangular frames can be classified based on the difference characteristics of the field edge and the defect edge to accurately distinguish the area where the field edge is located and the area where the defect edge is located, providing a data basis for subsequent operations.

[0049] In an exemplary embodiment of the present invention, the horizontal direction can be determined by the following steps:

[0050] Hough line detection is performed on the initial image, and all detected straight line edges with a length greater than a preset length are clustered based on the slope, so that the straight line direction corresponding to the cluster center of the category with the smaller average slope is used as the horizontal direction, and the straight line direction corresponding to the cluster center of the other category is used as the vertical direction.

[0051] It should be noted that since the slope in the horizontal direction is zero and the slope in the vertical direction is close to 90 degrees, the direction of the line corresponding to the cluster center of the category with the smaller average slope is used as the horizontal direction of the initial image, and the direction of the line corresponding to the cluster center of the other category is used as the vertical direction of the initial image, which can achieve accurate distinction of the plane direction. The process of Hough line detection is a prior art and will not be described in detail in this embodiment.

[0052] For example, the preset length can be set to Where, is the width of the initial image (i.e. the length in the vertical direction).

[0053] In an exemplary embodiment of the present invention, the determination of non-straight edges in the initial image can be achieved by the following steps:

[0054] All edges obtained by performing edge detection on the initial image and all straight line edges obtained by performing Hough line detection on the initial image are obtained; all edges except the straight line edges among all the edges are defined as non-straight line edges.

[0055] For example, the Canny edge detection algorithm, Sobel edge detection, etc. can be used to perform edge detection on the initial image to obtain all edges in the initial image. Then, among all the edges obtained, the edges except all the straight edges detected by the Hough line are regarded as non-straight edges, so that the edges of the boundary lines in the bill image can be eliminated, reducing the number of edge analyses, so that the analysis efficiency of subsequent operations can be improved.

[0056] Next, the process of determining the expansion area of each non-linear edge is described in detail:

[0057] First, a template of appropriate size (also called a structural element, a professional term in image expansion) is selected, such as a rectangle with a length of 3 and a width of 1, and the number of expansion operation iterations is set according to the empirical value (such as 5 times); then, the template is used to scan each pixel point in any non-straight edge. If there is at least one pixel value of 1 in the area covered by the template, the pixel value of the corresponding pixel point is set to 1, thereby expanding the highlighted area and achieving the expansion effect. This process is repeated until the set number of iterations is reached, and the expansion area of each non-straight edge is obtained.

[0058] It should be noted that, since the present invention only needs to perform a horizontal expansion operation on each non-linear edge, the present invention sets the width of the template to 1.

[0059] The expansion region classification module 130 is used to select a target expansion region, calculate the effective probability of the target expansion region based on various different characteristics between the field edge and the defect edge, and divide all expansion regions into effective regions and invalid regions by comparing the effective probability with a preset value. The effective probability represents the probability that the target expansion region is the region where the field edge is located.

[0060] The target expansion region refers to an expansion region randomly selected from all expansion regions determined by module 120 .

[0061] In an exemplary embodiment of the present invention, the determination of the effective probability of the target expansion area can be achieved by the following steps:

[0062] Step 1: Calculate the first index of the target expansion area;

[0063] The first indicator is a parameter used to measure the possibility that the target expansion area is the area where the field edge is located.

[0064] Specifically, the first index of the target expansion area satisfies the following relationship:

[0065] ;

[0066] Where, It is the first indicator of the target expansion area; is the area of the edge of the target expansion region; is the area of the target expansion region; is the median length of all edges in the target expansion area; is the width of the bounding rectangle of the target expansion area; is the information entropy of the target expansion area, which reflects the degree of disorder of the edge pixel distribution in the target expansion area.

[0067] The area of the edge within the target expansion region can be represented by the number of all edge pixels within the target expansion region.

[0068] It reflects the density of the edges in the target expansion area. The larger the value, the denser the edge distribution in the target expansion area, which further indicates that the target expansion area is more likely to be the area where the field edge is located, and the corresponding first index is relatively larger.

[0069] It should be noted that the longest edge length in a character is usually 4 times the width of the character, while the length of the defect edge is relatively random. Therefore, the present invention uses this feature to calculate The larger the value, the more the edge in the target expansion area conforms to the characteristics of the text edge, which further indicates that the target expansion area is more likely to be the area where the field edge is located, and the corresponding first index is relatively large. Among them, the 4 times here is a general rule found when extracting the text edge in the intact bill image. Of course, according to the specific situation, the first index can also be determined by calculating the ratio of the longest edge of the text in the corresponding image to the width of the corresponding text. and The numbers in the relationship.

[0070] It's important to note that the edges of text or numbers within a field are typically complex and rich, resulting in a more chaotic distribution of field edges. Defects in bill images, such as stains, scratches, and patches, have fewer edges and are less chaotic than text or numbers. Information entropy is a metric that assesses the degree of chaotic information distribution. Therefore, a higher information entropy in the target expansion area indicates a higher likelihood that the target expansion area is located at a field edge, and the corresponding first indicator is higher.

[0071] In an exemplary embodiment of the present invention, the information entropy of the target expansion area may be determined by the following steps:

[0072] The target expansion area is divided into several square sub-areas with a set width. The information entropy of the target expansion area is calculated based on the probability of the number of edge pixels in each sub-area taking different values and the information entropy calculation formula.

[0073] For example, the target expansion region may be divided into a number of square sub-regions with a width of 4, and then the information entropy of the target expansion region is calculated. Specifically, the information entropy of the target expansion region satisfies the following relationship:

[0074] ;

[0075] Where, is the information entropy of the target expansion area; The number of edge pixels in all sub-regions of the target expansion region is probability; is a logarithmic function; is the summation symbol.

[0076] It should be noted that, since the present invention divides the target expansion area into several square sub-areas with a width of 4, that is, each sub-area contains 16 pixels, when calculating the information entropy of the target expansion area, 16 in the calculation formula is the number of pixels in the sub-area.

[0077] Step 2: Extend the width of the bounding rectangle of the target expansion area from both ends, use the newly added area as the extended area, and calculate the second index of the target expansion area. The second index is positively correlated with the difference in information entropy between the target expansion area and the extended area, and negatively correlated with the width of the bounding rectangle and the degree of deviation from the overall level.

[0078] The second indicator refers to a parameter determined in combination with the surrounding area and capable of measuring the possibility that the target expansion area is the area where the field edge is located.

[0079] In an exemplary embodiment of the present invention, the length direction of the circumscribed rectangle of the target expansion area is parallel to the horizontal direction, and the width direction is parallel to the vertical direction.

[0080] Next, the process of determining the extension area is described:

[0081] Keeping the centroid and length of the circumscribed rectangle of the target expansion area unchanged, increase the width of the circumscribed rectangle by 0.2 times the width on both sides to obtain a rectangular area with the same length and 1.4 times the width of the original rectangle. The area within the new rectangular area, excluding the original circumscribed rectangle, is used as the expansion area.

[0082] It should be noted that because the text information in bills is typically distributed horizontally, row by row, with large vertical blank areas between fields, the difference in information entropy between the field edge and the expanded area is large. However, the random location of defect edges results in a smaller difference in information entropy between the defect edge and the expanded area. Therefore, the present invention utilizes this difference feature to calculate the difference in information entropy between the original bounding rectangle and the expanded area, thereby measuring the likelihood that the target expanded area is the field edge.

[0083] In an exemplary embodiment of the present invention, the second indicator of the target expansion area can be determined by the following steps:

[0084] (1) Calculate the difference between the width of the bounding rectangle of the target expansion area and the median of the width of the bounding rectangles of all expansion areas, and normalize it to obtain the degree of deviation between the width of the bounding rectangle of the target expansion area and the overall level;

[0085] Optionally, the average width of the circumscribed rectangles of all the dilated regions may be defined as the overall level of the widths of the circumscribed rectangles of all the dilated regions, thereby obtaining the degree of deviation.

[0086] Optionally, you can use the maximum and minimum values for normalization, or use The function is normalized, and this embodiment does not specifically limit the selected normalization method.

[0087] (2) Calculate the difference between 1 and the degree of deviation, and multiply the difference with the difference in information entropy between the target expansion area and the expansion area to obtain the second indicator of the target expansion area.

[0088] Specifically, the second index of the target expansion area satisfies the following relationship:

[0089] ;

[0090] Where, is the second indicator of the target expansion area; is the width of the bounding rectangle of the target expansion area; is the median width of the bounding rectangle of all dilated areas; 、 are the maximum and minimum widths of the bounding rectangles of all expansion areas respectively; is the absolute value symbol; 、 are the information entropy of the target expansion area and the extended area respectively.

[0091] in, This value reflects the degree of deviation between the width of the bounding rectangle of the target expansion area and the overall horizontal level. The larger the value, the less consistent the width of the bounding rectangle of the target expansion area is with the overall horizontal level. However, the widths of all fields in the bill image are highly consistent. Therefore, the larger the value, the lower the possibility that the target expansion area is the area where the field edge is located, and the smaller the corresponding second index.

[0092] In another embodiment, the formula Calculate the second index of the target expansion area; where, For the natural constant An exponential function with base .

[0093] In an exemplary embodiment of the present invention, the information entropy of the expansion area is determined in the same manner as the information entropy of the target expansion area, which is not described in detail herein.

[0094] Step 3: Taking the average of the first indicator and the second indicator as the effective probability of the target expansion area.

[0095] Specifically, the effective probability of the target expansion area satisfies the relationship Where, 、 are the first and second indicators of the target expansion area, respectively. When , the target expansion area is divided into a valid area, that is, the area where the field edge is located; otherwise, the target expansion area is divided into an invalid area, so that the division results of all expansion areas can be obtained, providing accurate data support for subsequent operations. .

[0096] The detection module 140 is used to increase the grayscale contrast of each valid area through gamma transformation based on the valid probability of each valid area, and adaptively adjust the filter window to perform mean filtering on each invalid area. The filter window size is negatively correlated with the valid probability of the corresponding invalid area, so as to input the obtained target image into the pre-trained classification detection model and identify the bill type according to the output text area and content.

[0097] In an exemplary embodiment of the present invention, the enhancement of the grayscale contrast within each effective area can be achieved by the following steps:

[0098] The sum of the effective probability of each effective area and 1 is used as a weight to weight the preset gamma coefficient to obtain an updated gamma coefficient for each effective area; the updated gamma coefficient is used to adjust the grayscale value of the pixel point in each effective area through gamma transformation.

[0099] Specifically, the updated grayscale value of any pixel in any valid area satisfies the following relationship:

[0100] ;

[0101] Where, 、 Respectively Within the effective area Grayscale values of pixels before and after updating; For the The effective probability of a valid area; To preset the initial gamma coefficient, in this embodiment .

[0102] in, It is the Within the effective area The grayscale value of each pixel is normalized to ensure that the value is less than 1, so that when the gamma coefficient is larger, the grayscale value of the pixel can be reduced to a greater extent.

[0103] It should be noted that since the grayscale value of the field in the bill image is relatively low, the gamma coefficient needs to be greater than 1. The larger the gamma coefficient, the smaller the grayscale value of the updated field, that is, the better the enhancement effect on the field. Therefore, the present invention updates the initial gamma coefficient by summing the effective probability of each effective area and 1, so that the effective area with a higher probability of being the area where the field is located has a larger gamma coefficient, thereby greatly increasing the contrast between the field part and other parts within the corresponding effective area, and achieving enhanced grayscale contrast within each effective area.

[0104] It should be further explained that for each invalid area, when the validity probability of any invalid area is low, it means that the possibility that the invalid area is the area where the field edge is located is extremely small, that is, the invalid area is more likely to be the area where the defect edge is located. By setting a larger filtering window, the edges in the invalid area can be better smoothed, thereby improving the filtering effect of the defect edge.

[0105] Specifically, the size of the adaptive filtering window satisfies the following relationship:

[0106] ;

[0107] Where, For the The width of the adaptive filtering window of the invalid area; For the The effective probability of an invalid area; To preset the width of the initial filtering window, in this embodiment ; is the preset magnification factor. In this embodiment ; is the ceiling function.

[0108] In another embodiment, the formula: : Calculate the adaptive filtering window size of each invalid area.

[0109] Among them, when the contrast of the grayscale inside all valid areas is increased and all invalid areas are filtered, the obtained image is the target image.

[0110] Furthermore, the target image can be input into a pre-trained classification detection model, and the text area position and the corresponding text content can be output, thereby realizing the classification of the bill image and the recognition of the corresponding text content.

[0111] In an exemplary embodiment of the present invention, the classification detection model is an algorithm model that combines the object detection model of YOLOv10 with the OCR recognition model.

[0112] It should be noted that YOLOv10's target detection model can find the bounding boxes of each text area in the target image, and determine which category each bounding box belongs to in the label set during model training, and then crop out the classified areas; the OCR recognition model can identify the text content in each cropped area, so that the trained classification detection model can identify the text area position and corresponding text content of the target image, so as to realize the classification of each bill image based on the recognized text content.

[0113] Next, the process of constructing the training set for the classification detection model is described in detail: First, a sample image set is constructed using processed images corresponding to the front images of multiple bills (the same processing operation as that used to determine the target image); then, using annotation tools (such as LabelImg or CVAT), the target text area (such as "amount" and "invoice number") is selected in each image in the sample image set and assigned to it six preset labels: taxpayer identification number, project name, purchaser name, quantity, amount, and invoice number; then, the annotated sample image set is divided into a training set, a validation set, and a test set in a ratio of, for example, 7:2:1, to train the classification detection model. The labels set in this embodiment are related to the bill type, and relevant personnel can also set appropriate labels based on specific circumstances.

[0114] It should be noted that the process of training a model based on a training set, a validation set, and a test set is an existing technology and will not be described in detail in this embodiment.

[0115] Optionally, the target detection model in the classification detection model may also select other algorithms in the YOLO series, such as YOLOv8, YOLOv9, etc.; the classification detection model may also adopt an end-to-end text detection and recognition model, such as MaskTextSpotter, etc.; of course, a suitable model may also be selected according to the specific situation, and this embodiment does not specifically limit this.

[0116] In the description of this specification, "multiple" and "several" mean at least two, such as two, three or more, unless otherwise clearly defined.

[0117] While several embodiments of the present invention have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Numerous modifications, variations, and alternatives will occur to those skilled in the art without departing from the concept and spirit of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in practicing the present invention.

Claims

1. The tax bill classification and detection system based on image recognition is characterized by: include: The image acquisition module is used to acquire the front image of the bill to be classified and perform grayscale processing to obtain the initial image; an expansion region determination module, configured to perform edge detection on the initial image and perform a horizontal expansion operation on non-straight edges in the detection result to obtain an expansion region of each non-straight edge; The expansion region classification module is used to select a target expansion region, calculate the effective probability of the target expansion region based on multiple difference characteristics between the field edge and the defect edge, and divide all expansion regions into effective regions and invalid regions by comparing the effective probability with a preset value. The effective probability represents the probability that the target expansion region is the region where the field edge is located. The method for obtaining the effective probability of the target expansion region includes: Calculate the first index of the target expansion area : Where, is the area of the edge of the target expansion region; is the area of the target expansion region; is the median length of all edges in the target expansion area; is the width of the bounding rectangle of the target expansion area; is the information entropy of the target expansion area; Extending the width of the circumscribed rectangle of the target expansion area from both ends, taking the newly added area as the extended area, and calculating a second index of the target expansion area. The method for obtaining the second index includes: Calculate the difference between the width of the bounding rectangle of the target expansion area and the median of the widths of the bounding rectangles of all expansion areas, and normalize the difference to obtain the degree of deviation between the width of the bounding rectangle of the target expansion area and the overall level; Calculating a difference between 1 and the degree of deviation, and multiplying the difference by a difference in information entropy between the target expansion area and the expansion area to obtain a second indicator of the target expansion area; The average of the first indicator and the second indicator is used as the effective probability of the target expansion area; The detection module is used to increase the grayscale contrast of each valid area through gamma transformation based on the effective probability of each valid area, and adaptively adjust the filter window to perform mean filtering on each invalid area. The filter window size is negatively correlated with the effective probability of the corresponding invalid area, so as to input the obtained target image into the pre-trained classification detection model and identify the bill type according to the output text area and content.

2. The fiscal and tax bill classification and detection system based on image recognition according to claim 1 is characterized in that: The method for obtaining the information entropy of the target expansion area or the extended area includes: The target expansion area or the extended area is divided into a plurality of square sub-areas with a set width, and the information entropy of the target expansion area or the extended area is calculated based on the probability that the number of edge pixels in all the sub-areas takes different values using the information entropy calculation formula.

3. The fiscal and tax bill classification and detection system based on image recognition according to claim 1 is characterized in that: The step of increasing the grayscale contrast within each effective area through gamma transformation based on the effective probability of each effective area includes: The sum of the effective probability of each effective area and 1 is used as a weight to weight the preset gamma coefficient to obtain an updated gamma coefficient for each effective area; The updated gamma coefficient is used to adjust the grayscale value of the pixels in each valid area through gamma transformation.

4. The fiscal and tax bill classification and detection system based on image recognition according to claim 1 is characterized in that: The adaptive adjustment of the filter window satisfies the following relationship: ; Where, For the The width of the adaptive filtering window of the invalid area; For the The effective probability of an invalid area; is the preset initial filtering window width; The preset magnification factor; is the ceiling function.

5. The fiscal and tax bill classification and detection system based on image recognition according to claim 1 is characterized in that: The horizontal direction acquisition method includes: Hough line detection is performed on the initial image, and all detected straight line edges whose length is greater than a preset length are clustered based on the slope, so that the straight line direction corresponding to the cluster center of the category with the smaller average slope is used as the horizontal direction, and the straight line direction corresponding to the cluster center of the other category is used as the vertical direction.

6. The fiscal and tax bill classification and detection system based on image recognition according to claim 5 is characterized in that: The method for obtaining the non-straight edge includes: Acquire all edges obtained by performing edge detection on the initial image, and all straight line edges obtained by performing Hough line detection on the initial image; All edges except the straight line edges among all the edges are defined as non-straight line edges.

7. The fiscal and tax bill classification and detection system based on image recognition according to claim 6 is characterized in that: The length direction of the circumscribed rectangle of the target expansion area is parallel to the horizontal direction, and the width direction is parallel to the vertical direction.

8. The fiscal and tax bill classification and detection system based on image recognition according to claim 1 is characterized in that: The classification detection model is an algorithm model that combines the YOLOv10 target detection model with the OCR recognition model.

Citation Information

Patent Citations

  • Teaching-assistant book intelligent correcting and editing system based on character recognition

    CN116071763A

  • Image segmentation method for edge correction loss based on topology key error identification

    CN117593522A