Image correction method, generator training method, and related devices

By generating a reference image and fusing it with the image to be processed, the problem of image quality degradation caused by image noise is solved, and the image correction and recognition effects are improved.

CN114219721BActive Publication Date: 2026-03-27ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-10
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Image noise in imaging technology degrades image quality and affects the effectiveness of image applications, especially in scenarios such as license plate recognition and worker safety helmet recognition, where existing technologies struggle to effectively remove noisy images.

Method used

A reference image is generated from the image to be processed. A generator then produces a reference image containing correction information for the target image region, which is fused with the image to be processed to generate the corrected image. The generator is processed through an encoder, bottleneck layer, and decoder structure, and its accuracy is improved by training with a discriminator.

Benefits of technology

It effectively reduces the processing complexity of the generator, improves processing efficiency, and generates corrected images that are closer to clear images, thereby improving image quality and recognition accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114219721B_ABST
    Figure CN114219721B_ABST
Patent Text Reader

Abstract

The application discloses an image correction method, a generator training method, an electronic device and a computer readable storage medium. The image correction method comprises the following steps: acquiring a to-be-processed image; processing the to-be-processed image to generate a reference image corresponding to the to-be-processed image, wherein the reference image contains correction information of a target image region in the to-be-processed image, and the target image region is an image region that does not meet a preset image quality; and processing the to-be-processed image by using the reference image to obtain a corrected image corresponding to the to-be-processed image. Through the above method, the to-be-processed image can be corrected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image correction method, a generator training method, an electronic device, and a computer-readable storage medium. Background Technology

[0002] Imaging technology is applied in a wide variety of scenarios, such as traffic, construction, and finance. Due to the inherent precision of the imaging technology or interference from external factors, the captured images are prone to noise. External factors can include changes in the subject's state, occlusion, and exposure levels. Image noise refers to unnecessary or redundant interfering information present in an image.

[0003] Noise in images degrades their quality, affecting not only their aesthetics but also their applications. For example, in traffic scenarios, noisy license plate images can cause recognition algorithms to fail to accurately identify license plate numbers when used for license plate number recognition. Similarly, noisy worker images captured in construction scenarios can prevent algorithms from accurately identifying whether workers are wearing safety helmets. Therefore, it is necessary to remove noisy images. Summary of the Invention

[0004] This application provides an image correction method, an electronic device, and a computer-readable storage medium, which can correct noisy images to be processed.

[0005] To address the aforementioned technical problems, this application provides an image correction method. The method includes: acquiring an image to be processed; processing the image to be processed to generate a reference image corresponding to the image to be processed, the reference image containing correction information for a target image region in the image to be processed, the target image region being an image region that does not meet a preset image quality; and processing the image to be processed using the reference image to obtain a corrected image corresponding to the image to be processed.

[0006] To address the aforementioned technical problems, another technical solution adopted in this application is: providing a generator training method, the method comprising: acquiring multiple sample pairs, each sample pair containing a first sample image and a second sample image with identical image content, wherein the quality of the first sample image does not conform to a preset image quality, and the image quality of the second sample image conforms to the preset image quality; processing the first sample image contained in each sample pair using a generator to generate a first reference image corresponding to each sample pair, the first reference image containing first correction information for a target image region in the first sample image, the target image region being an image region that does not conform to the preset image quality; processing the first sample image contained in each sample pair using the first reference image corresponding to each sample pair to obtain a first corrected image corresponding to each sample pair; and adjusting the parameters of the generator based on the difference information between the first corrected image corresponding to each sample pair and the second sample image contained in each sample pair.

[0007] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide an electronic device, which includes a processor and a memory connected to the processor, wherein the memory stores program instructions; the processor is used to execute the program instructions stored in the memory to implement the above-mentioned method.

[0008] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium storing program instructions that, when executed, can implement the above-mentioned method.

[0009] In the above manner, this application processes the image to be processed to generate a reference image corresponding to the image to be processed. Since the reference image includes correction information for the target image region (the region with noise) in the image to be processed, processing the image to be processed using the reference image can correct the target image region and obtain the corrected image to be processed (corrected image). Attached Figure Description

[0010] Figure 1 This is a flowchart illustrating an embodiment of the image correction method of this application;

[0011] Figure 2 This is a schematic diagram of the generator in this application;

[0012] Figure 3 This is another structural diagram of the generator in this application;

[0013] Figure 4 This is a schematic diagram of the encoder structure of this application;

[0014] Figure 5 This is a structural schematic diagram of the convolution module of this application;

[0015] Figure 6 This is a structural diagram of the bottleneck layer in this application;

[0016] Figure 7 This is a structural schematic diagram of the residual module of this application;

[0017] Figure 8 This is a schematic diagram of the decoder structure of this application;

[0018] Figure 9 This is a schematic diagram of the deconvolution module of this application;

[0019] Figure 10 This is a flowchart illustrating another embodiment of the image correction method of this application;

[0020] Figure 11 This is a flowchart illustrating an embodiment of the generator training method of this application;

[0021] Figure 12 yes Figure 11 A detailed flowchart of the S34 process;

[0022] Figure 13 This is a flowchart illustrating an embodiment of the training method for the discriminator in this application;

[0023] Figure 14 This is a schematic diagram of the structure of an embodiment of the electronic device of this application;

[0024] Figure 15 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0026] The terms "first," "second," and "third" used in this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

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

[0028] Figure 1 This is a schematic flowchart of an embodiment of the image correction method of this application. It should be noted that if substantially the same result is achieved, this embodiment does not necessarily replace it. Figure 1 The illustrated process sequence is limited. For example... Figure 1 As shown, this embodiment may include:

[0029] S11: Obtain the image to be processed.

[0030] The image to be processed is an image containing noise. Noise manifests in an image in various forms, including but not limited to occlusion and blurring. Occlusion occurs when the subject is obscured. For example, the subject might be a face, but the face is obscured by a vehicle. Blurring may be caused by the subject being in motion or by overexposure.

[0031] Whether an image is blurry is determined by its sharpness. Specifically, if the image's sharpness is below a preset sharpness threshold, the image is considered blurry. This preset sharpness threshold can be adjusted according to actual needs. Higher desired sharpness requires a larger preset sharpness threshold, and vice versa.

[0032] The noisy image region in the image to be processed may be the entire image region or a local image region. Hereinafter, this application will refer to the noisy image region in the image to be processed as a region that does not meet image quality standards.

[0033] S12: Process the image to be processed to generate a reference image corresponding to the image to be processed.

[0034] The reference image contains correction information for the target image region in the image to be processed. The target image region is the image region that does not meet the preset image quality.

[0035] For example, if the image to be processed is blurry, the target image region is the blurry area in the image to be processed (the area with a sharpness lower than a preset sharpness threshold). Alternatively, if the image to be processed is occluded, the target image region is the occluded area in the image to be processed.

[0036] The reference image has the same dimensions as the image to be processed. The reference image serves as a mask for the target region, and the processable region in the reference image corresponds to the target image region in the image to be processed. The pixel values ​​in the reference image contain correction information for the corresponding pixel values ​​in the image to be processed.

[0037] S13: Use the reference image to process the image to be processed to obtain the corrected image.

[0038] The method of processing the image to be processed using a reference image involves fusing the target image region in the image to be processed with the processable region in the reference image. Specifically, the pixel values ​​outside the processable region in the reference image are set to 0, and then the reference image and the image to be processed are fused. This ensures that the fusion process only applies to the target image region in the image to be processed. Fusion includes, but is not limited to, operations such as adding or subtracting corresponding pixel values.

[0039] Through the implementation of this embodiment, this application processes the image to be processed to generate a reference image corresponding to the image to be processed. Since the reference image includes correction information for the target image region (the region with noise) in the image to be processed, processing the image to be processed using the reference image can achieve correction of the target image region and obtain the corrected image to be processed (corrected image).

[0040] Furthermore, in S12, the reference image obtained by processing the image to be processed is implemented based on the trained generator (G). That is, S12 includes: using the trained generator to process the image to be processed and generating the reference image corresponding to the image to be processed.

[0041] Based on the generator-based implementation of S12, combined with Figure 2 For example, S11 to S13 are illustrated as follows: The image to be processed x is input into the generator G. The generator G generates a reference image m based on x. The reference image m is fused with the image to be processed to obtain the image to be processed.

[0042] Understandably, in order to correct the image to be processed, if a generator is used to directly generate the image to be processed based on the image to be processed, the generator will have high processing complexity and low processing efficiency, and the requirements for the generator will be correspondingly high.

[0043] Building upon the generator-based implementation in S12, this application does not directly use the generator to generate a corrected image from the image to be processed. Instead, it first uses the generator to generate a reference image from the image to be processed, and then uses the reference image to correct the image to be processed. Since the process of generating a reference image from the image to be processed only applies to the target image region, it can reduce the processing complexity of the generator, improve the processing efficiency of the generator, and thus reduce the processing requirements of the generator while achieving correction.

[0044] The following is combined with Figures 3-6 The structure of the generator is explained as follows:

[0045] A generator consists of an encoder, a bottleneck layer, and a decoder. An example of a generator is shown below. Figure 3 .

[0046] The encoder consists of several convolutional (conv) modules. Each convolutional module comprises a sequentially connected convolutional layer, a first normalization layer (InstanceNorm), and a first activation layer (Activation Function (ReLU)). An example of an encoder is shown below. Figure 4 , Figure 4 The encoder comprises four convolutional modules: Convolutional Module 1, Convolutional Module 2, Convolutional Module 3, and Convolutional Module 4. The kernel size and stride of the convolutional layers within each module can be set according to specific needs. For example, the kernel size for all convolutional layers in modules 1 through 4 can be set to 3×3, the stride of the kernel in module 1 can be set to 1, and the stride of the kernels in modules 2 through 4 can be set to 2. An example of a convolutional module is shown below. Figure 5 , Figure 5 The kernel size of the middle convolutional layer is 3×3.

[0047] The bottleneck layer comprises several residual modules. Each residual module consists of a series of sequentially connected convolutional-batch-mean (BN) layers and a summing layer. The convolutional-batch-mean layer consists of sequentially connected convolutional layers and batch-mean layers, with the input to each residual module directly connected to the summing layer via a convolutional layer. An example of a bottleneck layer is shown below. Figure 6 , Figure 6 The bottleneck layer consists of four residual modules: Residual Module 1, Residual Module 2, Residual Module 3, and Residual Module 4. An example of a residual module is shown below. Figure 7 , Figure 7The residual module comprises two convolutional-batch averaging (BNA) layers. The first BNA layer consists of convolutional layer 1 (3×3 convolutional layer 1) and batch averaging layer 1 (BN layer 1), while the second BNA layer consists of convolutional layer 2 (3×3 convolutional layer 2) and batch averaging layer 2 (BN layer 2). The input to the residual module is directly connected to the summing layer via a 1×1 convolutional layer. Each residual module is followed by an activation layer (with activation parameters (ReLU)).

[0048] The decoder consists of several deconvolutional modules. Each deconvolutional module includes a deconvolutional layer, a second normalization layer (InstanceNorm), and a second activation layer (activation function). An example of a decoder is shown below. Figure 8 , Figure 8 The encoder includes three deconvolution modules: deconvolution module 1, deconvolution module 2, and deconvolution module 3 (6×6 deconvolution). The kernel size and stride of the deconvolution layers in each module can be set according to actual needs. For example, the stride of the kernels in deconvolution modules 1-3 can all be set to 2, the kernel size of deconvolution layers in deconvolution modules 1-2 can be 3×3, and the kernel size of deconvolution module 3 can be 6×6. The activation function of the second activation layer in deconvolution modules 1-2 is ReLU, and the activation function of the second activation layer in deconvolution module 3 is Tanh. An example of a deconvolution layer is shown below. Figure 9 .

[0049] Based on the above structure, during the generator's processing of the image to be processed, the encoder encodes the image, the bottleneck layer adjusts the encoding result to connect the encoder's output with the decoder's input, and the decoding layer decodes the adjusted encoding result to obtain the reference image. Therefore, S12 can be limited as follows:

[0050] Figure 10 This is a schematic flowchart of another embodiment of the image correction method of this application. It should be noted that if substantially the same result is achieved, this embodiment does not necessarily reflect that outcome. Figure 10 The illustrated process sequence is limited. This embodiment is a further extension of S12. Figure 10 As shown, this embodiment may include:

[0051] S21: Encode the image to be processed using an encoder to obtain the first feature map.

[0052] S22: Adjust the first feature map using the bottleneck layer to obtain the second feature map.

[0053] S23: Use a decoder to decode the second feature map to obtain a reference image.

[0054] Furthermore, before using the generator as described above, it needs to be trained to the desired level. The generator is trained based on sample pairs, and the specific training process for the generator can be as follows:

[0055] Figure 11 This is a flowchart illustrating an embodiment of the generator training method of this application. It should be noted that if substantially the same result is obtained, this embodiment does not necessarily replace it with the original. Figure 11 The illustrated process sequence is limited. For example... Figure 11 As shown, this embodiment may include:

[0056] S31: Obtain multiple sample pairs.

[0057] Each sample pair consists of a first sample image and a second sample image with identical image content.

[0058] The image quality of the first sample image does not meet the preset image quality, while the image quality of the second sample image meets the preset image quality.

[0059] Multiple sample pairs can include images from a single scene or images from multiple scenes, depending on the specific needs. For example, if the generator is only used for correcting images acquired in a single scene, then the training sample set can consist only of images from that single scene. If the generator needs to be used for correcting images acquired in different scenes, then the training sample set can include images from different scenes. In short, to improve the training effect of the generator, the acquisition scene of the sample images used to train the generator should ideally match / cover the acquisition scene of the images to be processed in the application stage.

[0060] S32: Use the generator to process the first sample image contained in each sample pair to generate the first reference image corresponding to each sample pair.

[0061] The first reference image includes first correction information for the corresponding first sample image. The principle of the first reference image is similar to that of the reference image in the application process, and will not be elaborated here.

[0062] S33: Using the first reference image corresponding to each sample pair, process the first sample image contained in each sample pair to obtain the first corrected image corresponding to each sample pair.

[0063] For a detailed description of S31 to S33, please refer to the preceding embodiments; they will not be repeated here.

[0064] S34: Adjust the generator parameters based on the difference information between the first corrected image corresponding to each sample pair and the second sample image contained in each sample pair.

[0065] As an example, the generator parameters can be adjusted directly based on the difference in pixel values ​​between the first corrected image and the corresponding second sample image.

[0066] As another embodiment, the training of the generator can be based on using a discriminator to assist in the process. (See also...) Figure 12 In this case, S34 may include the following sub-steps:

[0067] S341: Use a discriminator to distinguish the first corrected image corresponding to each sample pair and the second sample image contained in each sample pair to obtain the first discrimination result.

[0068] The first discrimination result may include a first discrimination probability that the first corrected image is a real image and a second discrimination probability that the second sample image is a real image.

[0069] As one embodiment, the discriminator includes several convolutional layers (e.g., four convolutional layers with a kernel size of 3×3 and a stride of 2), each convolutional layer is followed by a BatchNorm and a LeakyReLU activation function, and finally passes through a fully connected layer and outputs the first / second discrimination probability using a Sigmoid function.

[0070] Understandably, the first discrimination result can be used to measure the accuracy of the first reference image generated by the generator. That is, the less accurate the first discrimination result (the closer the first discrimination probability is to 1, and the closer the second discrimination probability is to 0), the closer the first corrected image is to the real image, the better the processing effect of the first sample image using the first reference image, and the more accurate the first reference information generated by the generator.

[0071] S342: Calculate the loss using the first discrimination result, and adjust the generator parameters based on the loss.

[0072] The first loss can be obtained by using the difference between the first discrimination probability and 1, and the second loss can be obtained by using the difference between the second discrimination probability and 0. The first loss and the second loss are added together to obtain the final loss. The loss is backpropagated to adjust the generator's parameters, thereby training the generator.

[0073] Specifically, a first loss function can be constructed using the difference between the first discrimination probability and 1, resulting in the first loss; a second loss function can be constructed using the second discrimination probability and 0, resulting in the second loss. The first / second loss functions include, but are not limited to, the mean squared error loss function (MSE loss).

[0074] Through the above training, the generator can make the first reference image generated more and more accurate (including the accuracy of the processable area of ​​the first reference image and the accuracy of the pixel values ​​of the processable area), and thus the first corrected image becomes closer and closer to the second sample image.

[0075] Therefore, by applying the trained generator to the processing of the image to be processed, a more accurate reference image can be obtained, and the corrected image obtained based on the reference image is closer to the clear image corresponding to the image to be processed.

[0076] Furthermore, before using the discriminator as described above, it needs to be trained to the desired level. Specifically, this can be done as follows:

[0077] Figure 13 This is a schematic flowchart of an embodiment of the training method for the discriminator of this application. It should be noted that if substantially the same result is obtained, this embodiment does not necessarily replace it. Figure 13 The illustrated process sequence is limited. For example... Figure 13 As shown, this embodiment may include:

[0078] S41: Use the generator to process the first sample image contained in each sample pair to generate the second reference image corresponding to each sample pair.

[0079] The second reference image includes second correction information for the corresponding first sample image. The principle of the second reference image is similar to that of the reference image in the application process, and will not be elaborated here.

[0080] S42: Using the second reference image corresponding to each sample pair, process the first sample image contained in each sample pair to obtain the second corrected image corresponding to each sample pair.

[0081] S43: Use the discriminator to distinguish the second corrected image corresponding to each sample pair and the second sample image contained in each sample pair to obtain the second discrimination result.

[0082] The second discrimination result includes a third discrimination probability that the second corrected image is a real image and a fourth discrimination probability that the second sample image is a real image.

[0083] The more accurate the second discrimination result (the closer the third discrimination probability is to 0, and the closer the fourth discrimination probability is to 1), the higher the discrimination accuracy of the discriminator.

[0084] S44: Adjust the parameters of the discriminator based on the second discrimination result.

[0085] A third loss function can be constructed based on the difference between the third discrimination probability and 0, yielding the third loss; and a fourth loss function can be constructed based on the difference between the fourth discrimination probability and 1, yielding the fourth loss. The third and fourth losses are then added together to obtain the discriminator's loss. Based on the discriminator's losses, the discriminator's parameters are adjusted. The third / fourth loss functions are the same as the first / second loss functions.

[0086] By training the discriminator, the discriminator can become increasingly accurate in its second discrimination results for the second corrected image and the second sample image.

[0087] For further detailed descriptions of each step in this embodiment, please refer to the preceding embodiment descriptions, which will not be repeated here.

[0088] The training of the generator and discriminator can be performed alternately or sequentially. Alternating training involves training the discriminator while keeping its parameters constant, then using the discriminator to assist the generator in training once; this process is repeated until the generator is trained to the desired level. Sequential training involves training the discriminator to the desired level, keeping its parameters constant, and then using the discriminator to assist the generator in training to the desired level.

[0089] In addition, after training the generator, the generator / discriminator can be tested using a test set to assess the generator's training performance.

[0090] Figure 14 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. Figure 14 As shown, the electronic device includes a processor 21 and a memory 22 coupled to the processor 21.

[0091] The memory 22 stores program instructions for implementing the methods of any of the above embodiments; the processor 21 executes the program instructions stored in the memory 22 to implement the steps of the above method embodiments. The processor 21 may also be referred to as a CPU (Central Processing Unit). The processor 21 may be an integrated circuit chip with signal processing capabilities. The processor 21 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor may be a microprocessor or any conventional processor.

[0092] Figure 15 This is a schematic diagram of the structure of an embodiment of the computer-readable storage medium of this application. Figure 15As shown, the computer-readable storage medium 30 of this application embodiment stores program instructions 31, which, when executed, implement the methods provided in the above embodiments of this application. The program instructions 31 can form a program file and be stored in the computer-readable storage medium 30 in the form of a software product, so that a computer device (which may be a personal computer, server, or network device, etc.) or processor can execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned computer-readable storage medium 30 includes various media capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, or terminal devices such as computers, servers, mobile phones, and tablets.

[0093] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.

[0094] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units. The above are merely embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made based on the description and drawings of this application, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. An image correction method, characterized in that, include: Obtain the image to be processed; The image to be processed is processed to generate a reference image corresponding to the image to be processed. The reference image contains correction information for a target image region in the image to be processed. The target image region is an image region that does not meet the preset image quality. The image to be processed is processed using the reference image to obtain a corrected image corresponding to the image to be processed; The step of processing the image to be processed to generate a reference image corresponding to the image to be processed includes: The trained generator is used to process the image to be processed to generate a reference image corresponding to the image to be processed. The generator is trained based on sample pairs, which include a first sample image and a second sample image with identical image content. The image quality of the first sample image does not meet the preset image quality, while the image quality of the second sample image does meet the preset image quality. The step of processing the image to be processed using the reference image to obtain a corrected image corresponding to the image to be processed includes: The corrected image is obtained by adding or subtracting the pixel values ​​of the target image region in the image to be processed using the pixel values ​​of the target image region in the reference image.

2. The method according to claim 1, characterized in that, The image regions that do not meet the preset image quality include at least one of the following: The obscured image area; Image areas with a resolution lower than a preset resolution threshold.

3. The method according to claim 2, characterized in that, The generator is trained using the following steps: Obtain multiple sample pairs; The generator is used to process the first sample image contained in each sample pair to generate a first reference image corresponding to each sample pair; Using the first reference image corresponding to each sample pair, the first sample image contained in each sample pair is processed to obtain the first corrected image corresponding to each sample pair; The parameters of the generator are adjusted based on the difference information between the first corrected image corresponding to each sample pair and the second sample image contained in each sample pair.

4. The method according to claim 3, characterized in that, The step of adjusting the generator parameters based on the difference information between the first corrected image corresponding to each sample pair and the second sample image contained in each sample pair includes: The discriminator is used to distinguish the first corrected image corresponding to each sample pair and the second sample image contained in each sample pair to obtain the first discrimination result; The loss is calculated using the first discrimination result, and the parameters of the generator are adjusted based on the loss.

5. The method according to claim 4, characterized in that, The first discrimination result includes a first discrimination probability that the first corrected image is a real image and a second discrimination probability that the second sample image is a real image. The step of calculating the loss using the first discrimination result includes: The first loss is obtained by using the difference between the first discrimination probability and 1, and the second loss is obtained by using the difference between the second discrimination probability and 0. The loss is obtained by adding the first loss to the second loss.

6. The method according to claim 3, characterized in that, Before training the generator, the discriminator is trained using the following steps: The generator is used to process the first sample image contained in each sample pair to generate a second reference image corresponding to each sample pair; Using the second reference image corresponding to each sample pair, the first sample image contained in each sample pair is processed to obtain the second corrected image corresponding to each sample pair; The discriminator is used to distinguish the second corrected image corresponding to each sample pair and the second sample image contained in each sample pair to obtain a second discrimination result; Based on the second discrimination result, the parameters of the discriminator are adjusted.

7. A method for training a generator, characterized in that, include: Multiple sample pairs are obtained, each sample pair containing a first sample image and a second sample image with identical image content. The quality of the first sample image does not meet the preset image quality, while the image quality of the second sample image meets the preset image quality. The generator processes the first sample image contained in each sample pair to generate a first reference image corresponding to each sample pair. The first reference image contains first correction information for the target image region in the first sample image. The target image region is an image region that does not meet the preset image quality. Using the first reference image corresponding to each sample pair, the first sample image contained in each sample pair is processed to obtain the first corrected image corresponding to each sample pair; Based on the difference information between the first corrected image corresponding to each sample pair and the second sample image contained in each sample pair, the parameters of the generator are adjusted. The step of processing the first sample image contained in each sample pair using the first reference image corresponding to each sample pair to obtain the first corrected image corresponding to each sample pair includes: By using the pixel values ​​in the first reference image corresponding to the target image region, the pixel values ​​in the first sample image of the target image region are added or subtracted to obtain the first corrected image.

8. An electronic device, characterized in that, Includes a processor and a memory connected to the processor, wherein, The memory stores program instructions; The processor is configured to execute the program instructions stored in the memory to implement the method of any one of claims 1-7.

9. A computer-readable storage medium, characterized in that, The storage medium stores program instructions, which, when executed, implement the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Image enhancement model training method and device, image enhancement method and device and storage medium

    CN110163235A

  • Machine learning method and system for restoring contaminated regions of image through unsupervised learning based on generative adversarial network

    KR102288645B1