Sample generation method and device for distorted document image, medium and product

By performing random distortion processing and key point detection on the template image, distorted document image training data is automatically generated, which solves the problem of high cost of manual labeling and achieves efficient and low-cost training data generation.

CN120635912APending Publication Date: 2025-09-12TAIKANG ONLINE HEALTH TECH (WUHAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510748254.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

When generating distorted document image training data, existing technologies have high manual labeling costs and low efficiency, and the data scale is limited, resulting in insufficient model generalization capabilities.

Method used

By performing random distortion processing on the template image, key point detection is automatically performed to generate dense point annotation information, and the same distortion parameters are applied to process the normal document image to generate distorted document image samples.

Benefits of technology

High-quality dense point set annotation data of distorted document images can be efficiently obtained without human intervention, saving manpower and time costs and improving the diversity and scale of training data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120635912A_ABST
    Figure CN120635912A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a sample generation method and device for a distorted document image, a medium and a product, and the method comprises the steps: determining a template image, carrying out the distortion processing of the template image according to a random distortion parameter, and obtaining a distorted template image; carrying out key point detection processing on the distortion template image to obtain corresponding dense point labeling information; performing distortion processing on the normal document image according to the same random distortion parameter to obtain a distorted document image, and further generating a data sample based on the distorted document image and the dense point labeling information; according to the method, a relatively difficult dense point labeling problem on a distorted document image is converted into a relatively simple key point detection problem on a template distorted image, so that when a data sample of a document image distortion correction technology is obtained, the distortion of the distorted document image is corrected; high-quality distorted document image dense point set annotation data can be automatically obtained without manual intervention, so that a large amount of manpower cost and time cost are saved.
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, and in particular to a method, device, medium and product for generating samples of distorted document images. Background Art

[0002] In business scenarios like insurance claims, document images uploaded by customers often become distorted, tilted, or incomplete due to factors such as shooting angle, paper deformation, and environmental interference. This significantly reduces the accuracy of Optical Character Recognition (OCR). Existing solutions primarily rely on document image dedistortion technology to address OCR errors caused by image distortion.

[0003] Document image distortion correction technology mainly performs geometric transformation on document images to restore document images to a relatively flat structure, so that OCR recognition technology can better recognize text in document images and extract information, thereby improving the accuracy of text recognition and information extraction in documents.

[0004] Currently, document image dewarping technology is typically implemented based on dense point regression models. Training these models requires manual annotation to generate training samples. However, manual annotation is prone to errors, and data size is limited. The labor and time required to perform massive annotations can lead to insufficient model generalization. Therefore, the challenge is to generate high-fidelity, diverse training data for distorted document images at low cost. Summary of the Invention

[0005] The sample generation method, device, medium and product of distorted document images provided in the embodiments of the present application can convert the relatively difficult problem of dense point labeling on distorted document images into the relatively simple problem of key point detection on template distorted images, so that when obtaining data samples for document image distortion correction technology, high-quality distorted document image dense point set labeling data can be automatically obtained without human intervention, thereby saving a lot of manpower and time costs.

[0006] In a first aspect, an embodiment of the present application provides a method for generating a sample of a distorted document image, the method comprising:

[0007] Determining a template image, and performing distortion processing on the template image according to a random distortion parameter to obtain a distorted template image;

[0008] Performing key point detection processing on the distorted template image to obtain corresponding dense point annotation information;

[0009] According to the random distortion parameters, a normal document image is distorted to obtain a distorted document image, and a data sample is generated based on the distorted document image and the dense point annotation information.

[0010] In a possible implementation, performing key point detection on the distorted template image to obtain corresponding dense point annotation information includes:

[0011] Performing key point detection processing on the distorted template image to obtain corresponding multiple key points;

[0012] Perform two-dimensional matrix sorting processing on the plurality of key points to obtain the dense point labeling information.

[0013] In a possible implementation, performing key point detection on the distorted template image to obtain corresponding multiple key points includes:

[0014] performing binarization processing on the distorted template image to obtain a dense point set within the distorted template image;

[0015] Based on the dense point set, detecting the connected domain contours to obtain multiple connected domains;

[0016] For any one of the multiple connected domains, a minimum circumscribed circle corresponding to the connected domain is determined, and a center of the minimum circumscribed circle is used as a corresponding key point.

[0017] In one possible implementation, the distortion parameters include: at least one of a brightness parameter, a lighting parameter, a shadow parameter, a distortion parameter, a translation parameter, and an affine parameter. The distorting the template image according to the random distortion parameters to obtain the distorted template image includes:

[0018] Using at least one of the distortion parameters as the random distortion parameter;

[0019] When there are multiple random distortion parameters, the template image is distorted in sequence according to the multiple random distortion parameters to obtain a distorted template image.

[0020] In a possible implementation, determining the template image includes:

[0021] Determining the size data of the normal document image and determining the dense point spacing distance corresponding to the size data;

[0022] generating a dense point set image corresponding to the size data based on the dense point interval, and using the dense point set image as the template image;

[0023] The dimension data is correlated with the number of key points included in the dense point annotation information.

[0024] In a second aspect, an embodiment of the present application provides a sample generation device for a distorted document image, comprising:

[0025] A determination module, used for determining a template image;

[0026] a processing module configured to distort the template image according to random distortion parameters to obtain a distorted template image; perform key point detection on the distorted template image to obtain corresponding dense point annotation information; and distort the normal document image according to the random distortion parameters to obtain a distorted document image;

[0027] A generating module is used to generate a data sample based on the distorted document image and the dense point annotation information.

[0028] In a possible implementation, the processing module is specifically used to perform key point detection processing on the distorted template image to obtain corresponding multiple key points; and perform two-dimensional matrix sorting processing on the multiple key points to obtain the dense point annotation information.

[0029] In one possible implementation, the processing module is specifically used to perform binarization processing on the distorted template image to obtain a dense point set within the distorted template image; based on the dense point set, detect the connected domain contour to obtain multiple connected domains; for any one of the multiple connected domains, determine the minimum circumscribed circle corresponding to the connected domain, and use the center of the minimum circumscribed circle as the corresponding key point.

[0030] In one possible implementation, the distortion parameters include: at least one of: a brightness parameter, a lighting parameter, a shadow parameter, a distortion parameter, a translation parameter, and an affine parameter; the processing module is specifically configured to use at least one of the distortion parameters as the random distortion parameter; when there are multiple random distortion parameters, the template image is distorted in sequence according to the multiple random distortion parameters to obtain a distorted template image.

[0031] In a possible implementation, the determining module is configured to determine the size data of the normal document image and determine the dense point spacing distance corresponding to the size data;

[0032] The generating module is further configured to generate a dense point set image corresponding to the size data based on the dense point spacing distance, and use the dense point set image as the template image;

[0033] The dimension data is correlated with the number of key points included in the dense point annotation information.

[0034] In a third aspect, an embodiment of the present application provides a sample generation device for a distorted document image, comprising: a memory, a processor;

[0035] The memory stores computer-executable instructions;

[0036] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementation methods of the first aspect.

[0038] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0039] The sample generation method, device, medium and product of distorted document images provided in the embodiments of the present application determine a template image and distort the template image according to random distortion parameters to obtain a distorted template image; perform key point detection on the distorted template image to obtain corresponding dense point annotation information; distort the normal document image according to the same random distortion parameters to obtain a distorted document image, and then generate data samples based on the distorted document image and the dense point annotation information; because this method converts the relatively difficult problem of dense point annotation on a distorted document image into the relatively simple problem of key point detection on a distorted template image, when obtaining data samples for the document image distortion correction technology, high-quality distorted document image dense point set annotation data can be automatically obtained without manual intervention, thereby saving a lot of manpower and time costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] Figure 1 A schematic diagram of a distorted document image correction provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of dense point marking provided in an embodiment of the present application;

[0043] Figure 3 A schematic flow chart of a method for generating a sample of a distorted document image provided in an embodiment of the present application;

[0044] Figure 4 A schematic diagram of a template image provided in an embodiment of the present application;

[0045] Figure 5 A schematic diagram of a distorted template image provided in an embodiment of the present application;

[0046] Figure 6 A schematic structural diagram of a sample generating device for distorted document images provided in an embodiment of the present application;

[0047] Figure 7 A schematic structural diagram of a sample generation device for distorted document images provided in an embodiment of the present application.

[0048] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0049] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0050] With the increasing popularity of cameras, using cameras to digitize documents has become a trend. However, documents often deform due to uncontrolled paper geometry and capture conditions. This hinders information extraction from deformed images, reduces readability, and complicates data enhancement and downstream tasks such as optical character recognition (OCR) and layout analysis and restoration. For example, in business scenarios like insurance claims, document images uploaded by customers are often distorted, tilted, or incomplete due to factors such as shooting angle, paper deformation, and environmental interference, resulting in a significant decrease in recognition accuracy.

[0051] In order to solve this type of problem, distorted document image correction technology came into being. It mainly performs geometric transformation on the document image to restore the document image to a relatively flat structure, so that the OCR recognition technology can better recognize the text in the document image and extract information, thereby improving the accuracy of text recognition and information extraction in the document.

[0052] Figure 1A schematic diagram of a distorted document image correction provided by an embodiment of the present application. Figure 1 As shown, Figure 1 A is a distorted document image that the customer took a photo of and uploaded. Figure 1 B is the text line detection result based on the original distorted document image. Figure 1 C is the text line detection result of the document image after correction using the document image distortion correction technology.

[0053] in, Figure 1 B and Figure 1 The colors in C represent the detected text lines. It can be found that Figure 1 There are far fewer lines of text detected in B Figure 1 The text lines detected in C. That is: Figure 1 The text line detection effect of B is not ideal, but the detection effect is very ideal after correction using document image distortion correction technology.

[0054] A mainstream approach to distorted document image correction is a deep learning model based on dense point regression. However, when training a dense point regression model for distorted document image correction, if the amount of labeled data is small, the model's training effect is poor. If the amount of labeled data is large, the labor and time costs are high, and manual labeling is prone to introducing errors, resulting in poor training results.

[0055] Figure 2 This is a schematic diagram of dense point marking provided in the embodiment of the present application. Figure 2 As shown in , the distortion pattern of a document image can be fitted using densely packed annotation points. Figure 2 Figure B shows 1,395 points (45 rows and 31 columns) labeled in a document image. However, the amount of data currently required to train distorted document image correction models often reaches hundreds of thousands, making it difficult to obtain such a large amount of labeled data in actual production operations. Manual labeling would be prohibitively labor-intensive and time-consuming.

[0056] Therefore, how to generate high-fidelity and diverse training data of distorted document images at low cost is the problem that needs to be solved at present.

[0057] In response to the above problems, the present application provides a sample generation method for distorted document images. The method obtains dense point annotation information by performing key point detection on a distorted template image using random distortion parameters, and then distorts the normal document image based on the same random distortion parameters to obtain data samples for the document image distortion correction technology. Since the method converts the relatively difficult problem of performing dense point annotation on a distorted document image into a relatively simple problem of performing key point detection on a distorted template image, when obtaining data samples for the document image distortion correction technology, high-quality dense point set annotation data for distorted document images can be automatically obtained without manual intervention, thereby saving a lot of manpower and time costs.

[0058] The following specific embodiments are used to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be implemented independently or in combination with each other. For the same or similar concepts or processes, some embodiments may not be described in detail.

[0059] Figure 3 This is a flow chart of a method for generating a sample of a distorted document image provided in an embodiment of the present application. Figure 3 As shown, the sample generation method of the distorted document image provided in this embodiment includes:

[0060] S101 : Determine a template image, and perform distortion processing on the template image according to a random distortion parameter to obtain a distorted template image.

[0061] The template image may be, for example, a blank image without substantial document data, and may include, for example, a plurality of dense points, which are arranged in the template image according to a preset rule.

[0062] Random distortion parameters refer to randomly selected distortion parameters, and the number of parameters may be one or more.

[0063] In this step, the template image may be subjected to corresponding distortion processing according to the randomly selected distortion parameters, thereby obtaining a distorted template image.

[0064] In one possible implementation, since the purpose of this embodiment is to generate a distorted document image based on a normal document image to obtain a data sample for the distorted document image correction technology, the specific implementation method for determining the template image may include, for example:

[0065] First, the size data of the normal document image is determined, and the dense point spacing distance corresponding to the size data is determined; then, based on the dense point spacing distance, a dense point set image corresponding to the size data is generated, and the dense point set image is used as a template image.

[0066] Since the data size of the distorted document image is limited, this embodiment can generate the corresponding distorted document image based on the normal document image to obtain a massive amount of data samples.

[0067] The size data may indicate the size of a normal document image, for example, a normal document image is A4 (21 cm×29.7 cm) in size, or 39 cm×61 cm, or 45 cm×30 cm, etc.

[0068] It is understandable that different sizes correspond to different dense point spacing distances. The dense point spacing distance can be determined based on the size of text lines in a normal document image, or based on big data and determined from the Internet, and this application does not limit this.

[0069] Figure 4 This is a schematic diagram of a template image provided in an embodiment of the present application. Figure 4 As shown, the template image includes a dense point set, and the dense points in the dense point set are distributed on the template image according to the corresponding dense point spacing. The size of the template image is the same as that of the normal document image.

[0070] For example: the size of a normal document image is A4 (21 cm × 29.7 cm), then the size of the template image is also A4 (21 cm × 29.7 cm), and the template image is set with 89 rows and 61 columns, totaling 5429 dense points. Compared with the normal document image, the template image does not contain the corresponding document content.

[0071] It is understandable that there is a correlation between the size of the template image and the number of dense points on it. Template images of different sizes contain different numbers of dense points.

[0072] In one possible implementation, the distortion processing may include, for example, brightness processing, illumination processing, shadow processing, distortion processing, translation processing, and affine processing. Correspondingly, the distortion parameters may include, for example, brightness parameters, illumination parameters, shadow parameters, distortion parameters, translation parameters, and affine parameters.

[0073] Before performing the distortion processing, at least one parameter may be randomly selected from a plurality of distortion parameters as a random distortion parameter, and then the template image may be subjected to corresponding distortion processing according to the random distortion parameter, thereby obtaining a distorted template image.

[0074] In this step, for example, the distortion process may be performed once or multiple times, depending on the number of random distortion parameters.

[0075] For example, if the random distortion parameters include a distortion parameter, the template image is distorted according to the distortion parameter to obtain a distorted template image;

[0076] If the random distortion parameters include distortion parameters and illumination parameters, the template image needs to be distorted and illuminated in sequence according to the distortion parameters and illumination parameters to obtain a distorted template image.

[0077] It is understandable that, for example, existing rendering software can be used to render the template image according to the random distortion parameters to obtain the corresponding distorted template image. The specific rendering software used can be determined according to actual needs or corresponding application scenarios, and this application does not impose any restrictions on this.

[0078] Figure 5 This is a schematic diagram of a distorted template image provided in an embodiment of the present application. Figure 5 As shown, after the template image is distorted according to the random distortion parameters, a distorted template image that does not contain the document content is obtained.

[0079] Since the random distortion parameters are random, the distorted template image can be used to represent the distortion state of the real document image.

[0080] S102: Perform key point detection on the distorted template image to obtain corresponding dense point annotation information.

[0081] The dense point annotation information may include, for example, multiple dense points in the distorted template image and coordinate information of each dense point.

[0082] Because the distorted template image contains multiple dense points, keypoint detection technology can be used in this step to identify keypoints on the distorted template image, and then the information corresponding to these keypoints is used as dense point annotation information. This transforms the relatively difficult problem of dense point annotation on distorted document images in existing technologies into the relatively simple problem of keypoint detection on the distorted template image, thereby achieving fast and efficient annotation of distorted document images.

[0083] In one possible implementation, the specific steps for key point detection are as follows:

[0084] The distorted template image is subjected to key point detection processing to obtain corresponding multiple key points; the multiple key points are subjected to two-dimensional matrix sorting processing to obtain dense point annotation information.

[0085] Among them, the essence of the corresponding multiple key points is the multiple dense points on the distorted template image.

[0086] After obtaining multiple key points, the key points can be sorted according to their position coordinates, and the sorted coordinate matrix can be used as dense point annotation information.

[0087] It can be understood that the matrix dimension of the coordinate matrix is ​​Row×Col×2, where Row represents the number of rows of key points in the distorted template image, Col represents the number of columns of key points in the distorted template image, and 2 represents the two dimensions of the x-coordinate and the y-coordinate.

[0088] In one possible implementation, key point detection is performed on the distorted template image to obtain the corresponding multiple key points. The specific implementation is as follows:

[0089] First, the distorted template image is binarized to obtain a dense point set within the distorted template image.

[0090] It can be understood that since the distorted template image only contains a dense point set, it is not necessary to perform grayscale processing on the distorted template image, and it is sufficient to perform binarization processing directly.

[0091] After obtaining the dense point set, the connected domain contour can be detected based on the dense point set to obtain multiple connected domains; then the minimum circumscribed circle corresponding to each connected domain is determined, and the center of the minimum circumscribed circle is used as the corresponding key point.

[0092] When performing key point detection, a deep learning model, such as a dense point regression model, can also be used for detection. This application does not impose any restrictions on this, as long as the key points can be obtained.

[0093] It is understandable that the purpose of steps S101 and S102 is to automatically label the distorted template image to obtain the corresponding dense point labeling information. The above process does not require manual intervention, which can save a lot of manpower and time costs compared to traditional manual labeling methods.

[0094] Furthermore, the above scheme can obtain high-density annotation points, which can effectively alleviate the problem of reduced resolution of the corrected image in subsequent applications.

[0095] S103 : Perform distortion processing on the normal document image according to the random distortion parameters to obtain a distorted document image, and generate a data sample based on the distorted document image and the dense point annotation information.

[0096] The normal document image refers to an image that contains document content and has not been distorted.

[0097] It can be understood that the specific implementation method of performing distortion processing on the normal document image to obtain the distorted document image is similar to the process of obtaining the distorted template image in the above step S101, and the details can be found above.

[0098] Since the random distortion parameters in this step are the same as those in step S101, the distortion state of the distorted template image in step S101 is the same as that of the distorted document image in this step.

[0099] The purpose of doing this is to establish an association between the dense point annotation information obtained in step S102 and the distorted document image obtained in this step, so that the distorted document image and the dense point annotation information can be used together as a set of data samples later.

[0100] It is understandable that after obtaining a set of data samples, it is only necessary to update the random distortion parameters and / or the normal document image to obtain a large number of new data samples of distorted document images.

[0101] It is understandable that in actual scenarios, the distorted document image can be used as input and the dense point annotation information can be used as output to train the dense point regression model.

[0102] This scheme can use dense point set images of different rows and columns to quickly synthesize data samples of distorted document images with rich distortion types, thereby effectively improving the robustness of the dense point regression model.

[0103] The sample generation method of distorted document images provided in this embodiment determines a template image and distorts the template image according to random distortion parameters to obtain a distorted template image; performs key point detection on the distorted template image to obtain corresponding dense point annotation information; distorts the normal document image according to the same random distortion parameters to obtain a distorted document image, and then generates data samples based on the distorted document image and the dense point annotation information; because this method converts the relatively difficult problem of dense point annotation on a distorted document image into the relatively simple problem of key point detection on a distorted template image, when obtaining data samples for the document image distortion correction technology, high-quality dense point set annotation data of the distorted document image can be automatically obtained without manual intervention, thereby saving a lot of manpower and time costs.

[0104] Figure 6 A schematic diagram of the structure of a sample generating device for a distorted document image provided in an embodiment of the present application is shown as follows: Figure 6 As shown, the sample generating device 600 for distorted document images provided in this embodiment includes:

[0105] Determination module 601, used to determine the template image;

[0106] Processing module 602 is configured to distort the template image according to random distortion parameters to obtain a distorted template image; perform key point detection on the distorted template image to obtain corresponding dense point annotation information; and distort the normal document image according to the random distortion parameters to obtain a distorted document image.

[0107] The generating module 603 is configured to generate a data sample based on the distorted document image and the dense point annotation information.

[0108] In a possible implementation, the processing module 602 is specifically configured to perform key point detection processing on the distorted template image to obtain a corresponding plurality of key points; and perform two-dimensional matrix sorting processing on the plurality of key points to obtain the dense point annotation information.

[0109] In one possible implementation, the processing module 602 is specifically used to perform binarization processing on the distorted template image to obtain a dense point set within the distorted template image; based on the dense point set, detect the connected domain contour to obtain multiple connected domains; for any one of the multiple connected domains, determine the minimum circumscribed circle corresponding to the connected domain, and use the center of the minimum circumscribed circle as the corresponding key point.

[0110] In one possible implementation, the distortion parameters include: at least one of: a brightness parameter, a lighting parameter, a shadow parameter, a distortion parameter, a translation parameter, and an affine parameter. The processing module 602 is specifically configured to use at least one of the distortion parameters as the random distortion parameter; when there are multiple random distortion parameters, the template image is distorted in sequence according to the multiple random distortion parameters to obtain a distorted template image.

[0111] In a possible implementation, the determining module 601 is configured to determine the size data of the normal document image and determine the dense point spacing distance corresponding to the size data;

[0112] The generating module 603 is further configured to generate a dense point set image corresponding to the size data based on the dense point interval, and use the dense point set image as the template image;

[0113] The dimension data is correlated with the number of key points included in the dense point annotation information.

[0114] The sample generation device for distorted document images provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.

[0115] Figure 7This is a schematic diagram of the structure of a sample generating device for distorted document images provided in an embodiment of the present application. Figure 7 As shown, the distorted document image sample generation device 700 provided in this embodiment includes: at least one processor 701 and a memory 702. Optionally, the device 700 also includes a communication component 703. The processor 701, the memory 702, and the communication component 703 are connected via a bus 704.

[0116] During the specific implementation process, at least one processor 701 executes the computer-executable instructions stored in the memory 702, so that the at least one processor 701 performs the above method.

[0117] The specific implementation process of the processor 701 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.

[0118] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASICs), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules in the processor.

[0119] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk memory.

[0120] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be classified into address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.

[0121] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0122] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0123] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0124] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in a device as discrete components.

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

[0126] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0127] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.

[0128] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0129] Finally, it should be noted that those skilled in the art will readily identify other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art not disclosed herein. The present invention is not limited to the precise structure described above and illustrated in the accompanying drawings, and various modifications and variations may be made without departing from the scope thereof. The scope of the present invention is limited solely by the appended claims.

Claims

1. A method for generating a sample of a distorted document image, characterized in that: The method comprises: Determining a template image, and performing distortion processing on the template image according to a random distortion parameter to obtain a distorted template image; Performing key point detection processing on the distorted template image to obtain corresponding dense point annotation information; According to the random distortion parameters, a normal document image is distorted to obtain a distorted document image, and a data sample is generated based on the distorted document image and the dense point annotation information.

2. The method according to claim 1, characterized in that The performing key point detection processing on the distorted template image to obtain corresponding dense point annotation information includes: Performing key point detection processing on the distorted template image to obtain corresponding multiple key points; Perform two-dimensional matrix sorting processing on the plurality of key points to obtain the dense point labeling information.

3. The method according to claim 2, characterized in that The key point detection process is performed on the distorted template image to obtain corresponding multiple key points, including: performing binarization processing on the distorted template image to obtain a dense point set within the distorted template image; Based on the dense point set, detecting the connected domain contours to obtain multiple connected domains; For any one of the multiple connected domains, a minimum circumscribed circle corresponding to the connected domain is determined, and a center of the minimum circumscribed circle is used as a corresponding key point.

4. The method according to claim 2, characterized in that The distortion parameters include: at least one of a brightness parameter, a lighting parameter, a shadow parameter, a distortion parameter, a translation parameter, and an affine parameter. The distorting process is performed on the template image according to the random distortion parameters to obtain a distorted template image, including: Using at least one of the distortion parameters as the random distortion parameter; When there are multiple random distortion parameters, the template image is distorted in sequence according to the multiple random distortion parameters to obtain a distorted template image.

5. The method according to claim 2, characterized in that The determining of the template image includes: Determining the size data of the normal document image and determining the dense point spacing distance corresponding to the size data; generating a dense point set image corresponding to the size data based on the dense point interval, and using the dense point set image as the template image; The dimension data is correlated with the number of key points included in the dense point annotation information.

6. A sample generation device for distorted document images, characterized in that: The device comprises: A determination module, used for determining a template image; a processing module configured to distort the template image according to random distortion parameters to obtain a distorted template image; perform key point detection on the distorted template image to obtain corresponding dense point annotation information; and distort the normal document image according to the random distortion parameters to obtain a distorted document image; A generating module is used to generate a data sample based on the distorted document image and the dense point annotation information.

7. The device according to claim 6, characterized in that The processing module is specifically used to perform key point detection processing on the distorted template image to obtain corresponding multiple key points; and perform two-dimensional matrix sorting processing on the multiple key points to obtain the dense point annotation information.

8. A device for generating a sample of a distorted document image, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 5 when executed by a processor.

10. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, it is used to implement the method according to any one of claims 1 to 5.