A document quality analysis method, device, computer equipment and storage medium

By using the gradient graph prediction model and document quality analysis model, using high-quality and low-quality labeled document images, the problem of low efficiency of traditional document quality analysis methods is solved, and fast and accurate document quality analysis is achieved to meet the needs of online business. Immediate needs.

CN114638810BActive Publication Date: 2024-09-17CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210288991.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-22
Publication Date
2024-09-17
Estimated Expiration
2042-03-22

AI Technical Summary

Technical Problem

Traditional document quality analysis methods have problems such as taking too long to judge quality and being too inefficient, making it difficult to meet the immediacy requirements of online business.

Method used

The model training data includes document images with high-quality and low-quality labels. Through the gradient graph prediction model and the document quality analysis model, the model is pre-trained to obtain fine-grained features of the document image to be analyzed, thereby achieving rapid document quality analysis.

Benefits of technology

It improves the efficiency and robustness of document quality analysis, can distinguish document quality faster and more accurately, and meets the immediate needs of online business.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114638810B
    Figure CN114638810B
Patent Text Reader

Abstract

The embodiments of the present application belong to the field of image processing technology in artificial intelligence, and relate to a document quality analysis method, device, computer equipment and storage medium. In addition, the present application also relates to blockchain technology, and the user's document image to be analyzed and the document quality analysis results can be stored in the blockchain. The present application starts with the gradient information of the document image, pre-trains a gradient map prediction model for obtaining the gradient map of the document image to be identified, and a document quality analysis model that fully utilizes the fine-grained features of good quality document images and poor quality document images for document quality analysis. When it is necessary to analyze the document image, the fine-grained features of the document image are obtained through the gradient map prediction model, and the document quality analysis operation is implemented according to the document quality analysis model, so that the document quality analysis is more efficient, more robust and more discriminative.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology in artificial intelligence, and in particular to a document quality analysis method, device, computer equipment and storage medium. Background Art

[0002] Automated document image content recognition and understanding is crucial to improving the efficiency of information transfer and analysis. In particular, in the insurance business, a considerable amount of document data is uploaded in the form of images. Accurately identifying the information in the document can greatly reduce the burden of manual entry and verification. In the process of understanding the content of the document image, it is often impossible to accurately extract the document information because the quality of the uploaded image is too poor. Therefore, before extracting information from the document, it is necessary to intercept the document image with poor quality and promptly notify the user to re-upload the image with the required quality to improve the efficiency of the overall process.

[0003] There is a document quality analysis method that judges the quality of the entire image based on the image clarity, thereby achieving the purpose of document quality analysis.

[0004] However, the applicant found that traditional document quality analysis methods are generally not intelligent. Since the resolution of document images is generally very large, directly judging the clarity of the entire image is difficult to meet the immediacy requirements of online business. It can be seen that traditional document quality analysis methods have the problems of too long quality judgment time and too low efficiency. Summary of the invention

[0005] The purpose of the embodiments of the present application is to propose a document quality analysis method, apparatus, computer equipment and storage medium to solve the problems of long quality judgment time and low efficiency in traditional document quality analysis methods.

[0006] In order to solve the above technical problems, the present application embodiment provides a document quality analysis method, which adopts the following technical solution:

[0007] Acquire model training data, wherein the model training data includes a high-quality label, a high-quality document image corresponding to the high-quality label and a high-quality gradient map corresponding to the high-quality document image, a low-quality label and a low-quality document image corresponding to the low-quality label;

[0008] Inputting the high-quality document image and the high-quality gradient map into an initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model;

[0009] Performing a document quality training operation on an initial document quality analysis model according to the high-quality label, the high-quality document image, the low-quality label, and the low-quality document image to obtain a target document quality analysis model;

[0010] Obtaining a document image to be analyzed;

[0011] Inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed;

[0012] Inputting the document gradient image to be analyzed into the target document quality analysis model to perform a document quality analysis operation, and obtaining a document quality analysis result corresponding to the document image to be analyzed;

[0013] The document quality analysis result is output.

[0014] In order to solve the above technical problems, the embodiment of the present application further provides a document quality analysis device, which adopts the following technical solution:

[0015] A training data acquisition module, used to acquire model training data, wherein the model training data includes a high-quality label, a high-quality document image corresponding to the high-quality label and a high-quality gradient map corresponding to the high-quality document image, a low-quality label and a low-quality document image corresponding to the low-quality label;

[0016] A gradient map prediction model training module, used for inputting the high-quality document image and the high-quality gradient map into an initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model;

[0017] A quality analysis model training module, used to perform a document quality training operation on an initial document quality analysis model according to the high-quality label, the high-quality document image, the low-quality label and the low-quality document image to obtain a target document quality analysis model;

[0018] The module for acquiring the document to be analyzed is used to acquire the image of the document to be analyzed;

[0019] A gradient map prediction module, used for inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed;

[0020] A document quality analysis module, used for inputting the document gradient image to be analyzed into the target document quality analysis model to perform a document quality analysis operation, and obtaining a document quality analysis result corresponding to the document image to be analyzed;

[0021] The result output module is used to output the document quality analysis result.

[0022] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0023] The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the document quality analysis method as described above when executing the computer-readable instructions.

[0024] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0025] The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the document quality analysis method described above are implemented.

[0026] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0027] The present application provides a document quality analysis method, including: acquiring model training data, the model training data including a high-quality label, a high-quality document image corresponding to the high-quality label, a high-quality gradient map corresponding to the high-quality document image, a low-quality label, and a low-quality document image corresponding to the low-quality label; inputting the high-quality document image and the high-quality gradient map into an initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model; performing a document quality training operation on the initial document quality analysis model according to the high-quality label, the high-quality document image, the low-quality label, and the low-quality document image to obtain a target document quality analysis model; acquiring a document image to be analyzed; inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed; inputting the gradient map of the document to be analyzed into the target document quality analysis model to perform a document quality analysis operation to obtain a document quality analysis result corresponding to the document image to be analyzed; and outputting the document quality analysis result. The present application starts with the gradient information of the document image, pre-trains a gradient map prediction model for obtaining the gradient map of the document image to be identified, and a document quality analysis model that fully utilizes the fine-grained features of good-quality document images and poor-quality document images for document quality analysis. When it is necessary to analyze the document image, the fine-grained features of the document image are obtained through the gradient map prediction model, and the document quality analysis operation is implemented according to the document quality analysis model, so that the document quality analysis is more efficient, more robust and more discriminative. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0029] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0030] Figure 2 This is a flowchart of the implementation of the document quality analysis method provided in Example 1 of the present application;

[0031] Figure 3 yes Figure 2 A flowchart of a specific implementation of step S202;

[0032] Figure 4 The predicted gradient map and the actual gradient map provided in the first embodiment of the present application are Figure 8 A flowchart of a specific implementation method of the loss between the attentions of the directions;

[0033] Figure 5 yes Figure 3 A flowchart of a specific implementation of step S301;

[0034] Figure 6 The horizontal gradient amplitude feature F is calculated separately according to the first embodiment of the present application. hor (x) and vertical gradient amplitude feature F ver (x) a flowchart of a specific implementation method;

[0035] Figure 7 This is a flowchart of a specific implementation method of obtaining a sub-image of a document to be analyzed provided in Example 1 of the present application;

[0036] Figure 8 This is a flowchart of a specific implementation method of obtaining a pre-processed document image provided in Example 1 of the present application;

[0037] Fig. 9 This is a flowchart of a specific implementation method of obtaining a target gradient map prediction model provided in Example 1 of the present application;

[0038] Fig.10 is a structural diagram of a document quality analysis device provided in Example 2 of the present application;

[0039] Fig.11 yes Fig.10 A schematic diagram of a structure of a specific implementation of the medium gradient map prediction model training module 220;

[0040] Fig.12 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0041] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0042] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0043] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0044] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0045] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0046] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.

[0047] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0048] It should be noted that the document quality analysis method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the document quality analysis device is generally arranged in the server / terminal device.

[0049] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0050] Continue to refer Figure 2 , shows an implementation flow chart of the document quality analysis method provided in Example 1 of the present application. For the sake of convenience, only the parts related to the present application are shown.

[0051] The document quality analysis method mentioned above includes the following steps: step S201, step S202, step S203, step S204, step S205, step S206 and step S207.

[0052] Step S201: Acquire model training data, the model training data including high-quality labels, high-quality document images corresponding to the high-quality labels and high-quality gradient maps corresponding to the high-quality document images, low-quality labels and low-quality document images corresponding to the low-quality labels.

[0053] In an embodiment of the present application, a standard document image refers to a document image having learning value features, wherein the standard document image includes a high-quality document image having higher quality such as image clarity and a low-quality document image having lower quality such as lower image clarity, and the standard document image also includes a standard high-quality document gradient map corresponding to the high-quality document image and a standard low-quality document gradient map corresponding to the low-quality document image.

[0054] In the embodiment of the present application, the good quality labels and the poor quality labels are pre-labeled data, wherein it can be considered that the text items whose average recognition confidence exceeds a certain threshold are good quality documents, and those below a certain threshold are poor quality documents.

[0055] Step S202: inputting the high-quality document image and the high-quality gradient map into the initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model.

[0056] In the embodiment of the present application, the gradient graph model training operation is mainly based on the gradient graph loss function L EGL And contrast gradient loss function L CGL Model training is performed. Specifically, the gradient map model training operation can be inputting a high-quality document image into an initial gradient map prediction model to perform a gradient map prediction operation to obtain a predicted gradient map; and constructing a gradient map loss function L according to the high-quality gradient map and the predicted gradient map. EGL And the contrast gradient loss function L CGL ; According to the gradient graph loss function L EGL And the contrast gradient loss function L CGL The initial gradient map prediction model is trained to obtain the target gradient map prediction model.

[0057] In the embodiment of the present application, the gradient map prediction model is mainly used to extract fine-grained spatial detail features, that is, the image gradient map. Specifically, the high-quality document image is input into the gradient amplitude feature extraction module to obtain the horizontal gradient amplitude feature F hor (x) and the vertical gradient amplitude feature F ver (x); Input the high-quality document image into the spatial semantic feature extraction module to obtain the spatial semantic feature F(x, {w i}); for the horizontal gradient amplitude feature F hor (x), vertical gradient amplitude feature F ver (x) and spatial semantic features F(x, {w i})Perform normalization operation to obtain the image gradient map of the document to be analyzed.

[0058] Step S203: Performing a document quality training operation on the initial document quality analysis model according to the high-quality label, the high-quality document image, the low-quality label and the low-quality document image to obtain a target document quality analysis model.

[0059] In the embodiment of the present application, the document quality analysis model is essentially composed of an ordinary fully connected layer and a softmax layer. The document quality training operation is based on the classification loss function L bin For model training, the classification loss function L bin It is expressed as:

[0060] L bin =-B G *log(fcs(G p ))

[0061] Among them, B G Indicates the quality of the picture. FCS is a normal fully connected layer and softmax.

[0062] Step S204: Acquire the document image to be analyzed.

[0063] In an embodiment of the present application, the method for obtaining the document image to be analyzed can be to obtain it by receiving a request sent by a user terminal carrying the document image to be analyzed, and the document image to be analyzed can also be obtained from a system database storing the document image to be analyzed. It should be understood that the example of obtaining the document image to be analyzed here is only for the convenience of understanding and is not used to limit the present application.

[0064] Step S205: inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed.

[0065] Step S206: inputting the gradient image of the document to be analyzed into the target document quality analysis model to perform a document quality analysis operation, and obtaining a document quality analysis result corresponding to the document image to be analyzed.

[0066] Step S207: Output the document quality analysis result.

[0067] In an embodiment of the present application, a document quality analysis method is provided, including: obtaining model training data, the model training data including a high-quality label, a high-quality document image corresponding to the high-quality label, a high-quality gradient map corresponding to the high-quality document image, a low-quality label, and a low-quality document image corresponding to the low-quality label; inputting the high-quality document image and the high-quality gradient map into an initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model; performing a document quality training operation on the initial document quality analysis model according to the high-quality label, the high-quality document image, the low-quality label, and the low-quality document image to obtain a target document quality analysis model; obtaining a document image to be analyzed; inputting the document image to be analyzed into a target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed; inputting the gradient map of the document to be analyzed into the target document quality analysis model to perform a document quality analysis operation to obtain a document quality analysis result corresponding to the document image to be analyzed; and outputting the document quality analysis result. The present application starts with the gradient information of the document image, pre-trains a gradient map prediction model for obtaining the gradient map of the document image to be identified, and a document quality analysis model that fully utilizes the fine-grained features of good-quality document images and poor-quality document images for document quality analysis. When it is necessary to analyze the document image, the fine-grained features of the document image are obtained through the gradient map prediction model, and the document quality analysis operation is implemented according to the document quality analysis model, so that the document quality analysis is more efficient, more robust and more discriminative.

[0068] Continue reading Figure 3 , showing Figure 2 A flowchart of a specific implementation of step S202 is shown in FIG. 1 . For ease of explanation, only the part related to the present application is shown.

[0069] In some optional implementations of this embodiment, step S202 specifically includes: step S301, step S302, and step S303.

[0070] Step S301: inputting a high-quality document image into an initial gradient map prediction model to perform a gradient map prediction operation to obtain a predicted gradient map.

[0071] Step S302: Construct a gradient map loss function L based on the high-quality gradient map and the predicted gradient map EGL And the contrast gradient loss function L CGL .

[0072] In the embodiment of the present application, the gradient map loss function L EGL The loss function between the predicted gradient map and the real gradient map is calculated to make the gradient map predicted by the model similar to the real gradient map. The gradient map loss function L EGL It is expressed as:

[0073]

[0074] Among them, G p is the predicted gradient map, G G is the actual gradient map.

[0075] In the embodiment of the present application, the comparison gradient loss function L CGL It is achieved by obtaining the predicted gradient map and the actual gradient Figure 8 The loss between the attentions of the different directions is as follows Figure 4 As shown, 8 different convolution kernels are used to obtain the attention results of two gradient maps. In the 3x3 convolution kernel, yellow is -1, purple is 1, and white is 0. The contrast gradient loss function L CGL It is expressed as:

[0076]

[0077] in, is the defined convolution kernel, G p and G G They are the gradient map predicted by the network and the real gradient map. The final result is obtained by subtracting the two attention feature maps after the convolution operation element by element.

[0078] Step S303: According to the gradient graph loss function L EGL And the contrast gradient loss function L CGL The initial gradient map prediction model is trained to obtain the target gradient map prediction model.

[0079] Continue reading Figure 5 , showing Figure 3 A flowchart of a specific implementation of step S301 is shown in FIG. 1 . For ease of explanation, only the part related to the present application is shown.

[0080] In some optional implementations of this embodiment, the gradient map prediction model is composed of a gradient amplitude feature extraction module and a spatial semantic feature extraction module, and step S301 specifically includes: step S501, step S502 and step S503.

[0081] Step S501: Input the high-quality document image into the gradient amplitude feature extraction module to obtain the horizontal gradient amplitude feature F hor (x) and the vertical gradient amplitude feature F ver (x).

[0082] In the embodiment of the present application, the structure of the gradient map prediction model is as follows: Figure 6As shown, for the input feature map x, the horizontal gradient amplitude feature F is calculated respectively hor (x) and vertical gradient amplitude feature F ver (x), expressed as:

[0083]

[0084] Step S502: Input the high-quality document image into the spatial semantic feature extraction module to obtain the spatial semantic feature F(x, {w i}).

[0085] In the embodiment of the present application, after obtaining the gradient amplitude information, the spatial local semantic feature F(x, {w i}).

[0086] Step S503: Calculate the horizontal gradient amplitude feature F hor (x), vertical gradient amplitude feature F ver (x) and spatial semantic features F(x, {w i})Perform normalization operation to obtain the gradient map of the document to be analyzed.

[0087] In the embodiment of the present application, the gradient graph y of the document to be analyzed is expressed as:

[0088]

[0089] Among them, x′ is the result of x after 1x1 convolution fusion channel, N refers to the normalization operation, is the activation ReLU operation.

[0090] Continue reading Figure 7 , shows a flowchart of a specific implementation method of obtaining a sub-image of a document to be analyzed provided in Example 1 of the present application. For the sake of ease of explanation, only the part related to the present application is shown.

[0091] In some optional implementations of this embodiment, after step S104 and before step S105, the following steps are further included: step S701, step S702, and step S703. Step S105 specifically includes: step S704.

[0092] Step S701: performing an adaptive binarization operation on the document image to be analyzed to obtain a binarized document image.

[0093] In the embodiment of the present application, the binarization algorithm takes a threshold value, and the pixel points greater than the threshold value are assigned a value of 1, that is, displayed as white, and the pixel points less than the threshold value are naturally assigned a value of 0, that is, displayed as black. Therefore, the quality of this threshold value directly affects the effect.

[0094] In an embodiment of the present application, the threshold of adaptive binarization may be the average of the entire picture; the threshold of adaptive binarization may also be the average of all pixels in the row and column where each pixel is located; the threshold of adaptive binarization may also be the average of all pixels in the matrix area where each pixel is located. It should be understood that the examples of the adaptive binarization threshold here are only for the convenience of understanding and are not used to limit the present application.

[0095] In some optimized embodiments of the present application, the document image to be analyzed can be divided into a smooth area (the grayscale value of the pixel point is in a very small range and presents a distribution curve with a protrusion in the middle) and a detail area (the grayscale value of the pixel point is distributed in a large range, showing an extreme distribution pattern). In the "matrix binarization processing", a parameter β is added in the process of comparing the pixel point with the mean of all pixels in the matrix, that is, if (a<mean*β), where a represents a long pixel point and mean represents the pixel mean.

[0096] In the embodiment of the present application, the above parameter β may be 0.9.

[0097] Step S702: performing an erosion and dilation operation on the binary document image to obtain the document image edge line.

[0098] In the embodiment of the present application, the erosion and dilation operation refers to deleting pixels at the boundary of the binary document image (the erosion part, i.e. making the white area thinner), and at the same time, adding pixels to the boundary of the binary document image (the dilation part, i.e. making the white area fatter), and the size of this "circle" is specified by a parameter, and the user can set the value of the parameter according to actual conditions.

[0099] Step S703: Segment the document image to be analyzed according to the edge lines of the document image to obtain a sub-image of the document to be analyzed.

[0100] Step S704: input the document sub-image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed.

[0101] In the embodiment of the present application, since the size of the document image is irregular, or even oversized, when the above-mentioned text box detection operation is performed on the oversized document image, it will seriously affect the efficiency and accuracy of the text box detection. Therefore, by performing adaptive binarization operations, corrosion and dilation operations and segmentation operations on the document image to be analyzed, the document image to be analyzed is divided into targeted areas, and a small-sized image with text as the main area is obtained, thereby effectively ensuring the efficiency and accuracy of subsequent text box detection operations.

[0102] Continue reading Figure 8, shows a flowchart of a specific implementation method of obtaining a pre-processed document image provided in Example 1 of the present application. For the sake of ease of explanation, only the part related to the present application is shown.

[0103] In some optional implementations of this embodiment, after step S104 and before step S105, the following steps are further included: step S801 and step S802, and step S105 specifically includes: step S803.

[0104] Step S801: resizing the document image to be analyzed in a manner that the aspect ratio remains unchanged, to obtain an image of standard size.

[0105] In an embodiment of the present application, size adjustment processing refers to the process of adjusting the size of the document image to be analyzed, and the adjustment process always keeps the aspect ratio of the image unchanged. Specifically, image enlargement can adopt the interpolation method, that is, inserting new elements between pixels based on the original image pixels by using a suitable interpolation algorithm. As an example, the interpolation algorithm can be: including edge-based image interpolation algorithms, area-based image interpolation algorithms and other known or future-developed algorithms; and image reduction can be achieved by interpolation using CV_INETR_AREA.

[0106] Step S802: Segment the standard-size image according to a preset size to obtain a pre-processed document image.

[0107] Step S803: input the preprocessed document image into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed.

[0108] In an embodiment of the present application, since the input of the target gradient map prediction model needs to meet certain size requirements, when an image that is too large is input into the target gradient map prediction model, it will affect the processing efficiency and accuracy of the model. Therefore, the document image to be analyzed is standardized through the above-mentioned size adjustment processing and segmentation processing, so that the input data of the target gradient map prediction model meets the requirements of the model, wherein the preset size can be dynamically adjusted according to actual conditions. As an example, the preset size can be 224×224. It should be understood that the example of the preset size here is only for convenience of understanding and is not used to limit the present application.

[0109] Continue reading Fig. 9 , shows a flowchart of a specific implementation method of obtaining a target gradient map prediction model provided in Example 1 of the present application. For ease of explanation, only the part related to the present application is shown.

[0110] In some optional implementations of this embodiment, after step S101 and before step S102, the following steps are further included: step S901 and step S902, and step S102 specifically includes: step S903.

[0111] In step S901, an image enhancement operation is performed on the high-quality document image to obtain an enhanced document image.

[0112] In an embodiment of the present application, the specific implementation method of the image enhancement operation is: four images image1, image2, image3, and image4 are randomly cropped (random_cut) respectively, and then the four cropped images are randomly spliced ​​and combined (random_combine) to obtain a mixed image, and finally the mixed image is resized to a fixed size as the input image of the initial gradient map prediction model.

[0113] In step S902, a gradient map calculation operation is performed on the enhanced document image according to a two-dimensional discrete function derivation method to obtain an enhanced gradient map.

[0114] In the embodiment of the present application, the image gradient can be regarded as a two-dimensional discrete function, and the image gradient is actually the derivative of this two-dimensional discrete function. Specifically:

[0115] Image gradient: G(x,y)=dx(i,j)+dy(i,j);

[0116] dx(i,j)=I(i+1,j)-I(i,j);

[0117] dy(i,j)=I(i,j+1)-I(i,j);

[0118] Among them, I is the value of the image pixel (such as RGB value), and (i, j) is the coordinate of the pixel.

[0119] Image gradient can generally also be calculated using median difference:

[0120] dx(i,j)=[I(i+1,j)-I(i-1,j)] / 2;

[0121] dy(i,j)=[I(i,j+1)-I(i,j-1)] / 2;

[0122] Image edges are generally achieved by performing gradient operations on the image.

[0123] In step S903, the enhanced document image and the enhanced gradient map are input into the initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model.

[0124] In an embodiment of the present application, an image enhancement algorithm Mosaic is introduced to increase the feature content of the image input to the model, increase the training width of the model, effectively reduce the misrecognition of low-quality documents, and at the same time, increase the recall of images to be detected taken in difficult scenes such as poor lighting, thereby improving the overall accuracy and recall rate of document quality recognition.

[0125] In summary, the present application provides a document quality analysis method, including: obtaining model training data, the model training data including high-quality labels, high-quality document images corresponding to the high-quality labels, and high-quality gradient maps corresponding to the high-quality document images, low-quality labels, and low-quality document images corresponding to the low-quality labels; inputting the high-quality document images and the high-quality gradient maps into an initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model; performing a document quality training operation on the initial document quality analysis model according to the high-quality labels, high-quality document images, low-quality labels, and low-quality document images to obtain a target document quality analysis model; obtaining a document image to be analyzed; inputting the document image to be analyzed into a target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed; inputting the gradient map of the document to be analyzed into the target document quality analysis model to perform a document quality analysis operation to obtain a document quality analysis result corresponding to the document image to be analyzed; and outputting the document quality analysis result. The present application starts with the gradient information of the document image, pre-trains a gradient map prediction model for obtaining the gradient map of the document image to be identified, and a document quality analysis model that fully utilizes the fine-grained features of good-quality document images and poor-quality document images for document quality analysis. When it is necessary to analyze the document image, the fine-grained features of the document image are obtained through the gradient map prediction model, and the document quality analysis operation is implemented according to the document quality analysis model, so that the document quality analysis is more efficient, more robust and more discriminative. At the same time, by performing adaptive binarization, corrosion and dilation operations and segmentation operations on the document image to be analyzed, the document image to be analyzed is divided into specific regions, and a small-sized image with text as the main area is obtained, thereby effectively ensuring the efficiency and accuracy of subsequent text box detection operations; the document image to be analyzed is standardized through the above-mentioned size adjustment and segmentation processing, so that the input data of the target gradient map prediction model meets the requirements of the model; the image enhancement algorithm Mosaic is introduced to increase the feature content of the image input to the model, increase the training width of the model, effectively reduce the misrecognition of low-quality documents, and at the same time, increase the recall of images to be detected taken in difficult scenes such as bad light, thereby improving the overall accuracy and recall of document quality recognition.

[0126] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned document images to be analyzed and the document quality analysis results, the above-mentioned document images to be analyzed and the document quality analysis results can also be stored in a node of a blockchain.

[0127] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0128] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0129] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the computer-readable instructions are executed, they can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0130] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0131] Embodiment 2

[0132] Further references Fig.10 , as a response to the above Figure 2 In order to realize the method shown in the figure, the present application provides an embodiment of a document quality analysis device, and the device embodiment is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0133] like Fig.10 As shown, the document quality analysis device 200 of this embodiment includes: a training data acquisition module 210, a gradient map prediction model training module 220, a quality analysis model training module 230, a document acquisition module 240 to be analyzed, a gradient map prediction module 250, a document quality analysis module 260 and a result output module 270. Among them:

[0134] A training data acquisition module 210 is used to acquire model training data, where the model training data includes a high-quality label, a high-quality document image corresponding to the high-quality label, and a high-quality gradient map corresponding to the high-quality document image, a low-quality label, and a low-quality document image corresponding to the low-quality label;

[0135] A gradient map prediction model training module 220 is used to input the high-quality document image and the high-quality gradient map into the initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model;

[0136] The quality analysis model training module 230 is used to perform a document quality training operation on the initial document quality analysis model according to the high-quality label, the high-quality document image, the low-quality label and the low-quality document image to obtain a target document quality analysis model;

[0137] The document acquisition module 240 is used to acquire the image of the document to be analyzed;

[0138] The gradient map prediction module 250 is used to input the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed;

[0139] The document quality analysis module 260 is used to input the gradient image of the document to be analyzed into the target document quality analysis model to perform a document quality analysis operation and obtain a document quality analysis result corresponding to the document image to be analyzed;

[0140] The result output module 270 is used to output the document quality analysis results.

[0141] In an embodiment of the present application, a standard document image refers to a document image having learning value features, wherein the standard document image includes a high-quality document image having higher quality such as image clarity and a low-quality document image having lower quality such as lower image clarity, and the standard document image also includes a standard high-quality document gradient map corresponding to the high-quality document image and a standard low-quality document gradient map corresponding to the low-quality document image.

[0142] In the embodiment of the present application, the good quality labels and the poor quality labels are pre-labeled data, wherein it can be considered that the text items whose average recognition confidence exceeds a certain threshold are good quality documents, and those below a certain threshold are poor quality documents.

[0143] In the embodiment of the present application, the gradient graph model training operation is mainly based on the gradient graph loss function L EGL And contrast gradient loss function L CGL Model training is performed. Specifically, the gradient map model training operation can be inputting a high-quality document image into an initial gradient map prediction model to perform a gradient map prediction operation to obtain a predicted gradient map; and constructing a gradient map loss function L according to the high-quality gradient map and the predicted gradient map. EGL And the contrast gradient loss function L CGL ; According to the gradient graph loss function L EGL And the contrast gradient loss function L CGL The initial gradient map prediction model is trained to obtain the target gradient map prediction model.

[0144] In the embodiment of the present application, the gradient map prediction model is mainly used to extract fine-grained spatial detail features, that is, the image gradient map. Specifically, the high-quality document image is input into the gradient amplitude feature extraction module to obtain the horizontal gradient amplitude feature F hor (x) and the vertical gradient amplitude feature F ver (x); Input the high-quality document image into the spatial semantic feature extraction module to obtain the spatial semantic feature F(x, {w i}); for the horizontal gradient amplitude feature F hor(x), vertical gradient amplitude feature F ver (x) and spatial semantic features F(x, {w i})Perform normalization operation to obtain the image gradient map of the document to be analyzed.

[0145] In the embodiment of the present application, the document quality analysis model is essentially composed of an ordinary fully connected layer and a softmax layer. The document quality training operation is based on the classification loss function L bin For model training, the classification loss function L bin It is expressed as:

[0146] L bin =-B G *log(fcs(G p ))

[0147] Among them, B G Indicates the quality of the picture. FCS is a normal fully connected layer and softmax.

[0148] In an embodiment of the present application, the method for obtaining the document image to be analyzed can be to obtain it by receiving a request sent by a user terminal carrying the document image to be analyzed, and the document image to be analyzed can also be obtained from a system database storing the document image to be analyzed. It should be understood that the example of obtaining the document image to be analyzed here is only for the convenience of understanding and is not used to limit the present application.

[0149] In an embodiment of the present application, a document quality analysis device 200 is provided, including: a training data acquisition module 210, which is used to acquire model training data, the model training data including a high-quality label, a high-quality document image corresponding to the high-quality label, and a high-quality gradient map corresponding to the high-quality document image, a low-quality label, and a low-quality document image corresponding to the low-quality label; a gradient map prediction model training module 220, which is used to input the high-quality document image and the high-quality gradient map into an initial gradient map prediction model for performing a gradient map model training operation to obtain a target gradient map prediction model; a quality analysis model training module 230, which is used to train the target gradient map prediction model based on the high-quality label, the high-quality document image, and the high-quality gradient map. The document quality training operation is performed on the initial document quality analysis model using the image, low-quality label and low-quality document image to obtain the target document quality analysis model; the document acquisition module 240 to be analyzed is used to obtain the document image to be analyzed; the gradient map prediction module 250 is used to input the document image to be analyzed into the target gradient map prediction model to perform the gradient map prediction operation to obtain the gradient map of the document to be analyzed; the document quality analysis module 260 is used to input the gradient map of the document to be analyzed into the target document quality analysis model to perform the document quality analysis operation to obtain the document quality analysis result corresponding to the document image to be analyzed; the result output module 270 is used to output the document quality analysis result. The present application starts with the gradient information of the document image, pre-trains a gradient map prediction model for obtaining the gradient map of the document image to be identified, and a document quality analysis model that fully utilizes the fine-grained features of the document image with good quality and the document image with poor quality to perform document quality analysis. When the document image needs to be analyzed, the fine-grained features of the document image are obtained through the gradient map prediction model, and the document quality analysis operation is implemented according to the document quality analysis model, so that the document quality analysis is more efficient, more robust and more distinguishable.

[0150] Continue reading Fig.11 , showing Fig.10 A structural diagram of a specific implementation of the medium gradient map prediction model training module 220. For ease of explanation, only the part related to the present application is shown.

[0151] In some optional implementations of this embodiment, the above-mentioned gradient map prediction model training module 220 includes: a gradient map prediction submodule 221, a loss function construction submodule 222 and a gradient map prediction model training submodule 223, wherein:

[0152] The gradient map prediction submodule 221 is used to input the high-quality document image into the initial gradient map prediction model to perform a gradient map prediction operation to obtain a predicted gradient map;

[0153] The loss function construction submodule 222 is used to construct a gradient map loss function L according to the high-quality gradient map and the predicted gradient map. EGLAnd the contrast gradient loss function L CGL ;

[0154] The gradient map prediction model training submodule 223 is used to train the gradient map prediction model according to the gradient map loss function L EGL And the contrast gradient loss function L CGL The initial gradient map prediction model is trained to obtain the target gradient map prediction model.

[0155] In the embodiment of the present application, the gradient map loss function L EGL The loss function between the predicted gradient map and the real gradient map is calculated to make the gradient map predicted by the model similar to the real gradient map. The gradient map loss function L EGL It is expressed as:

[0156]

[0157] Among them, G p is the predicted gradient map, G G is the actual gradient map.

[0158] In the embodiment of the present application, the comparison gradient loss function L CGL It is achieved by obtaining the predicted gradient map and the actual gradient Figure 8 The loss between the attentions of the different directions is as follows Figure 4 As shown, 8 different convolution kernels are used to obtain the attention results of two gradient maps. In the 3x3 convolution kernel, yellow is -1, purple is 1, and white is 0. The contrast gradient loss function L CGL It is expressed as:

[0159]

[0160] in, is the defined convolution kernel, G p and G G They are the gradient map predicted by the network and the real gradient map. The final result is obtained by subtracting the two attention feature maps after the convolution operation element by element.

[0161] In some optional implementations of this embodiment, the gradient map prediction model is composed of a gradient amplitude feature extraction module and a spatial semantic feature extraction module. The above-mentioned gradient map prediction submodule 221 includes: a feature extraction unit, a semantic feature acquisition unit and a normalization unit, wherein:

[0162] The feature extraction unit is used to input the high-quality document image into the gradient amplitude feature extraction module to obtain the horizontal gradient amplitude feature F hor (x) and the vertical gradient amplitude feature F ver(x);

[0163] The semantic feature acquisition unit is used to input the high-quality document image into the spatial semantic feature extraction module to obtain the spatial semantic feature F(x, {w i});

[0164] Normalization unit, used to normalize the horizontal gradient amplitude feature F hor (x), vertical gradient amplitude feature F ver (x) and spatial semantic features F(x, {W i})Perform normalization operation to obtain the gradient map of the document to be analyzed.

[0165] In the embodiment of the present application, the structure of the gradient map prediction model is as follows: Figure 6 As shown, for the input feature map x, the horizontal gradient amplitude feature F is calculated respectively hor (x) and vertical gradient amplitude feature F ver (x), expressed as:

[0166]

[0167] In the embodiment of the present application, after obtaining the gradient amplitude information, the spatial local semantic feature F(x,{w i}).

[0168] In the embodiment of the present application, the gradient graph y of the document to be analyzed is expressed as:

[0169]

[0170] Among them, x′ is the result of x after 1x1 convolution fusion channel, N refers to the normalization operation, is the activation ReLU operation.

[0171] In some optional implementations of this embodiment, the document quality analysis device 200 further includes: a binarization module, a corrosion expansion module and a first segmentation module, and the gradient map prediction module includes: a first gradient map prediction submodule, wherein:

[0172] A binarization module, used for performing an adaptive binarization operation on the document image to be analyzed to obtain a binarized document image;

[0173] An erosion and dilation module, used for performing an erosion and dilation operation on the binary document image to obtain a document image edge line;

[0174] A first segmentation module, configured to segment the document image to be analyzed according to the edge lines of the document image to obtain a sub-image of the document to be analyzed;

[0175] The first gradient map prediction submodule is used to input the document sub-image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain the gradient map of the document to be analyzed.

[0176] In the embodiment of the present application, since the size of the document image is irregular, or even oversized, when the above-mentioned text box detection operation is performed on the oversized document image, it will seriously affect the efficiency and accuracy of the text box detection. Therefore, by performing adaptive binarization operations, corrosion and dilation operations and segmentation operations on the document image to be analyzed, the document image to be analyzed is divided into targeted areas, and a small-sized image with text as the main area is obtained, thereby effectively ensuring the efficiency and accuracy of subsequent text box detection operations.

[0177] In some optional implementations of this embodiment, the document quality analysis device 200 further includes: a size adjustment module and a second segmentation module, and the gradient map prediction module includes: a second gradient map prediction submodule, wherein:

[0178] A size adjustment module is used to adjust the size of the document image to be analyzed in a manner that the aspect ratio remains unchanged, so as to obtain a standard size image;

[0179] A second segmentation module is used to segment the standard size image according to a preset size to obtain a pre-processed document image;

[0180] The second gradient map prediction submodule is used to input the preprocessed document image into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed.

[0181] In an embodiment of the present application, since the input of the target gradient map prediction model needs to meet certain size requirements, when an image that is too large is input into the target gradient map prediction model, it will affect the processing efficiency and accuracy of the model. Therefore, the document image to be analyzed is standardized through the above-mentioned size adjustment processing and segmentation processing, so that the input data of the target gradient map prediction model meets the requirements of the model, wherein the preset size can be dynamically adjusted according to actual conditions. As an example, the preset size can be 224×224. It should be understood that the example of the preset size here is only for convenience of understanding and is not used to limit the present application.

[0182] In some optional implementations of this embodiment, the document quality analysis device 200 further includes: an image enhancement module and a gradient map calculation module, and the gradient map prediction model training module 220 includes: a gradient map model training submodule, wherein:

[0183] An image enhancement module is used to perform an image enhancement operation on a high-quality document image to obtain an enhanced document image;

[0184] A gradient map calculation module is used to perform a gradient map calculation operation on the enhanced document image according to a two-dimensional discrete function derivation method to obtain an enhanced gradient map;

[0185] The gradient map model training submodule is used to input the enhanced document image and the enhanced gradient map into the initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model.

[0186] In an embodiment of the present application, the specific implementation method of the image enhancement operation is: four images image1, image2, image3, and image4 are randomly cropped (random_cut) respectively, and then the four cropped images are randomly spliced ​​and combined (random_combine) to obtain a mixed image, and finally the mixed image is resized to a fixed size as the input image of the initial gradient map prediction model.

[0187] In the embodiment of the present application, the image gradient can be regarded as a two-dimensional discrete function, and the image gradient is actually the derivative of this two-dimensional discrete function. Specifically:

[0188] Image gradient: G(x,y)=dx(i,j)+dy(i,j);

[0189] dx(i,j)=I(i+1,j)-I(i,j);

[0190] dy(i,j)=I(i,j+1)-I(i,j);

[0191] Among them, I is the value of the image pixel (such as RGB value), and (i, j) is the coordinate of the pixel.

[0192] Image gradient can generally also be calculated using median difference:

[0193] dx(i,j)=[I(i+1,j)-I(i-1,j)] / 2;

[0194] dy(i,j)=[I(i,j+1)-I(i,j-1)] / 2;

[0195] Image edges are generally achieved by performing gradient operations on the image.

[0196] In an embodiment of the present application, an image enhancement algorithm Mosaic is introduced to increase the feature content of the image input to the model, increase the training width of the model, effectively reduce the misrecognition of low-quality documents, and at the same time, increase the recall of images to be detected taken in difficult scenes such as poor lighting, thereby improving the overall accuracy and recall rate of document quality recognition.

[0197] In summary, the present application provides a document quality analysis device 200, including: a training data acquisition module 210, used to acquire model training data, the model training data including high-quality labels, high-quality document images corresponding to the high-quality labels, and high-quality gradient maps corresponding to the high-quality document images, low-quality labels, and low-quality document images corresponding to the low-quality labels; a gradient map prediction model training module 220, used to input the high-quality document image and the high-quality gradient map into the initial gradient map prediction model for gradient map model training operations to obtain a target gradient map prediction model; a quality analysis model training module 230, used to train the model according to the high-quality labels, high-quality documents, and high-quality gradient maps. The document quality training operation is performed on the initial document quality analysis model using the image, low-quality label and low-quality document image to obtain the target document quality analysis model; the document acquisition module 240 to be analyzed is used to obtain the document image to be analyzed; the gradient map prediction module 250 is used to input the document image to be analyzed into the target gradient map prediction model to perform the gradient map prediction operation to obtain the gradient map of the document to be analyzed; the document quality analysis module 260 is used to input the gradient map of the document to be analyzed into the target document quality analysis model to perform the document quality analysis operation to obtain the document quality analysis result corresponding to the document image to be analyzed; the result output module 270 is used to output the document quality analysis result. The present application starts with the gradient information of the document image, pre-trains a gradient map prediction model for obtaining the gradient map of the document image to be identified, and a document quality analysis model that fully utilizes the fine-grained features of the document image with good quality and the document image with poor quality to perform document quality analysis. When the document image needs to be analyzed, the fine-grained features of the document image are obtained through the gradient map prediction model, and the document quality analysis operation is implemented according to the document quality analysis model, so that the document quality analysis is more efficient, more robust and more distinguishable. At the same time, by performing adaptive binarization, corrosion and dilation operations and segmentation operations on the document image to be analyzed, the document image to be analyzed is divided into specific regions, and a small-sized image with text as the main area is obtained, thereby effectively ensuring the efficiency and accuracy of subsequent text box detection operations; the document image to be analyzed is standardized through the above-mentioned size adjustment and segmentation processing, so that the input data of the target gradient map prediction model meets the requirements of the model; the image enhancement algorithm Mosaic is introduced to increase the feature content of the image input to the model, increase the training width of the model, effectively reduce the misrecognition of low-quality documents, and at the same time, increase the recall of images to be detected taken in difficult scenes such as bad light, thereby improving the overall accuracy and recall of document quality recognition.

[0198] To solve the above technical problems, the present application also provides a computer device. Fig.12 , Fig.12 This is a basic structural block diagram of the computer device in this embodiment.

[0199] The computer device 300 includes a memory 310, a processor 320, and a network interface 330 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 300 having components 310-330, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0200] The computer device may be a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with the user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0201] The memory 310 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 310 can be an internal storage unit of the computer device 300, such as a hard disk or memory of the computer device 300. In other embodiments, the memory 310 can also be an external storage device of the computer device 300, such as a plug-in hard disk equipped on the computer device 300, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. Of course, the memory 310 can also include both the internal storage unit of the computer device 300 and its external storage device. In this embodiment, the memory 310 is generally used to store the operating system and various application software installed on the computer device 300, such as computer-readable instructions of the document quality analysis method, etc. In addition, the memory 310 can also be used to temporarily store various data that have been output or will be output.

[0202] The processor 320 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 320 is generally used to control the overall operation of the computer device 300. In this embodiment, the processor 320 is used to run the computer-readable instructions stored in the memory 310 or process data, such as computer-readable instructions for running the document quality analysis method.

[0203] The network interface 330 may include a wireless network interface or a wired network interface. The network interface 330 is generally used to establish a communication connection between the computer device 300 and other electronic devices.

[0204] The computer device provided by the present application starts with the gradient information of the document image, pre-trains a gradient map prediction model for obtaining the gradient map of the document image to be identified, and a document quality analysis model that fully utilizes the fine-grained features of good quality document images and poor quality document images for document quality analysis. When it is necessary to analyze the document image, the fine-grained features of the document image are obtained through the gradient map prediction model, and the document quality analysis operation is implemented according to the document quality analysis model, so that the document quality analysis is more efficient, more robust and more discriminative.

[0205] The present application also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the document quality analysis method as described above.

[0206] The computer-readable storage medium provided by the present application starts with the gradient information of the document image, pre-trains a gradient map prediction model for obtaining the gradient map of the document image to be identified, and a document quality analysis model that fully utilizes the fine-grained features of good-quality document images and poor-quality document images for document quality analysis. When it is necessary to analyze the document image, the fine-grained features of the document image are obtained through the gradient map prediction model, and the document quality analysis operation is implemented according to the document quality analysis model, so that the document quality analysis is more efficient, more robust and more discriminative.

[0207] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0208] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A document quality analysis method, characterized in that: The steps include: Acquire model training data, wherein the model training data includes a high-quality label, a high-quality document image corresponding to the high-quality label and a high-quality gradient map corresponding to the high-quality document image, a low-quality label and a low-quality document image corresponding to the low-quality label; Inputting the high-quality document image and the high-quality gradient map into an initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model; Performing a document quality training operation on an initial document quality analysis model according to the high-quality label, the high-quality document image, the low-quality label, and the low-quality document image to obtain a target document quality analysis model; Obtaining a document image to be analyzed; Inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed; Inputting the document gradient image to be analyzed into the target document quality analysis model to perform a document quality analysis operation, and obtaining a document quality analysis result corresponding to the document image to be analyzed; Outputting the document quality analysis result; The step of inputting the high-quality document image and the high-quality gradient map into the initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model specifically includes the following: Inputting the high-quality document image into the initial gradient map prediction model to perform a gradient map prediction operation to obtain a predicted gradient map; Constructing a gradient map loss function according to the high-quality gradient map and the predicted gradient map And contrast gradient loss function ; According to the gradient map loss function And contrast gradient loss function Performing model training on the initial gradient map prediction model to obtain the target gradient map prediction model; The initial gradient map prediction model is composed of a gradient amplitude feature extraction module and a spatial semantic feature extraction module. The step of inputting the high-quality document image into the initial gradient map prediction model to perform a gradient map prediction operation to obtain a predicted gradient map specifically includes the following steps: The high-quality document image is input into the gradient amplitude feature extraction module to obtain the horizontal gradient amplitude feature And the vertical gradient amplitude characteristics ; The high-quality document image is input into the spatial semantic feature extraction module to obtain the spatial semantic feature ; The horizontal gradient amplitude feature , the vertical gradient amplitude feature And the spatial semantic features A normalization operation is performed to obtain the gradient map of the document to be analyzed, wherein the gradient map y of the document to be analyzed is expressed as: ; in, yes The result after 1x1 convolution fusion channel, is the normalization operation, is the activation ReLU operation.

2. The document quality analysis method according to claim 1, characterized in that: After the step of acquiring the document image to be analyzed, and before the step of inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain the gradient map of the document to be analyzed, the method further includes the following steps: Performing an adaptive binarization operation on the document image to be analyzed to obtain a binarized document image; Performing an erosion and dilation operation on the binary document image to obtain a document image edge line; Segmenting the document image to be analyzed according to the edge lines of the document image to obtain a sub-image of the document to be analyzed; The step of inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain the gradient map of the document to be analyzed specifically includes the following steps: The document sub-image to be analyzed is input into the target gradient map prediction model to perform the gradient map prediction operation to obtain the document gradient map to be analyzed.

3. The document quality analysis method according to claim 1, characterized in that: After the step of acquiring the document image to be analyzed, and before the step of inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain the gradient map of the document to be analyzed, the method further includes the following steps: Resizing the document image to be analyzed in a manner that the aspect ratio remains unchanged, to obtain a standard-sized image; Segmenting the standard size image according to a preset size to obtain a pre-processed document image; The step of inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain the gradient map of the document to be analyzed specifically includes the following steps: The preprocessed document image is input into the target gradient map prediction model to perform the gradient map prediction operation to obtain the gradient map of the document to be analyzed.

4. The document quality analysis method according to claim 1, characterized in that: After the step of acquiring the model training data, and before the step of inputting the high-quality document image and the high-quality gradient map into the initial gradient map prediction model to perform a gradient map model training operation and obtaining a target gradient map prediction model, the method further includes the following steps: Performing an image enhancement operation on the high-quality document image to obtain an enhanced document image; Performing a gradient map calculation operation on the enhanced document image according to a two-dimensional discrete function derivation method to obtain an enhanced gradient map; The step of inputting the high-quality document image and the high-quality gradient map into the initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model specifically includes the following steps: The enhanced document image and the enhanced gradient map are input into the initial gradient map prediction model to perform the gradient map model training operation to obtain the target gradient map prediction model.

5. The document quality analysis method according to claim 1, characterized in that: After the step of inputting the document gradient map to be analyzed into the target document quality analysis model to perform a document quality analysis operation to obtain a document quality analysis result corresponding to the document image to be analyzed, the following steps are also included: The document image to be analyzed and the document quality analysis result are stored in the blockchain.

6. A document quality analysis device, characterized in that: include: A training data acquisition module, used to acquire model training data, wherein the model training data includes a high-quality label, a high-quality document image corresponding to the high-quality label and a high-quality gradient map corresponding to the high-quality document image, a low-quality label and a low-quality document image corresponding to the low-quality label; A gradient map prediction model training module, used for inputting the high-quality document image and the high-quality gradient map into an initial gradient map prediction model to perform a gradient map model training operation to obtain a target gradient map prediction model; A quality analysis model training module, used to perform a document quality training operation on an initial document quality analysis model according to the high-quality label, the high-quality document image, the low-quality label and the low-quality document image to obtain a target document quality analysis model; The module for acquiring the document to be analyzed is used to acquire the image of the document to be analyzed; A gradient map prediction module, used for inputting the document image to be analyzed into the target gradient map prediction model to perform a gradient map prediction operation to obtain a gradient map of the document to be analyzed; A document quality analysis module, used for inputting the document gradient image to be analyzed into the target document quality analysis model to perform a document quality analysis operation, and obtaining a document quality analysis result corresponding to the document image to be analyzed; A result output module, used to output the document quality analysis result; The gradient map prediction model training module includes: a gradient map prediction submodule, a loss function construction submodule and a gradient map prediction model training submodule, wherein: The gradient map prediction submodule is used to input the high-quality document image into the initial gradient map prediction model to perform a gradient map prediction operation to obtain a predicted gradient map; The loss function construction submodule is used to construct a gradient map loss function based on the high-quality gradient map and the predicted gradient map And contrast gradient loss function ; The gradient map prediction model training submodule is used to train the gradient map prediction model according to the gradient map loss function. And contrast gradient loss function Performing model training on the initial gradient map prediction model to obtain the target gradient map prediction model; The initial gradient map prediction model is composed of a gradient amplitude feature extraction module and a spatial semantic feature extraction module. The gradient map prediction submodule includes: a feature extraction unit, a semantic feature acquisition unit and a normalization unit, wherein: The feature extraction unit is used to input the high-quality document image into the gradient amplitude feature extraction module to obtain the horizontal gradient amplitude feature. And the vertical gradient amplitude characteristics ; The high-quality document image is input into the spatial semantic feature extraction module to obtain the spatial semantic feature ; The horizontal gradient amplitude feature , the vertical gradient amplitude feature And the spatial semantic features A normalization operation is performed to obtain the gradient map of the document to be analyzed, wherein the gradient map y of the document to be analyzed is expressed as: ; in, yes The result after 1x1 convolution fusion channel, is the normalization operation, is the activation ReLU operation.

7. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the document quality analysis method according to any one of claims 1 to 5 when executing the computer-readable instructions.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the document quality analysis method according to any one of claims 1 to 5 are implemented.