Method for generating image, training image distortion correction model, correcting distorted image, related device and computer program product
By generating the distorted images corresponding to the standard image and training the image distortion correction model, the problem of difficult and low quality training of the image distortion correction model in the prior art is solved, and more efficient and higher quality model training is achieved.
Patent Information
- Application Number
- CN202411906448.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-08
AI Technical Summary
The prior art is difficult to effectively train the image distortion correction model, which makes the model training difficult and low quality.
By generating distorted images corresponding to standard images, and using these distorted images to train the initial image distortion correction model until the training requirements are met.
This achieves the construction of standard image-distorted image pairs in a more efficient and higher quality, reducing the training difficulty of image distortion correction models and improving the training quality of the model.
Smart Images

Figure CN119784652A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, specifically to the field of artificial intelligence technology such as image processing, sample enhancement and deep learning, and especially to methods, devices, electronic devices, computer-readable storage media and computer program products for generating images, training image distortion correction models and correcting distorted images. Background Art
[0002] With the development of society and computer technology, text and content acquisition technology based on image recognition has emerged. In such technology, after a user uploads an image, the user can obtain the image content, such as text, contained in the image based on the processing of the image by an electronic device.
[0003] In this context, in order to better process images and identify the content in the images, before processing and identifying the images, the images are often adjusted to a certain extent through distortion correction so that the content in the images can be better and more accurately identified and extracted.
[0004] For example, an image distortion correction model can be used to process an image to correct the "distorted part" in the image, thereby obtaining a processed image that has restored the distortion. Then, based on the processed image that has restored the distortion, subsequent downstream tasks such as content extraction and recognition can be implemented.
[0005] Therefore, how to more effectively train the image distortion correction model, reduce the training difficulty of the image distortion correction model, and improve the training quality of the image distortion correction model is worthy of attention and an urgent need. Summary of the invention
[0006] The embodiments of the present disclosure provide a method, device, electronic device, computer-readable storage medium, and computer program product for generating an image, training an image distortion correction model, and correcting a distorted image.
[0007] In a first aspect, an embodiment of the present disclosure proposes a method for generating an image, comprising: acquiring a standard image; processing the standard image based on an inverse action sequence of an image processing action sequence to generate a distorted image corresponding to the standard image, wherein the image processing action sequence is determined according to the image processing action used to process the sample distorted image into a sample standard image.
[0008] In a second aspect, an embodiment of the present disclosure proposes a method for training an image distortion correction model, comprising: taking a distorted image corresponding to a standard image as input and the standard image as output, training an initial image distortion correction model, wherein the distorted image is generated based on the standard image using the method for generating an image according to any one of the first aspects above; in response to the training of the initial image distortion correction model meeting the training requirements, obtaining the image distortion correction model.
[0009] In a third aspect, an embodiment of the present disclosure proposes a method for correcting a distorted image, comprising: obtaining an image to be corrected; processing the image to be corrected using an image distortion correction model to obtain a corrected image corresponding to the image to be corrected, wherein the image distortion correction model is trained according to the method for training an image distortion correction model according to the second aspect mentioned above.
[0010] In a fourth aspect, an embodiment of the present disclosure proposes a device for generating an image, comprising: a standard image acquisition unit, configured to acquire a standard image; a distorted image generation unit, configured to process the standard image based on an inverse action sequence of the image processing action sequence, and generate a distorted image corresponding to the standard image, wherein the image processing action sequence is determined according to the image processing action used to process the sample distorted image into a sample standard image.
[0011] In a fifth aspect, an embodiment of the present disclosure proposes a device for training an image distortion correction model, comprising: a model training unit, configured to use a distorted image corresponding to a standard image as input and the standard image as output to train an initial image distortion correction model, wherein the distorted image is generated based on the standard image using the device for generating an image according to any one of the fourth aspects above; a model determination unit, configured to obtain an image distortion correction model in response to the training of the initial image distortion correction model meeting the training requirements.
[0012] In a sixth aspect, an embodiment of the present disclosure proposes a device for correcting a distorted image, comprising: an image acquisition unit to be corrected, configured to acquire the image to be corrected; an image distortion correction unit, configured to process the image to be corrected using an image distortion correction model to obtain a corrected image corresponding to the image to be corrected, wherein the image distortion correction model is trained according to the device for training the image distortion correction model according to the fifth aspect above.
[0013] In the seventh aspect, an embodiment of the present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that when the at least one processor executes, it can implement the method for generating an image as described in any implementation manner in the first aspect, and / or the method for training an image distortion correction model as described in any implementation manner in the second aspect, and / or the method for correcting a distorted image as described in any implementation manner in the third aspect.
[0014] In an eighth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, which are used to enable a computer to implement the method for generating an image as described in any implementation manner in the first aspect, and / or the method for training an image distortion correction model as described in any implementation manner in the second aspect, and / or the method for correcting a distorted image as described in any implementation manner in the third aspect when executed.
[0015] In the ninth aspect, an embodiment of the present disclosure provides a computer program product comprising a computer program, which, when executed by a processor, can implement the method for generating an image as described in any implementation manner in the first aspect, and / or the method for training an image distortion correction model as described in any implementation manner in the second aspect, and / or the method for correcting a distorted image as described in any implementation manner in the third aspect.
[0016] The methods, devices, electronic devices, computer-readable storage media, and computer program products for generating images provided by the embodiments of the present disclosure acquire a standard image; based on an inverse action sequence of an image processing action sequence, process the standard image to generate a distorted image corresponding to the standard image, wherein the image processing action sequence is determined based on the image processing action used to process the sample distorted image into the sample standard image.
[0017] Therefore, the present disclosure can at least be based on an action sequence and action flow for correcting and solving image distortion. The present disclosure can generate corresponding distorted images incrementally, close to reality and with high quality based on standard images by reversely executing the action sequence and action flow.
[0018] The method, device, electronic device, computer-readable storage medium and computer program product for training an image distortion correction model provided by the embodiments of the present disclosure use a distorted image corresponding to a standard image as input and the standard image as output to train an initial image distortion correction model, wherein the distorted image is generated based on the standard image using the above-mentioned method for generating an image; in response to the training of the initial image distortion correction model meeting the training requirements, an image distortion correction model is obtained.
[0019] Therefore, the present disclosure can also construct standard image-distorted image pairs more efficiently and with higher quality in this way, for use in training tasks such as image distortion correction models, which can reduce the training difficulty of the image distortion correction model and improve the training quality of the image distortion correction model.
[0020] The method, device, electronic device, computer-readable storage medium and computer program product for correcting a distorted image provided by the embodiments of the present disclosure obtain an image to be corrected; process the image to be corrected using an image distortion correction model to obtain a corrected image corresponding to the image to be corrected, wherein the image distortion correction model is trained according to the above-mentioned method for training an image distortion correction model.
[0021] Therefore, the present disclosure can also complete the task of "distortion correction" of images with better quality in this way.
[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings: Figure 1 is an exemplary system architecture in which the present disclosure may be applied; Figure 2 A flowchart of a process of generating an image provided by an embodiment of the present disclosure; Figure 3 A flowchart of a process for determining an image processing action sequence provided by an embodiment of the present disclosure; Figure 4 A schematic diagram of the effect of a method for generating an image in an application scenario provided by an embodiment of the present disclosure; Figure 5 A flowchart of a process of training an image distortion correction model provided by an embodiment of the present disclosure; Figure 6 A flowchart of a process for correcting a distorted image provided by an embodiment of the present disclosure; Figure 7 A structural block diagram of a device for generating an image provided by an embodiment of the present disclosure; Figure 8 A structural block diagram of a device for training an image distortion correction model provided by an embodiment of the present disclosure; Fig. 9 A structural block diagram of a device for correcting a distorted image provided by an embodiment of the present disclosure; Fig.10 A schematic diagram of the structure of an electronic device suitable for executing a method of generating an image, training an image distortion correction model, and correcting a distorted image, provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0024] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the embodiments in the present disclosure and the features in the embodiments may be combined with each other without conflict.
[0025] In addition, in the technical solutions involved in the present disclosure, the acquisition, storage, use, processing, transportation, provision and disclosure of user personal information involved (for example, the standard images involved later in this disclosure may be images including user personal information) are in compliance with the relevant laws and regulations and do not violate public order and good morals.
[0026] Figure 1 An exemplary system architecture 100 is shown to which embodiments of the method, apparatus, electronic device, and computer-readable storage medium for generating an image, training an image distortion correction model, and correcting a distorted image according to the present disclosure can be applied.
[0027] 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.
[0028] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Terminal devices 101, 102, 103 and server 105 can be installed with various applications for realizing information communication between the two, such as image generation applications, text recognition applications, instant messaging applications, etc.
[0029] Terminal devices 101, 102, 103 and server 105 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc.; when terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above, which can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here. When server 105 is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server; when the server is software, it can be implemented as multiple software or software modules, or as a single software or software module, and no specific limitation is made here.
[0030] The server 105 can provide various services through various built-in applications. For example, an image generation application that can generate a corresponding distorted image based on a standard image can be provided. When the server 105 runs the image generation application, the following effects can be achieved: first, a standard image is obtained from the terminal devices 101, 102, and 103 through the network 104; then, the server 105 processes the standard image based on an inverse action sequence of the image processing action sequence to generate a distorted image corresponding to the standard image, wherein the image processing action sequence is determined according to the image processing action used to process the sample distorted image into a sample standard image.
[0031] It should be noted that, in addition to being obtained from the terminal devices 101, 102, and 103 through the network 104, the standard image can also be pre-stored locally in the server 105 in various ways. Therefore, when the server 105 detects that these data have been stored locally (for example, when starting to process the previously reserved "image generation" and "image increment" tasks to be processed), it can choose to directly obtain these data locally. In this case, the exemplary system architecture 100 may also not include the terminal devices 101, 102, 103 and the network 104.
[0032] Similarly, the server 105 may also use the standard images and distorted images (for example, the distorted images are generated based on the standard images using the above-mentioned method for generating images) provided by the terminal devices 101, 102, 103, or stored locally, to train the initial image distortion correction model using the distorted images corresponding to the standard images as input and the standard images as output (for example, the above process is implemented using an image distortion correction model training application that is different from an image generation application). The description will not be repeated here.
[0033] Furthermore, the server 105 can also use the trained image distortion correction model to process the image to be corrected (for example, it can be provided by the terminal devices 101, 102, 103, or the image to be corrected stored locally) to obtain a corrected image corresponding to the image to be corrected (for example, the above process is implemented using an image distortion correction application that is different from an image generation application), which is not repeated here.
[0034] Correspondingly, in scenarios utilizing, for example, image distortion correction model training applications and image distortion correction applications, it is also possible to similarly "only include server 105", which will not be repeated here.
[0035] Since the processes of generating images, training image distortion correction models, and correcting distorted images may require more computing resources and stronger computing power, either alone or in combination, the methods of generating images, training image distortion correction models, and correcting distorted images provided in the subsequent embodiments of the present disclosure are generally performed by the server 105 having stronger computing power and more computing resources, and accordingly, the apparatus for generating images, training image distortion correction models, and correcting distorted images is generally also provided in the server 105. However, it should also be pointed out that when the terminal devices 101, 102, and 103 also have computing power and computing resources that meet the requirements, the terminal devices 101, 102, and 103 can also similarly complete the various operations assigned to the server 105, and then output the same results as the server 105. Alternatively, in some cases, if there are multiple terminal devices with different computing capabilities at the same time, and it is determined that the terminal device has stronger computing capabilities and more remaining computing resources (for example, it can be the judgment made by the above-mentioned image generation application, image distortion correction model training application, image distortion correction application, etc.), the terminal device can be allowed to perform the above-mentioned operations, thereby appropriately reducing the computing pressure of the server 105. Accordingly, the device for generating images, training image distortion correction models, and correcting distorted images can also be set in the terminal devices 101, 102, and 103. In this case, the exemplary system architecture 100 may also not include the server 105 and the network 104.
[0036] 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.
[0037] Next, we will first explain the "process of generating images". For easier understanding, please refer to Figure 2 , Figure 2 A flowchart of a process of generating an image provided by an embodiment of the present disclosure includes process 200.
[0038] Process 200 includes the following steps: Step 201: Acquire a standard image; In the embodiments of the present disclosure, the image generating method may be performed by an execution subject (for example, Figure 1 The server 105 shown in the figure) is used to obtain a standard image.
[0039] A standard image can generally be understood as an image with the desired ideal display effect. For example, in a distortion correction scenario, the standard image can be an image that, after distortion correction, can meet the user's reading needs and the recognition requirements of subsequent downstream tasks. For example, a standard image can be an image whose distortion degree of the included content meets the requirements.
[0040] As discussed above, the standard image may be provided by the user using the terminal device, or may be pre-stored locally by the execution subject. For example, the standard image may be an "image including text" from which the text information included therein can be "clearly" and "satisfactorily" identified, and text information that satisfies the requirements can be extracted.
[0041] In some optional implementations of this embodiment, the standard image may also be generated by using, for example, Pillow or an open source computer vision library.
[0042] Pillow is a very popular image processing library in Python. It is a branch of Python Imaging Library (PIL). Pillow provides a wealth of image processing functions, which can easily open, edit, save, convert and other operations on images.
[0043] Open Source Computer Vision Library (OpenCV) is a computer vision and machine learning software library that can be applied to image processing, video analysis, computer vision, artificial intelligence and other fields. OpenCV can provide different optimized computer vision algorithms, and can also realize image and video processing, analysis, feature extraction, image enhancement, object recognition, motion tracking and other functions.
[0044] Therefore, using Pillow and / or OpenCV to provide a "standard image" that meets the requirements as a basis can reduce the difficulty of obtaining the "standard image" and solve the problem of sample missing caused by insufficient "standard images".
[0045] Step 202: Based on the inverse action sequence of the image processing action sequence, the standard image is processed to generate a distorted image corresponding to the standard image.
[0046] In an embodiment of the present disclosure, based on step 201, after the execution subject determines and obtains the standard image, the execution subject may process the standard image based on an inverse action sequence of the image processing action sequence to generate a distorted image corresponding to the standard image.
[0047] The image processing action sequence may be determined according to the image processing actions for processing the sample distorted image into the sample standard image.
[0048] For example, if the image processing action sequence (A, B, C, D) needs to be executed to process the distorted image a as a sample distorted image into a corresponding standard sample image that meets the requirements, that is, if the distorted image a needs to be corrected to the corresponding standard image by continuously executing the image processing action A, the image processing action B, the image processing action C, and the image processing action A on the distorted image a, then the "inverse action sequence" corresponding to the image processing action sequence can be exemplified as (D', C', B', A'). (D', C', B', A') is an action sequence realized by continuously executing the image processing action D', the image processing action C', the image processing action B', and the image processing action A'.
[0049] In the “reverse action sequence”, the image processing action D′ is actually the “reverse, reverse action” of the image processing action D.
[0050] For example, when the image processing action D is to move a target pixel point in the distorted image a to the left by a distance to obtain a processed distorted image a', the image processing action D' can be exemplified as "moving the target pixel point in the distorted image a' to the right by the distance" to restore the "distorted image a'" to the "distorted image a" that has not been processed by the image processing action D.
[0051] In other words, for the inverse action sequence of the image processing action sequence, it can sequentially execute the "inverse image processing actions" of the image processing actions indicated by the image processing action sequence in the reverse order and reverse order of the image processing action sequence indicated by the image processing action sequence. In this way, the execution subject can eliminate the processing and correction process of the distorted image by the image processing action sequence according to the reverse action logic of the image processing action sequence based on the "inverse action sequence".
[0052] That is, the executing entity can obtain a reversed image processing action sequence by reversing and reversing the order of each image processing action in the image processing action sequence, and then obtain a reverse action sequence of the image processing action sequence by replacing each image processing action included in the reversed and reversed image processing action sequence with a corresponding reverse image processing action.
[0053] For example, the execution entity may first obtain (D, C, B, A) by reversing (A, B, C, D) and then replace D, C, B, A accordingly to obtain (D', C', B', A').
[0054] In some scenarios, the "reverse action sequence" can also be referred to as a restoration action sequence for the image processing action sequence. That is, by executing the "reverse action sequence", the action effects of the image processing action sequence can be gradually eliminated from back to front, so as to restore the image to a state not processed by the image processing action sequence.
[0055] In some scenarios, the image processing action sequence can also be understood as a "displacement flow" used to process the distorted image a and convert the distorted image a into a corresponding (sample) standard image.
[0056] Correspondingly, the inverse action sequence of the image processing action sequence can also be understood as the "reverse displacement flow" of the above-mentioned "displacement flow".
[0057] Therefore, the execution subject can "reverse" the distortion process of the sample distorted image through the inverse action sequence of the image processing action sequence, so that the standard image can be distorted according to the "distortion logic" corresponding to the "sample distorted image" to obtain a distorted image corresponding to the standard image.
[0058] In other words, in such a case, the distortion logic associated with the standard image and its corresponding distorted image is actually consistent with the distortion logic associated with the “sample standard image” and the corresponding “sample distorted image”.
[0059] Accordingly, the execution subject can construct an image pair of standard image-distorted image based on the distortion of the standard image by recording the "distortion logic" and reproducing the "distortion logic".
[0060] It should be understood that, in practice, for a specific standard image, if it is obtained by distorting the image, it can actually be understood as a "sample standard image" of other standard images to provide an "image processing action sequence".
[0061] The method for generating an image provided by the embodiment of the present disclosure can be based on an action sequence and an action flow for correcting and solving image distortion. The present disclosure can generate a corresponding distorted image incrementally, close to reality and with high quality based on a standard image by reversely executing the action sequence and the action flow.
[0062] In some embodiments, there may be various reasons for the “distortion” of the image, and accordingly, the “distortion” actually generated may also be understood as having different distortion types.
[0063] For example, distortion types may include geometric distortion (eg, may generally include perspective distortion, radial distortion, nonlinear distortion, and stretch / compression distortion, etc.), color distortion (eg, white balance distortion, color banding effect, etc.), optical distortion, motion distortion, noise distortion, and the like.
[0064] Accordingly, based on the different distortion types, the corresponding image processing actions (sequences) may actually be different. Therefore, the execution subject can select the image processing action sequence corresponding to the distortion type according to the required distortion type.
[0065] For example, when it is desired to distort a standard image in a "geometric distortion" manner to obtain a distorted image belonging to the "geometric distortion", the executor can select an image processing action sequence corresponding to the "geometric distortion", and then process the standard image based on an inverse action sequence of the image processing action sequence to generate a distorted image belonging to the "geometric distortion" corresponding to the standard image.
[0066] In some embodiments, the execution entity may choose to maintain an image processing action sequence set, or an image processing action sequence library, for collecting and maintaining “image processing action sequences” corresponding to different distortion types.
[0067] The image processing action sequence set may include at least one image processing action sequence (in practice, usually more than two). Accordingly, these image processing action sequences may be associated with type labels of corresponding distortion types.
[0068] The type label is related to the type of distortion that can be corrected by the corresponding image processing action sequence, or in other words, is related to the type of distortion included in the “sample standard image” used to determine the image processing action sequence.
[0069] Accordingly, based on the type label, the execution subject can select an image processing action sequence that can correct the corresponding distortion type. Then, the execution subject "distorts" the standard image through the inverse action sequence of the image processing action sequence to obtain a distorted image of the corresponding distortion type.
[0070] In some embodiments, in order to ensure the balance of the types of "distorted images", for example, to avoid poor model training results due to excessive differences in the distribution of distortion types between training samples in the training task of the image distortion correction model, the trained model lacks the ability to process one or several types of distortions.
[0071] The execution subject may also choose to obtain the distortion type of the missing distorted image, and then extract the image processing action sequence with the type label of the distortion type from the set of image processing action sequences to "generate the distorted image in a directionally manner".
[0072] Thus, the execution body ensures that the distorted images under each distortion type are distributed “evenly” in quantity.
[0073] In some optional implementations of this embodiment, for the distortion type of the missing distorted image, the execution subject may choose to first read the quantity distribution of the distortion types of the generated distorted image.
[0074] For example, the execution subject may first read the specific types of the required “distortion types”, and then read the quantity distribution of the distortion types of the generated distorted images based on the data of the generated distorted images corresponding to the respective types.
[0075] Then, the execution subject determines the distortion type whose proportion in the distribution result is less than or equal to the proportion threshold based on the distribution result of the quantity distribution, and uses it as the distortion type of the missing distorted image.
[0076] Thus, the execution entity can adjust the quantity distribution of distorted images of each distortion type by reading the result of the quantity distribution of the generated distorted images, so that each distortion type can be provided with a corresponding distorted image "balancedly" and "uniformly".
[0077] In some embodiments, based on different requirements, the ratio threshold may also be adjusted to correspond uniquely to the distortion type. In this way, the “type distribution” of the distorted image finally obtained can be adjusted by adjusting the ratio threshold to meet different image generation requirements (for example, the number and proportion of distorted images of a certain distortion type can be increased in a targeted manner).
[0078] In some embodiments, due to different requirements, such as step-by-step difficulty training requirements, the execution subject can also constrain the "difficulty" of the generated distorted image by limiting or adjusting the length of the image processing action sequence used to meet different requirements.
[0079] In other words, the execution subject can reduce the difficulty of "distorting the image" by "partially restoring the distortion" instead of "fully restoring the distortion". As a result, the execution subject can use the same sequence of image processing actions to generate distorted images of different "distortion degrees" and "difficulties".
[0080] For this, please refer to Figure 3 , Figure 3A flowchart of a process of determining an image processing action sequence is provided in an embodiment of the present disclosure, which includes process 300.
[0081] Process 300 includes the following steps: Step 301: determining an initial image processing action sequence according to an image processing action for processing a sample distorted image into a sample standard image; Specifically, as discussed above, the execution subject may first determine the initial image processing action sequence based on the complete image processing actions for processing the sample distorted image into the sample standard image. That is, the execution subject may regard the "action sequence" composed of all the image processing actions as the initial image processing action sequence.
[0082] Step 302: Determine whether the number of image processing actions included in the initial image processing action sequence is less than or equal to a first number threshold; Specifically, after obtaining the initial image processing action sequence based on step 301, the execution subject may determine whether the number of image processing actions included in the initial image processing action sequence is less than or equal to a first number threshold.
[0083] For example, the first quantity threshold may be set corresponding to the “expected difficulty” described above.
[0084] Then, if the execution subject determines that the number of image processing actions included in the initial image processing action sequence is less than or equal to the first number threshold, it can respond to this and continue to execute step 303.
[0085] Step 303: Using the initial image processing action sequence as the image processing action sequence.
[0086] Specifically, if the number of image processing actions included in the initial image processing action sequence meets the requirements, or in other words, the "length" of the initial image processing action sequence meets the requirements, then the difficulty of the distorted image based on the "initial image processing action sequence" can meet the training requirements (that is, the distorted image will not be "too difficult" or "too complex" due to too many image processing actions included).
[0087] Accordingly, the execution subject may choose to directly use the initial image processing action sequence as the above-mentioned "image processing action sequence" to process and distort the standard image to generate a distorted image corresponding to the standard image.
[0088] In some optional implementations of this embodiment, for an initial image processing action sequence in which the number of image processing actions is greater than a first number threshold, the execution entity may shorten its "length" to reduce its "difficulty" by removing some actions in the initial image processing action sequence.
[0089] For example, in the above process 300, step 304 may also be included.
[0090] For example, in process 300, if the executing entity determines after executing step 302 that the number of image processing actions included in the initial image processing action sequence is greater than a first quantity threshold, the executing entity may choose to execute step 304 to reduce the "difficulty" by updating the initial image processing action sequence.
[0091] Step 304, updating the initial image processing action sequence by continuously deleting the corresponding target image processing actions whose modified contribution is less than or equal to the contribution threshold from the beginning of the initial image processing action sequence toward the end; Specifically, for a specific image processing action, the execution subject may determine its corresponding distortion correction contribution based on the “distortion degree” of the sample distorted image eliminated by using the image processing action.
[0092] In some embodiments, the "distortion degree" eliminated can actually be understood as the contribution of the image processing action to the "image recognition degree". For example, if the recognition degree in the distorted image increases from X% to Y% after the image processing action is performed, the "distortion correction degree" can be understood as the value of "YX".
[0093] Correspondingly, if the number of image processing actions included in the initial image processing action sequence is greater than a first number threshold, the executing entity may choose to start from the beginning of the initial image processing action sequence and continuously delete the corresponding target image processing actions whose modified contributions are less than or equal to the contribution threshold toward the end, so as to update the initial image processing action sequence and "shorten" the length of the initial image processing action sequence.
[0094] Step 305: Use the updated initial image processing action sequence as the image processing action sequence.
[0095] Normally, the executing entity may choose to delete the image processing actions included in the initial image processing action sequence until the updated initial image processing action sequence can be less than or equal to the first quantity threshold, thereby completing the update of the initial image processing action sequence and obtaining the image processing action sequence.
[0096] However, in some embodiments, under such an updating method, it is not actually required that the length of the updated initial image processing action sequence must be less than the “first quantity threshold”.
[0097] Because, although the length of the updated initial image processing action sequence is greater than or equal to the first quantity threshold (or, there is no target image processing action less than or equal to the contribution threshold that can be deleted, resulting in the initial image processing action sequence not being updated), this is actually because those actions that can overcome the distortion with a high contribution through key image processing actions are retained. For example, for model training tasks, the distortions formed by these "key image processing actions" may often have higher learning value for model training. Therefore, under such an update method, although from the dimension of "length", the initial image processing action sequence may exceed the "difficulty standard", from the dimension of "correction contribution", the generated distorted image can provide more valuable information. Therefore, for such distorted images, the execution subject can also choose to retain them based on pre-configured strategies.
[0098] In practice, users such as operation and maintenance personnel can indicate whether the execution subject is allowed to "use an updated initial image processing action sequence whose length is greater than or equal to the first quantity threshold" by imposing strong constraints or weak constraints on the execution subject.
[0099] In some embodiments, if the execution subject is allowed to "use an updated initial image processing action sequence whose length is greater than or equal to a first number threshold", the execution subject can also distinguish the distorted images generated by using the "updated initial image processing action sequence whose length is greater than or equal to the first number threshold" by adding additional identifications to assist the user in deciding whether to actually use them, or to use them as distorted images with a higher learning difficulty.
[0100] In some optional implementations of this embodiment, for the initial image processing action sequence, although the number of image processing actions included therein is less than or equal to the first number threshold, this may be because the "distortion difficulty" of the corresponding sample distorted image is too small (for example, there is actually no "distortion" in the sample distorted image that will obviously affect reading). For example, the "distortion" in the sample distorted image is only caused by "insufficient brightness", which results in the initial image processing action sequence being able to complete the "distortion correction" by simply increasing the brightness.
[0101] In such a case, the distorted image generated based on such an initial image processing action sequence may also fail to meet the usage requirements (because it is too easy and lacks valuable information that can be used for training). Such a situation may also be undesirable.
[0102] In such a case, a second quantity threshold may be similarly set to limit the difficulty of distorting the image to avoid the difficulty being “too low.” Accordingly, the second quantity threshold is a value lower than the first quantity threshold.
[0103] Correspondingly, if the number of image processing actions included in the initial image processing action sequence is less than or equal to a second quantity threshold, the execution entity may also respond to this by adding at least one preset incremental image processing action before the beginning of the initial image processing action sequence to update the initial image processing action sequence so that the number of image processing actions included in the updated initial image processing action sequence is greater than the second quantity threshold.
[0104] Typically, the preset incremental image processing action may be determined in advance based on some specific image processing actions for correcting distortion (eg, an image processing action for “eliminating pincushion distortion”, an image processing action for “eliminating barrel distortion”).
[0105] It should be understood that, because the purpose of the preset incremental images is actually to "increase noise", the preset incremental image processing actions can be configured based on the parameters used in the history of using these incremental image processing actions, thereby avoiding calculation errors caused by the absence of corresponding "distortions" in the sample distorted images.
[0106] For example, the “correction position” corresponding to “eliminating barrel distortion” may be that the “sample distorted image” is an edge position, and the correction amplitude may be the “amplitude parameter” used based on the historical action.
[0107] Similarly, in combination with different configuration requirements, the execution entity may also choose to increase the "difficulty" by adding the number of image processing actions to the second number threshold, between the second number threshold and the first number threshold, or by the second number threshold.
[0108] Then, the execution subject may similarly use the updated initial image processing action sequence as the image processing action sequence.
[0109] On the basis of any of the above embodiments, when at least two distorted images are generated, the execution subject may also choose to separately maintain distorted images of different distortion types and different “difficulties” in the form of distorted image sets.
[0110] For example, the execution subject may maintain a corresponding number interval for the number of image processing actions used when generating the distorted image. Then, the execution subject may determine the distorted image set for storing the distorted image based on the number interval into which the number of image processing actions used falls.
[0111] Similarly, for the distorted image set, the execution entity may also maintain the “distortion type that meets the requirements” independently of or in conjunction with the “quantity interval”.
[0112] Then, the execution subject may classify the distorted image into a corresponding distorted image set based on the number of image processing actions included in the image processing action sequence and / or the distortion type corresponding to the image processing action sequence.
[0113] Different warped image sets are correspondingly associated with a quantity interval of the quantity of image processing actions that meet the storage requirements and / or a warping type that meets the storage requirements.
[0114] Therefore, the required distorted image can be conveniently and efficiently provided based on the distorted image set.
[0115] It should be understood that in some embodiments, the execution subject may also mark the used standard image corresponding to the distorted image, that is, form a standard image-distorted image pair. Thus, in subsequent tasks such as model training, training may be performed based on the standard image-distorted image pair (for example, based on a distorted image set, after determining the distorted image, the corresponding standard image-distorted image pair is extracted).
[0116] To deepen understanding, this disclosure also provides a specific implementation solution in combination with a specific application scenario. Figure 4 , Figure 4 A schematic diagram of the effect of a method for generating an image in an application scenario provided by an embodiment of the present disclosure.
[0117] exist Figure 4 In the example, the image processing action 410 may be a “sequence of actions” for processing the sample distorted image 401 into the corresponding sample standard image 402 .
[0118] For example, in Figure 4 For example, the execution subject (not shown) of the server 105 can correct the “distortion” of the sample distorted image 401 based on the image processing action 410 and process it into a sample standard image 402 .
[0119] Accordingly, as discussed above, the inverse action sequence 420 of the image processing action sequence 410 can be used to “restore” or “distort” the sample standard image 402 back to the sample distorted image 401 .
[0120] Next, the execution subject can use the inverse action sequence 420 of the image processing action sequence 410 to process the standard image 403, so as to distort the standard image 403 accordingly by referring to the "distortion logic of the sample distorted image 401", so as to generate and obtain a distorted image 404 corresponding to the standard image 403.
[0121] Next, we will explain the process of training the image distortion correction model. Figure 5 , Figure 5 A flowchart of a process of training an image distortion correction model provided in an embodiment of the present disclosure, including process 500.
[0122] Process 500 includes the following steps: Step 501: using the distorted image corresponding to the standard image as input and the standard image as output, training the initial image distortion correction model; In an embodiment of the present disclosure, the execution subject may obtain an initial image distortion correction model, which may be a model having image distortion correction capability, such as a model implemented based on a convolutional neural network architecture. For example, the initial image distortion correction model may be DistortionNet, PerspectiveNet, etc.
[0123] Then, the execution subject uses the standard image as output and the distorted image corresponding to the standard image as input to train the initial image distortion correction model. The distorted image can be an image generated by using the standard image as the basis and the process of generating an image discussed above, which will not be repeated here.
[0124] Step 502: In response to the training of the initial image distortion correction model meeting the training requirement, an image distortion correction model is obtained.
[0125] In an embodiment of the present disclosure, if the training of the initial image distortion correction model meets the training requirements through the above step 501, the execution subject can respond to this and obtain the image distortion correction model.
[0126] For example, in a scenario where a loss function is used as supervision for training, the execution subject can determine whether the training of the initial image distortion correction model meets the training requirements by obtaining changes in the loss function set for supervising the model training process.
[0127] For example, when the loss function converges, or the value of the loss function is less than a preset target value, the execution entity may determine that the training of the initial image distortion correction model meets the training requirements.
[0128] The method for training an image distortion correction model provided by the embodiments of the present disclosure can more efficiently and efficiently construct image pairs of standard images and distorted images for use in training tasks such as image distortion correction models, which can reduce the difficulty of training the image distortion correction model and improve the training quality of the image distortion correction model.
[0129] Next, we will explain the process of correcting distorted images. Figure 6 , Figure 6 A flowchart of a process for correcting a distorted image provided by an embodiment of the present disclosure includes process 600.
[0130] Process 600 includes the following steps: Step 601: Acquire the image to be corrected; In the embodiment of the present disclosure, the execution subject may obtain the image to be corrected. For example, the image to be corrected may be obtained through communication by the terminal devices 101, 102, 103 used by the user.
[0131] It should be noted that the image to be corrected can be obtained by the above-mentioned execution subject directly from a local storage device, or from a non-local storage device (such as Figure 1 The local storage device may be a data storage module provided in the above-mentioned execution subject, such as a server hard disk, in which case the image to be corrected can be quickly read locally; the non-local storage device may also be any other electronic device provided for storing data, such as some user terminals, in which case the above-mentioned execution subject may obtain the required image to be corrected by sending an acquisition command to the electronic device.
[0132] Step 602: Process the image to be corrected using the image distortion correction model to obtain a corrected image corresponding to the image to be corrected.
[0133] In an embodiment of the present disclosure, the execution entity can use the training image distortion correction model trained by the above process 500 to process the image to be corrected obtained in the above step 601 to process it (for example, correct the "distortion" therein) and obtain a corrected image corresponding to the image to be corrected.
[0134] The method for correcting a distorted image provided by the embodiment of the present disclosure can complete the task of “distortion correction” of an image with higher quality.
[0135] Further references Figure 7 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for generating an image, and the device embodiment is Figure 2Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0136] like Figure 7 As shown, the apparatus 700 for generating an image in this embodiment may include: a standard image acquisition unit 701 and a distorted image generation unit 702. The standard image acquisition unit 701 is configured to acquire a standard image; the distorted image generation unit 702 is configured to process the standard image based on an inverse action sequence of an image processing action sequence, and generate a distorted image corresponding to the standard image, wherein the image processing action sequence is determined according to an image processing action for processing a sample distorted image into a sample standard image.
[0137] In the apparatus 700 for generating an image, the specific processing of the standard image acquisition unit 701 and the distorted image generation unit 702 and the technical effects thereof can be referred to in Figure 2 The relevant descriptions of steps 201 - 202 in the corresponding embodiment are not repeated here.
[0138] In some optional implementations of this embodiment, the device 700 also includes: a distortion type acquisition unit, configured to obtain the distortion type of the missing distorted image; and an action sequence extraction unit, configured to extract an image processing action sequence with a type label of the distortion type from a set of image processing action sequences.
[0139] In some optional implementations of this embodiment, the device 700 also includes: a quantity distribution reading unit, configured to read the quantity distribution of the distortion types of the generated distorted image; and a distortion type acquisition unit, further configured to acquire the distortion type of the missing distorted image based on the distribution result of the quantity distribution, wherein the proportion of the distortion type of the missing distorted image in the distribution result is less than or equal to the proportion threshold.
[0140] In some optional implementations of the present embodiment, the apparatus 700 further includes: an initial action sequence determining unit, configured to determine an initial image processing action sequence based on an image processing action for processing a sample distorted image into a sample standard image; and a first action sequence determining unit, configured to use the initial image processing action sequence as an image processing action sequence in response to the number of image processing actions included in the initial image processing action sequence being less than or equal to a first number threshold.
[0141] In some optional implementations of the present embodiment, the device 700 also includes: a first initial action sequence updating unit, configured to update the initial image processing action sequence in response to the number of image processing actions included in the initial image processing action sequence being greater than a first number threshold, by continuously deleting the corresponding target image processing actions whose corrected contributions are less than or equal to the contribution threshold starting from the beginning of the initial image processing action sequence toward the end; and a second action sequence determining unit, configured to use the updated initial image processing action sequence as the image processing action sequence.
[0142] In some optional implementations of the present embodiment, the device 700 also includes: a second initial action sequence updating unit, configured to update the initial image processing action sequence in response to the number of image processing actions included in the initial image processing action sequence being less than or equal to a second quantity threshold, by adding at least one preset incremental image processing action before the head end of the initial image processing action sequence, so that the number of image processing actions included in the updated initial image processing action sequence is greater than the second quantity threshold, wherein the second quantity threshold is less than the first quantity threshold; and a third action sequence determining unit, configured to use the updated initial image processing action sequence as the image processing action sequence.
[0143] In some optional implementations of this embodiment, the device 700 also includes: an image set classification unit, configured to classify the distorted image into a corresponding distorted image set based on the number of image processing actions included in the image processing action sequence and / or the distortion type corresponding to the image processing action sequence, wherein different distorted image sets are correspondingly associated with a number interval of the number of image processing actions that meet the storage requirements and / or the distortion type that meets the storage requirements.
[0144] In some optional implementations of this embodiment, the standard image is generated using Pillow or an open source computer vision library.
[0145] This embodiment exists as an apparatus embodiment corresponding to the above-mentioned method embodiment for generating an image. The apparatus for generating an image provided by this embodiment can be based on an action sequence and an action flow for correcting and solving image distortion. The present disclosure can generate corresponding distorted images incrementally, close to reality and with high quality based on a standard image by reversely executing the action sequence and the action flow.
[0146] Further references Figure 8 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for training an image distortion correction model. Figure 5 Corresponding to the method embodiment of training the image distortion correction model shown, the device can be specifically applied to various electronic devices.
[0147] like Figure 8 As shown, the apparatus 800 for training an image distortion correction model in this embodiment may include: a model training unit 801 and a model determination unit 802. The model training unit 801 is configured to use a distorted image corresponding to a standard image as input and the standard image as output to train an initial image distortion correction model, wherein the distorted image is generated based on the standard image using the apparatus 700; the model determination unit 802 is configured to obtain an image distortion correction model in response to the training of the initial image distortion correction model meeting the training requirements.
[0148] In this embodiment, in the apparatus 800 for training an image distortion correction model, the specific processing of the model training unit 801 and the model determination unit 802 and the technical effects thereof can be referred to in Figure 5 The relevant descriptions of steps 501-502 in the corresponding embodiment are not repeated here.
[0149] This embodiment exists as an apparatus embodiment corresponding to the above-mentioned method embodiment for training an image distortion correction model. The apparatus for training an image distortion correction model provided by this embodiment can more efficiently and efficiently construct image pairs of standard images and distorted images for use in training tasks such as image distortion correction models, and can reduce the difficulty of training the image distortion correction model and improve the training quality of the image distortion correction model.
[0150] Further references Fig. 9 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for correcting a distorted image. Figure 6 Corresponding to the embodiment of the method for correcting a distorted image, the device can be specifically applied to various electronic devices.
[0151] like Fig. 9 As shown, the apparatus 900 for correcting a distorted image in this embodiment may include: an image acquisition unit 901 for correcting an image and an image distortion correction unit 902. The image acquisition unit 901 for correcting an image is configured to acquire an image for correcting an image; the image distortion correction unit 902 is configured to process the image for correcting an image using an image distortion correction model to obtain a corrected image corresponding to the image for correcting an image, wherein the image distortion correction model is trained according to the apparatus for training an image distortion correction model.
[0152] In this embodiment, in the apparatus 900 for training the image distortion correction model, the specific processing of the image acquisition unit 901 to be corrected and the image distortion correction unit 902 and the technical effects thereof can be referred to in Figure 6 The relevant descriptions of steps 601-602 in the corresponding embodiment are not repeated here.
[0153] This embodiment exists as a device embodiment corresponding to the above-mentioned method embodiment of training an image distortion correction model. The device for training an image distortion correction model provided by this embodiment can complete the task of "distortion correction" of images with better quality.
[0154] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0155] Fig.10 A schematic block diagram of an example electronic device 1000 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0156] like Fig.10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0157] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0158] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above, such as generating images, training image distortion correction models, and methods for correcting distorted images. For example, in some embodiments, the methods for generating images, training image distortion correction models, and correcting distorted images may be implemented as computer software programs, which are tangibly included in machine-readable media, such as storage units 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the methods for generating images, training image distortion correction models, and correcting distorted images described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured in any other appropriate manner (eg, by means of firmware) to execute the method of generating an image, training an image distortion correction model, and correcting a distorted image.
[0159] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0160] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0161] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0162] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0163] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0164] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client-server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services. The server can also be divided into a server of a distributed system, or a server combined with a blockchain.
[0165] According to the technical solution of the embodiment of the present disclosure, based on the action sequence and action flow for correcting and solving image distortion, the present disclosure can generate corresponding distorted images incrementally, close to the real situation and with high quality based on the standard image by reversely executing the action sequence and action flow. Moreover, in this way, it is also possible to construct image pairs of standard images and distorted images more efficiently and with higher quality for use in training tasks such as image distortion correction models, which can reduce the training difficulty of the image distortion correction model and improve the training quality of the image distortion correction model. Moreover, it is possible to complete the "distortion correction" task of the image with higher quality and complete the "distortion correction" of the image with higher quality.
[0166] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions provided by this disclosure can be achieved, and this document does not limit this.
[0167] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating an image, comprising: Get a standard image; The standard image is processed based on an inverse action sequence of an image processing action sequence to generate a distorted image corresponding to the standard image, wherein the image processing action sequence is determined according to the image processing action for processing the sample distorted image into the sample standard image.
2. The method according to claim 1, further comprising: Get the distortion type of the missing distorted image; An image processing action sequence having a type label of the distortion type is extracted from the image processing action sequence set.
3. The method according to claim 2, further comprising: Read the distribution of the number of distortion types of the generated distorted image; as well as The obtaining of the distortion type of the missing distorted image includes: Based on the distribution result of the quantity distribution, the distortion type of the missing distorted image is obtained, wherein a proportion of the distortion type of the missing distorted image in the distribution result is less than or equal to a proportion threshold.
4. The method according to claim 1, further comprising: determining an initial image processing action sequence according to an image processing action for processing the sample distorted image into the sample standard image; In response to the number of image processing actions included in the initial image processing action sequence being less than or equal to a first number threshold, the initial image processing action sequence is used as the image processing action sequence.
5. The method according to claim 4, further comprising: In response to the number of image processing actions included in the initial image processing action sequence being greater than the first number threshold, the initial image processing action sequence is updated by successively deleting the corresponding target image processing actions whose modified contributions are less than or equal to the contribution threshold starting from the beginning of the initial image processing action sequence and moving toward the end; The updated initial image processing action sequence is used as the image processing action sequence.
6. The method according to claim 4, further comprising: In response to the number of image processing actions included in the initial image processing action sequence being less than or equal to a second number threshold, the initial image processing action sequence is updated by adding at least one preset incremental image processing action before the head end of the initial image processing action sequence, so that the number of image processing actions included in the updated initial image processing action sequence is greater than the second number threshold, wherein the second number threshold is less than the first number threshold; The updated initial image processing action sequence is used as the image processing action sequence.
7. The method according to claim 1, further comprising: Based on the number of image processing actions included in the image processing action sequence and / or the distortion type corresponding to the image processing action sequence, the distorted image is classified into a corresponding distorted image set, wherein different distorted image sets are correspondingly associated with a number interval of the number of image processing actions that meet the storage requirements and / or the distortion type that meets the storage requirements.
8. The method according to any one of claims 1 to 7, wherein: The standard images are generated using Pillow or an open source computer vision library.
9. A method for training an image distortion correction model, comprising: Taking a distorted image corresponding to a standard image as input and the standard image as output, training an initial image distortion correction model, wherein the distorted image is generated based on the standard image using the method for generating an image according to any one of claims 1 to 8; In response to the training of the initial image distortion correction model meeting the training requirement, an image distortion correction model is obtained.
10. A method for correcting a distorted image, comprising: Acquire the image to be corrected; The image to be corrected is processed using an image distortion correction model to obtain a corrected image corresponding to the image to be corrected, wherein the image distortion correction model is trained according to the method for training an image distortion correction model according to claim 9.
11. A device for generating an image, comprising: A standard image acquisition unit configured to acquire a standard image; The distorted image generating unit is configured to process the standard image based on an inverse action sequence of an image processing action sequence to generate a distorted image corresponding to the standard image, wherein the image processing action sequence is determined according to the image processing action for processing the sample distorted image into the sample standard image.
12. The apparatus according to claim 11, further comprising: A distortion type acquisition unit, configured to acquire the distortion type of the missing distorted image; The action sequence extraction unit is configured to extract an image processing action sequence having a type label of the distortion type from the image processing action sequence set.
13. The apparatus according to claim 12, further comprising: a quantity distribution reading unit configured to read a quantity distribution of distortion types of the generated distorted image; as well as The distortion type acquisition unit is further configured to acquire the distortion type of the missing distorted image based on the distribution result of the quantity distribution, wherein a proportion of the distortion type of the missing distorted image in the distribution result is less than or equal to a proportion threshold.
14. The apparatus according to claim 11, further comprising: an initial action sequence determining unit, configured to determine an initial image processing action sequence according to an image processing action for processing the sample distorted image into the sample standard image; The first action sequence determining unit is configured to use the initial image processing action sequence as the image processing action sequence in response to the number of image processing actions included in the initial image processing action sequence being less than or equal to a first number threshold.
15. The apparatus according to claim 14, further comprising: A first initial action sequence updating unit is configured to update the initial image processing action sequence by successively deleting the corresponding target image processing actions whose modified contributions are less than or equal to the contribution threshold from the beginning to the end of the initial image processing action sequence in response to the number of image processing actions included in the initial image processing action sequence being greater than the first number threshold; The second action sequence determining unit is configured to use the updated initial image processing action sequence as the image processing action sequence.
16. The apparatus according to claim 14, further comprising: A second initial action sequence updating unit is configured to, in response to the number of image processing actions included in the initial image processing action sequence being less than or equal to a second number threshold, update the initial image processing action sequence by adding at least one preset incremental image processing action before the head end of the initial image processing action sequence, so that the number of image processing actions included in the updated initial image processing action sequence is greater than the second number threshold, wherein the second number threshold is less than the first number threshold; The third action sequence determining unit is configured to use the updated initial image processing action sequence as the image processing action sequence.
17. The apparatus according to claim 11, further comprising: The image set classification unit is configured to classify the distorted image into a corresponding distorted image set based on the number of image processing actions included in the image processing action sequence and / or the distortion type corresponding to the image processing action sequence, wherein different distorted image sets are correspondingly associated with a number interval of the number of image processing actions that meet the storage requirements and / or the distortion type that meets the storage requirements.
18. The device according to any one of claims 11 to 17, wherein: The standard images are generated using Pillow or an open source computer vision library.
19. A device for training an image distortion correction model, comprising: A model training unit, configured to take a distorted image corresponding to a standard image as input and the standard image as output, and train an initial image distortion correction model, wherein the distorted image is generated based on the standard image using the image generating device according to any one of claims 11 to 18; The model determination unit is configured to obtain the image distortion correction model in response to the training of the initial image distortion correction model meeting the training requirement.
20. A device for correcting a distorted image, comprising: An image-to-be-corrected acquiring unit, configured to acquire an image-to-be-corrected; The image distortion correction unit is configured to process the image to be corrected using an image distortion correction model to obtain a corrected image corresponding to the image to be corrected, wherein the image distortion correction model is trained by the device for training an image distortion correction model according to claim 19.
21. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for generating an image as described in any one of claims 1 to 8, and / or the method for training an image distortion correction model as described in claim 9, and / or the method for correcting a distorted image as described in claim 10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method for generating an image according to any one of claims 1 to 8, and / or the method for training an image distortion correction model according to claim 9, and / or the method for correcting a distorted image according to claim 10.
23. A computer program product, comprising a computer program, which, when executed by a processor, implements the method for generating an image according to any one of claims 1 to 8, and / or the method for training an image distortion correction model according to claim 9, and / or the method for correcting a distorted image according to claim 10.