A document correction method and device and a storage medium

By employing a lightweight network architecture and multi-layer linear processing, the problem of poor document capture quality in paperless offices has been solved, enabling efficient document correction and rapid processing.

CN118711190BActive Publication Date: 2026-01-13GUANGDONG ESHORE TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310313284.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-27
Publication Date
2026-01-13
Estimated Expiration
2043-03-27

AI Technical Summary

Technical Problem

In the process of paperless office, poor image quality makes document correction difficult and affects the efficiency of subsequent task processing.

Method used

A lightweight network architecture, including SENet and residual networks, is adopted. Documents are corrected through convolutional compression and pooling. Multiple linear layers are combined for classification weighting to determine the target range of the document and perform rotation and magnification processing.

Benefits of technology

It improves the accuracy and robustness of document correction, reduces the consumption of computing resources, and is suitable for fast processing on mobile devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118711190B_ABST
    Figure CN118711190B_ABST
Patent Text Reader

Abstract

The application discloses a document correction method and device and a storage medium. The application obtains an image document, performs convolution compression processing on the image document through a lightweight network architecture to obtain an output image; the lightweight network architecture comprises at least one lightweight network, each lightweight network comprises an SE network and a residual network, the input of the lightweight network is subjected to first convolution processing through the residual network, the first convolution processing result is subjected to compression activation processing through the SE network, the output of the lightweight network is obtained according to the input of the lightweight network and the compression activation processing result, and the lightweight network architecture can ensure a certain accuracy rate and speed up the processing speed through the lightweight network; the output image is subjected to pooling processing, the pooling processing result is subjected to classification weighting processing according to multiple linear layers to obtain a corrected document, and the integration of the multiple linear layers is beneficial to improving the robustness and obtaining a corrected document with good effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence, and in particular to a document correction method, apparatus and storage medium. Background Technology

[0002] In recent years, with the development of electronic products, paperless processes are often promoted in daily office work and business transactions for convenience and environmental protection. Examples include taking photos of invoices and ID cards, then using OCR to extract text information from the uploaded images, or integrating document scanning functionality into mobile devices for scanning and uploading. However, both methods are highly dependent on the quality of the uploaded images. If the images are tilted or distorted, it will cause difficulties for downstream tasks. Therefore, an effective correction method is needed. Summary of the Invention

[0003] In view of this, in order to solve at least one of the above-mentioned technical problems, the object of the present invention is to provide a document correction method, apparatus, device and storage medium.

[0004] This invention provides a document correction method, including:

[0005] Get image documents;

[0006] The image document is subjected to convolutional compression processing using a lightweight network architecture to obtain an output image. The lightweight network architecture includes at least one lightweight network, each of which includes SEnet and a residual network. The lightweight network is used to perform image processing on its input. The image processing includes: performing a first convolutional processing on the input of the lightweight network through the residual network; performing compression activation processing on the first convolutional processing result through SEnet; and obtaining the output of the lightweight network based on the input of the lightweight network and the compression activation processing result.

[0007] The output image is subjected to pooling processing, and the pooling results are classified and weighted according to multiple linear layers to obtain the corrected document.

[0008] Furthermore, the lightweight network framework includes multiple lightweight network modules connected in sequence, and each lightweight network module includes at least one of the lightweight networks; the convolutional compression processing of the image document to obtain the output image includes:

[0009] Perform a second convolution process on the image document;

[0010] The second convolution processing result is used to perform several convolution pooling processes; wherein, each convolution pooling process result is input to a lightweight network module, the outputs of the first preset number of the lightweight network modules are used as new second convolution processing results for the convolution pooling process, and the last lightweight network module outputs the output image.

[0011] Furthermore, the convolutional pooling process includes:

[0012] The result of the second convolution is pooled, and the pooling result is then convolved.

[0013] Furthermore, the compression activation processing of the first convolution result using SEnet includes:

[0014] The first convolution result is compressed using the SEnet;

[0015] Based on the first activation function and the compression result, the activation result is obtained;

[0016] Multiply the activation result by the number of channels in the first convolution process result.

[0017] Furthermore, obtaining the output of the lightweight network based on the input of the lightweight network and the result of the compressed activation processing includes:

[0018] The input to the lightweight network and the multiplication result are added together;

[0019] The output of the lightweight network is obtained by processing the summation result using a second activation function.

[0020] Furthermore, the step of classifying and weighting the pooling results according to multiple linear layers to obtain the corrected document includes:

[0021] The pooling results are classified using the first linear layer, and the first classification results are processed using the third activation function to obtain the first output coefficient and the second output coefficient.

[0022] The pooling results are classified a second time using a second linear layer, and a third time using a third linear layer.

[0023] The detection result is obtained by weighting the second classification result, the first output coefficient, the third classification result, and the second output coefficient.

[0024] The detection results are then corrected to obtain a corrected document.

[0025] Furthermore, the step of correcting the detection results to obtain a corrected document includes:

[0026] The target range of the detected object is determined based on the detection results; the detection results include the coordinates of several vertices of the detected object.

[0027] The content within the target area is rotated and / or enlarged to obtain the corrected document.

[0028] This invention also provides a document correction device, comprising:

[0029] The acquisition module is used to acquire image documents;

[0030] A processing module is used to perform convolutional compression processing on the image document using a lightweight network architecture to obtain an output image; wherein, the lightweight network architecture includes at least one lightweight network, each lightweight network including SEnet and a residual network, the lightweight network is used to perform image processing on the input of the lightweight network, the image processing includes: performing a first convolution processing on the input of the lightweight network through the residual network, performing compression activation processing on the first convolution processing result through SEnet, and obtaining the output of the lightweight network based on the input of the lightweight network and the compression activation processing result;

[0031] The correction module is used to perform pooling processing on the output image, and to classify and weight the pooling processing results according to multiple linear layers to obtain the corrected document.

[0032] This invention also provides a document correction device, which includes a processor and a memory. The memory stores at least one instruction, at least one program, a code set, or an instruction set. The at least one instruction, the at least one program, the code set, or the instruction set are loaded and executed by the processor to implement the method.

[0033] This invention also provides a computer-readable storage medium storing at least one instruction, at least one program, a code set, or an instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the method.

[0034] The beneficial effects of this invention are:

[0035] By acquiring an image document, a lightweight network architecture is used to perform convolutional compression processing on the image document to obtain an output image. The lightweight network architecture includes at least one lightweight network, each of which includes SENet and a residual network. The lightweight network is used to process the image input of the lightweight network. The image processing includes: performing a first convolution processing on the input of the lightweight network through the residual network; performing compression activation processing on the first convolution processing result through SENet; and obtaining the output of the lightweight network based on the input of the lightweight network and the compression activation processing result. The lightweight network architecture can maintain a certain accuracy while reducing the number of parameters, thereby accelerating processing speed and saving computing resources, which is beneficial to meeting the needs of mobile devices. The output image is then subjected to pooling processing, and the pooling processing result is classified and weighted according to multiple linear layers to obtain a corrected document. Integrating multiple linear layers improves robustness, resulting in a well-corrected document.

[0036] To better understand and implement this invention, the following detailed description is provided in conjunction with the accompanying drawings. Attached Figure Description

[0037] Figure 1 This is a flowchart illustrating the steps of the document correction method of the present invention;

[0038] Figure 2 This is a schematic diagram of the detection model in a specific embodiment of the present invention;

[0039] Figure 3 This is a schematic diagram of a lightweight network according to a specific embodiment of the present invention;

[0040] Figure 4 This is a schematic diagram illustrating the effect of document correction according to a specific embodiment of the present invention;

[0041] Figure 5 This is a schematic diagram of training data for a specific embodiment of the present invention. Detailed Implementation

[0042] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0043] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0044] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0045] like Figure 1 As shown, this embodiment of the invention provides a document correction method, including steps S100-S300:

[0046] S100, Obtain image document.

[0047] It should be noted that the image document is the document to be corrected; the image document can be an image or a document containing image content, and the image contains the object to be detected, such as a ticket, a book, etc., without specific limitations.

[0048] S200: The image document is compressed using a lightweight network architecture to obtain the output image.

[0049] Optionally, the lightweight network architecture includes multiple lightweight network modules connected in sequence, and each lightweight network module includes at least one lightweight network. It should be noted that each lightweight network includes SEnet (Squeeze-and-Excitation Networks) and a residual network. The residual network includes, but is not limited to, ResNet. In this embodiment of the invention, ResNet is used as the residual network, therefore the lightweight network can be referred to as SE-ResNet.

[0050] like Figure 2As shown, the detection model of this embodiment includes a lightweight network architecture 100 and a detection architecture 200. Taking the lightweight network architecture 100 as an example, it includes four lightweight network modules: a first lightweight network module 101, a second lightweight network module 102, a third lightweight network module 103, and a fourth lightweight network module 104. The first lightweight network module 101 includes one lightweight network, the second lightweight network module 102 includes two lightweight networks, the third lightweight network module 103 includes two lightweight networks, and the fourth lightweight network module 104 includes four lightweight networks. It should be noted that when a lightweight network module includes multiple lightweight networks, the output of the previous lightweight network serves as the input of the next lightweight network.

[0051] In this embodiment of the invention, step S200 involves performing convolutional compression on the image document to obtain the output image, including steps S210-S220:

[0052] S210. Perform a second convolution process on the image document.

[0053] like Figure 2 As shown, the image document input to the lightweight network architecture 100 is subjected to two convolutional processes to obtain the second convolutional processing result.

[0054] S220. Perform several convolutional pooling processes based on the second convolutional processing result; wherein, each convolutional pooling result is input into a lightweight network module, the outputs of the first preset number of lightweight network modules are used as new second convolutional processing results for convolutional pooling processing, and the last lightweight network module outputs the output image.

[0055] Optionally, the convolutional pooling process involves pooling the result of the second convolutional process and then convolutionally performing a convolution on the pooled result to obtain the final convolutional pooling result. In this embodiment of the invention, each convolutional pooling result is input into a lightweight network module. For example, a convolutional pooling result is input into a lightweight network module, which processes the data to obtain an output. This output is then used as a new second convolutional result for another convolutional pooling process. This second convolutional pooling result is then input into another lightweight network module, and its output is again used as a new second convolutional result for another convolutional pooling process. It should be noted that the outputs of the first predetermined number of lightweight network modules are used as new second convolutional results for convolutional pooling, while the last lightweight network module is used to output the final image.

[0056] by Figure 2For example, the result of the first convolutional pooling process is input to the first lightweight network module 101, and the output of the first lightweight network module 101 is used as the new second convolutional processing result for the second convolutional pooling process; the result of the second convolutional pooling process is input to the second lightweight network module 102, and the output of the second lightweight network module 102 is used as the new second convolutional processing result for the third convolutional pooling process; the result of the third convolutional pooling process is input to the third lightweight network module 103, and the output of the third lightweight network module 103 is used as the new second convolutional processing result for the fourth convolutional pooling process; the result of the fourth convolutional pooling process is input to the fourth lightweight network module 104, which is the last lightweight network module, and therefore the fourth lightweight network module 104 outputs the image.

[0057] like Figure 3 As shown, the dashed box represents SENet, and the remaining portion represents the residual network. In this embodiment of the invention, the lightweight network is used to perform image processing on the input of the lightweight network. The image processing includes: performing a first convolution on the input of the lightweight network through the residual network, performing compression activation processing on the result of the first convolution through SENet, and obtaining the output of the lightweight network based on the input of the lightweight network and the result of the compression activation processing.

[0058] like Figure 3 As shown, the size of image features is represented by three parameters: H, W, and C, where H is the height, W is the width, and C is the number of channels. Optionally, the input X of the lightweight network is subjected to a first convolution process through a residual network. Specifically, X is convolved, activated by the ReLU activation function, and then convolved again to obtain the first convolution result Y.

[0059] like Figure 3 As shown, optionally, the first convolution processing result is subjected to compression activation processing using SENet, including steps S230-S250:

[0060] S230. Compress the first convolution result using SEnet.

[0061] Specifically, SEnet is used to perform global pooling on the first convolution result Y to compress the first convolution result Y. The size of the compressed result is represented as 1×1×C.

[0062] S240. Based on the first activation function and the compression result, the activation result is obtained.

[0063] Optionally, the first activation function is the sigmoid activation function. The compressed result is passed through two fully connected layers, and the output of the fully connected layers is limited to the range of 0-1 by the sigmoid activation function, thereby activating the compressed result and obtaining the activation result.

[0064] S250. Multiply the activation result by the number of channels in the first convolution processing result.

[0065] Optionally, the activation result is multiplied by the number of channels C of the first convolution result Y to obtain the multiplied result Z. It should be noted that through the above processing, SENet can learn and control the magnitude of the coefficients output by the sigmoid activation function, minimizing the SENet loss, increasing the nonlinearity of SENet, and improving its generalization ability.

[0066] Optionally, the output of the lightweight network is obtained based on the input of the lightweight network and the result of the compressed activation processing, including steps S260-S270:

[0067] S260. Add the input of the lightweight network and the multiplication result together.

[0068] S270. The addition result is processed by the second activation function to obtain the output of the lightweight network.

[0069] Optionally, the second activation function includes, but is not limited to, the ReLU activation function. Specifically, the input X of the lightweight network and the multiplication result are added together by Z, and the addition result is processed by the ReLU activation function to obtain the output of the lightweight network.

[0070] It should be noted that, in this embodiment of the invention, SENet and ResNet are combined, and a hop-through connection method is used to add the input of SENet to the input of ResNet. SENet models the correlation between feature channels, enhances important features and weakens unimportant features, making the extracted features more targeted. The lightweight network learns which are identity transformations, which increases the depth at which the lightweight network can be effectively trained and increases the robustness of the lightweight network.

[0071] S300. Perform pooling processing on the output image, and classify and weight the pooling results according to multiple linear layers to obtain the corrected document.

[0072] like Figure 2 As shown, the output image of the lightweight network architecture 100 is input to the detection architecture 200 for pooling processing. Optionally, in step S300, the pooling processing result is classified and weighted according to multiple linear layers to obtain the corrected document, including steps S310-S340:

[0073] S310. The pooling result is classified by the first linear layer, and the first classification result is processed by the third activation function to obtain the first output coefficient and the second output coefficient.

[0074] like Figure 2 As shown, this embodiment of the invention takes a three-linear-layer model as an example: a first linear layer l1, a second linear layer l1, and a third linear layer l2. Optionally, the third activation function includes, but is not limited to, the sigmoid activation function. Specifically, the pooling result is classified by the first linear layer, and the first classification result is processed by the sigmoid activation function. The sigmoid activation function restricts the output of the first linear layer l1 to between 0 and 1, thereby obtaining the first output coefficient 1-c and the second output coefficient c.

[0075] S320. The pooling results are classified in the second linear layer and in the third linear layer.

[0076] Specifically, the pooling results are classified in the second linear layer l1 and in the third linear layer l2.

[0077] S330. The detection result is obtained by weighting the second classification result, the first output coefficient, the third classification result, and the second output coefficient.

[0078] Specifically, the formula for calculating the test results is as follows:

[0079] Detection result = Second classification result × (1-c) + Third classification result × c.

[0080] It should be noted that the detection results include the coordinates of several vertices of the detected object. For example, Figure 2 As shown, the final detection result is 1×8 in size, with a total of four vertex coordinates. Assuming the object to be detected in the image document is a ticket, the result obtained is the coordinates of the four vertices of the ticket, for a total of 8 values.

[0081] The document correction method of this invention directly detects the coordinates of the four vertices of the object in the image document by using document corner regression based on SENet. Considering that most applications are on mobile devices, this invention combines the network structure of ResNet and adds multiple linear layers at the output. The structure of multiple linear layers can effectively increase the nonlinearity of the detection model, improve the robustness of the detection model, reduce model parameters, speed up inference, and save computing resources, thus meeting the deployment requirements of mobile devices.

[0082] S340. Correct the test results to obtain a correction document.

[0083] Optionally, step S340 includes steps S3401-S3402:

[0084] S3401. Determine the target range of the test object based on the test results.

[0085] S3402. Rotate and / or enlarge the content of the target area to obtain the corrected document.

[0086] For example, when the object to be detected is a ticket, the target area of ​​the ticket can be determined based on the coordinates of its four vertices. Then, the content of the target area can be rotated and / or enlarged to display the content of the target area at the size of an image document, thus obtaining a corrected document. Figure 4 The diagram illustrates the effect of the document correction method according to an embodiment of the present invention. 401 represents various types of image documents, 402 represents the detection results obtained for the image documents, and 403 represents the final corrected document. It can be seen that the detection model exhibits very stable detection results for image documents of different sizes and backgrounds of varying complexity. To more intuitively observe the detection results, the coordinates of each vertex are connected in 402 to show the target range of the detected object.

[0087] Optionally, the detection model in this embodiment of the invention is pre-trained through the following steps S410-S450:

[0088] S410, Obtain training data.

[0089] Optionally, the training data can be images containing the object to be detected. For example, if the object to be detected is a ticket, the four points of the ticket are marked, the ticket is cropped out, rotated at a certain angle, and then composited into different backgrounds to obtain several composite images as training data. For example, Figure 5 As shown, 501 represents the labeled ticket, and 502 represents the composite image synthesized into different backgrounds as training data. The coordinates of the rotated ticket can be calculated from the original coordinates and the rotation angle, thus increasing the diversity of the training data, simplifying data labeling, and saving data labeling time.

[0090] S420. Construct a detection model.

[0091] The detection models include a lightweight network architecture 100 and a detection architecture 200.

[0092] S430. Construct the loss function.

[0093] In this embodiment of the invention, mean squared error loss is used to measure the error between the true value and the predicted value. The calculation formula is as follows:

[0094] loss=(x i -y i ) 2

[0095] Where loss is the loss value of the loss function, x i The actual values ​​are the coordinates of the four points on the ticket, y i The predicted value is the detection result obtained from the detection structure, which also includes the coordinates of four points.

[0096] S440, Model Training.

[0097] Optionally, to find the optimal point of the detection model, an Adam optimizer is incorporated into the training process to repeatedly train the detection model and update its parameters. Furthermore, using cosine annealing to update the learning rate helps accelerate the convergence of the detection model. Optionally, during the continuous adjustment of the detection model's parameters, training ends when the loss value of the loss function is less than a loss threshold, resulting in the trained detection model.

[0098] S450, Model Reasoning.

[0099] Optionally, after training, the detection model can be converted from a dynamic graph model to a static graph model to improve the model's inference efficiency. Then, MKLDNN can be used to accelerate the CPU's inference speed. In a 2C8G environment, the inference speed only needs 0.1s. In addition, the final saved model size is less than 6.4m, which meets the usage needs of different scenarios.

[0100] The detection model of this invention has low training cost and controllable training results. For some more complex scenarios, even if the model detection results are different, they can be manually adjusted.

[0101] This invention also provides a document correction device, comprising:

[0102] The acquisition module is used to acquire image documents;

[0103] The processing module is used to perform convolutional compression processing on an image document using a lightweight network architecture to obtain an output image. The lightweight network architecture includes at least one lightweight network, each lightweight network including SEnet and a residual network. The lightweight network is used to perform image processing on the input of the lightweight network. The image processing includes: performing a first convolution processing on the input of the lightweight network through the residual network, performing compression activation processing on the first convolution processing result through SEnet, and obtaining the output of the lightweight network based on the input of the lightweight network and the compression activation processing result.

[0104] The correction module is used to perform pooling processing on the output image. It classifies and weights the pooling results according to multiple linear layers to obtain the corrected document.

[0105] The content of the above method embodiments is applicable to the device embodiments. The specific functions implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments, so they will not be repeated here.

[0106] This invention also provides another document correction device, which includes a processor and a memory. The memory stores at least one instruction, at least one program, code set, or instruction set. The processor loads and executes the at least one instruction, at least one program, code set, or instruction set to implement the document correction method of the foregoing embodiments.

[0107] The content of the above method embodiments is applicable to the device embodiments. The specific functions implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments, so they will not be repeated here.

[0108] This invention also provides a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the document correction method of the foregoing embodiments.

[0109] This invention also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the document correction method of the foregoing embodiments.

[0110] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0111] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0112] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms. Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, i.e., they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs. Additionally, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units.

[0113] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0114] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A document correction method, characterized in that, include: Get image documents; The image document is subjected to convolutional compression processing using a lightweight network architecture to obtain an output image. The lightweight network architecture includes at least one lightweight network, each of which includes SEnet and a residual network. The lightweight network is used to process the image input, which includes: performing a first convolution on the input of the lightweight network through the residual network; performing compression activation processing on the first convolution result through SEnet; and obtaining the output of the lightweight network based on the input and the compression activation processing result. The output of the last lightweight network in the lightweight network architecture is the output image. The output image is subjected to pooling processing, and the pooling results are classified and weighted according to multiple linear layers to obtain the corrected document, including: The pooling result is classified by the first linear layer, and the first classification result is processed by the third activation function to obtain the first output coefficient (1-c) and the second output coefficient c. The pooling results are classified using a second linear layer and a third linear layer; the second and third classifications are used to classify the vertex coordinates. The detection result is obtained by weighting the second classification result, the first output coefficient, the third classification result, and the second output coefficient. The formula is: Detection result = Second classification result × (1-c) + Third classification result × c; The detection results are corrected to obtain a corrected document. Specifically, the target range of the detection object is determined based on the detection results, and the content of the target range is rotated and / or enlarged to obtain the corrected document. The detection results include the coordinates of several vertices of the detection object.

2. The document correction method according to claim 1, characterized in that: The lightweight network framework includes multiple lightweight network modules connected in sequence, and each lightweight network module includes at least one of the lightweight networks; the convolutional compression processing of the image document to obtain an output image includes: Perform a second convolution process on the image document; The second convolution processing result is used to perform several convolution pooling processes; wherein, each convolution pooling process result is input to a lightweight network module, the outputs of the first preset number of lightweight network modules are used as new second convolution processing results for the convolution pooling process, and the last lightweight network module outputs the output image, and the output of the lightweight network module is the output of the last lightweight network it contains.

3. The document correction method according to claim 2, characterized in that: The convolutional pooling process includes: The result of the second convolution is pooled, and the pooling result is then convolved.

4. The document correction method according to any one of claims 1-3, characterized in that: The compression activation process performed on the first convolution result using SEnet includes: The first convolution result is compressed using the SEnet; Based on the first activation function and the compression result, the activation result is obtained; Multiply the activation result by the number of channels in the first convolution process result.

5. The document correction method according to claim 4, characterized in that: The step of obtaining the output of the lightweight network based on the input of the lightweight network and the result of the compressed activation process includes: The input to the lightweight network and the multiplication result are added together; The output of the lightweight network is obtained by processing the summation result using a second activation function.

6. A document correction device, characterized in that, include: The acquisition module is used to acquire image documents; A processing module is used to perform convolutional compression processing on the image document using a lightweight network architecture to obtain an output image; wherein, the lightweight network architecture includes at least one lightweight network, each lightweight network including SEnet and a residual network, the lightweight network is used to perform image processing on the input of the lightweight network, the image processing includes: performing a first convolution processing on the input of the lightweight network through the residual network, performing compression activation processing on the first convolution processing result through SEnet, obtaining the output of the lightweight network based on the input of the lightweight network and the compression activation processing result, and the output of the last lightweight network in the lightweight network architecture is the output image; The correction module is used to perform pooling processing on the output image, and to classify and weight the pooling results according to multiple linear layers to obtain a corrected document, including: The pooling result is classified by the first linear layer, and the first classification result is processed by the third activation function to obtain the first output coefficient (1-c) and the second output coefficient c. The pooling results are classified using a second linear layer and a third linear layer; the second and third classifications are used to classify the vertex coordinates. The detection result is obtained by weighting the second classification result, the first output coefficient, the third classification result, and the second output coefficient. The formula is: Detection result = Second classification result × (1-c) + Third classification result × c; The detection results are corrected to obtain a corrected document. Specifically, the target range of the detection object is determined based on the detection results, and the content of the target range is rotated and / or enlarged to obtain the corrected document. The detection results include the coordinates of several vertices of the detection object.

7. A document correction device, characterized in that: The document correction device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set, or instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Image correction method and device, electronic equipment and storage medium

    CN114155546A