Image processing method and device based on generative adversarial network

By adjusting the parameter update strategy of the generator and image recognition model according to the number of iterations during the training process of the generative adversarial network, the problem of poor generalization of image enhancement is solved, and better image enhancement effect is achieved.

CN116524308BActive Publication Date: 2026-02-17HANGZHOU YICE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310485914.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-28
Publication Date
2026-02-17
Estimated Expiration
2043-04-28

AI Technical Summary

Technical Problem

Existing generative adversarial networks (GANs) suffer from poor generalization in image enhancement during image processing. This manifests as excessively high accuracy on the validation set, but poor performance in actual tests.

Method used

By updating the generator parameters and image recognition model parameters using different optimization strategies based on the current iteration number during the training process of the generative adversarial network, including adopting different optimization strategies at different stages, the generator gradient remains closed during gradient propagation of the image recognition model, while the generator parameters are updated during gradient propagation of the image recognition model.

Benefits of technology

It improves the generalization of image enhancement, making the enhanced images generated in each iteration different, which meets the requirements of deep learning training and improves the actual performance of image recognition models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116524308B_ABST
    Figure CN116524308B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses an image processing method and device based on a generative adversarial network, the method comprising: acquiring an image to be processed, inputting the image to be processed into a pre-trained image recognition model, and obtaining an enhanced image; wherein the image recognition model is obtained by training a generative adversarial network pre-constructed based on image samples, and in the training process of the generative adversarial network, the parameters of the generator of the generative adversarial network and / or the parameters of the image recognition model are updated by using different optimization strategies according to the current iteration number. When the image recognition model is used for image recognition, the image enhancement requirement of deep learning training can be met, the generalization is good, and the problem of poor generalization of image enhancement is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and more specifically to an image processing method and apparatus based on generative adversarial networks. Background Technology

[0002] Generative adversarial networks (GANs) are an important generative model in deep learning. A GAN consists of a generator (G) and a discriminator (D), meaning the two networks are trained simultaneously and compete in a minimax algorithm. This adversarial approach avoids some of the difficulties of traditional generative models in practical applications, cleverly approximating some unsolvable loss functions through adversarial learning. It has wide applications in the generation of data such as images, videos, natural language, and music.

[0003] In image processing, Generative Adversarial Networks (GANs) are frequently used for image enhancement. During network training, several images of different shapes need to be collected, and the GAN is trained using a weakly supervised method. During iterative training of G and D, gradient backpropagation of D is disabled when training G, and vice versa. This process is repeated multiple times to obtain the trained GAN. In actual use, the GAN's discriminator does not participate in image generation; the generator G is in eval mode, gradient backpropagation is disabled, and the GAN parameters are no longer updated. Assuming there are two image data sets X and Y from different domains, if the input is an image x belonging to domain X, the generator G outputs the corresponding image y' = G(x) in domain Y; if the input is an image y belonging to domain Y, the generator G outputs the corresponding image x' = G(y) in domain X. The output images x' and y', along with the original images x and y, are used to train the image recognition model M. As M is trained iteratively, its performance improves and its recognition accuracy increases. However, when the image richness provided by the generator G is insufficient, it can cause M to overfit. This manifests as M performing too well on the validation set during training, but performing poorly in actual testing, resulting in poor generalization of image enhancement. Summary of the Invention

[0004] Therefore, embodiments of the present invention provide an image processing method and apparatus based on generative adversarial networks, in order to at least partially solve the problems existing in the prior art.

[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0006] This invention provides an image processing method based on generative adversarial networks, the method comprising:

[0007] Obtain the image to be processed;

[0008] The image to be processed is input into a pre-trained image recognition model to obtain an enhanced image;

[0009] The image recognition model is trained using image samples based on a pre-built generative adversarial network. During the training process of the generative adversarial network, the generator parameters of the generative adversarial network and / or the parameters of the image recognition model are updated using different optimization strategies according to the current iteration number.

[0010] In some embodiments, the image recognition model is obtained by training image samples based on a pre-built generative adversarial network, specifically including:

[0011] Obtain image samples;

[0012] The image samples are input into a pre-constructed generative adversarial network to obtain enhanced image samples;

[0013] The image recognition model is trained based on the enhanced image samples.

[0014] In some embodiments, the image recognition model is trained based on the enhanced image samples to obtain the model, and then the model further includes:

[0015] The training process is divided into multiple stages based on the current iteration number;

[0016] Different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model.

[0017] In some embodiments, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model, specifically including:

[0018] If the current iteration number is less than the first preset iteration number, the enhanced image sample is input into the image recognition model to obtain the recognition result;

[0019] A first loss function is obtained based on the recognition result and the enhanced image sample;

[0020] The parameters of the image recognition model are updated in the direction of improving the first loss function.

[0021] In some embodiments, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model, specifically including:

[0022] If the current iteration number is greater than the first preset iteration number and less than the second preset iteration number, the recognition result is obtained based on the enhanced image sample;

[0023] A first loss function is obtained based on the recognition result and the enhanced image sample, and a second loss function is obtained based on the enhanced image sample and the image sample;

[0024] The parameters of the generator of the generative adversarial network are updated in the direction of increasing the first loss function and decreasing the second loss function.

[0025] In some embodiments, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model, specifically including:

[0026] If the current iteration number is greater than the second preset iteration number, the enhanced image sample is input into the image recognition model to obtain the recognition result;

[0027] A first loss function is obtained based on the recognition result and the enhanced image sample;

[0028] The parameters of the image recognition model are updated in the direction of reducing the first loss function.

[0029] In some embodiments, the generator of the pre-built generative adversarial network includes:

[0030] An encoder, comprising convolutional layers and pooling layers, wherein the convolutional layers constituting the encoder are used to encode an image into a high-dimensional vector;

[0031] The decoder includes convolutional layers, which perform deconvolution operations to output the high-dimensional vector output by the encoder as an image.

[0032] The present invention also provides an image processing apparatus based on a generative adversarial network, the apparatus comprising:

[0033] The image acquisition unit does not acquire the image to be processed.

[0034] An image processing unit is used to input the image to be processed into a pre-trained image recognition model to obtain an enhanced image;

[0035] The image recognition model is trained using image samples based on a pre-built generative adversarial network. During the training process of the generative adversarial network, the generator parameters of the generative adversarial network and / or the parameters of the image recognition model are updated using different optimization strategies according to the current iteration number.

[0036] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method described above.

[0037] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described above.

[0038] The image processing method and apparatus based on generative adversarial networks provided by this invention can obtain an enhanced image by acquiring an image to be processed and inputting the image to be processed into a pre-trained image recognition model. The image recognition model is obtained by training a pre-constructed generative adversarial network using image samples. During the training process of the generative adversarial network, the generator parameters of the generative adversarial network and / or the parameters of the image recognition model are updated using different optimization strategies according to the current iteration number.

[0039] In this way, when training the image recognition model, the generator is added to the training process. The training of the image recognition model includes two stages. When the parameters of the image recognition model are updated with backpropagation of gradients, the gradient of the generator remains closed. When the gradient of the image recognition model is closed, the parameters of the generator are updated with backpropagation of gradients. In this way, the generator changes at different iterations, so that the enhanced image output by the generator also changes accordingly, making the enhanced image generated in each iteration different. When using this image recognition model for image recognition, it can better meet the image enhancement requirements of deep learning training and has good generalization, thus solving the problem of poor generalization of image enhancement. Attached Figure Description

[0040] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.

[0041] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.

[0042] Figure 1 This is one of the flowcharts for the image processing method based on generative adversarial networks provided by the present invention;

[0043] Figure 2 The second flowchart is a representation of the image processing method based on generative adversarial networks provided by the present invention.

[0044] Figure 3 The third flowchart of the image processing method based on generative adversarial networks provided by the present invention;

[0045] Figure 4 The fourth flowchart of the image processing method based on generative adversarial networks provided by the present invention;

[0046] Figure 5 The fifth flowchart is the image processing method based on generative adversarial networks provided by the present invention.

[0047] Figure 6 The sixth flowchart of the image processing method based on generative adversarial networks provided by the present invention;

[0048] Figure 7 The seventh flowchart of the image processing method based on generative adversarial networks provided by the present invention;

[0049] Figure 8 This is a schematic diagram of the image processing device based on generative adversarial networks provided by the present invention.

[0050] Figure 9 This is a schematic diagram of the physical structure of the electronic device provided by the present invention. Detailed Implementation

[0051] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0052] Please refer to Figure 1 , Figure 1 This is one of the flowcharts for the image processing method based on generative adversarial networks provided by the present invention.

[0053] In one specific embodiment, the present invention provides an image processing method based on generative adversarial networks, comprising the following steps:

[0054] S110: Acquire the image to be processed; the image to be processed may vary depending on the application scenario, such as medical images or facial images.

[0055] S120: Input the image to be processed into a pre-trained image recognition model to obtain an enhanced image; wherein, the image recognition model is trained on a pre-built generative adversarial network using image samples, and during the training of the generative adversarial network, the generator parameters of the generative adversarial network and / or the parameters of the image recognition model are updated using different optimization strategies according to the current iteration number.

[0056] This image processing method can be applied to various scenarios, such as face recognition, medical image processing, or autonomous driving. Obviously, the training samples for the model may differ depending on the specific scenario. This image recognition model has good generalization ability, and the input image can be medical (CT, pathology, etc.) images, face images, license plate images, or remote sensing images. After acquiring the image to be processed, the method provided by this invention will generate a randomly enhanced image, such as: transforming the background other than the main subject in the image, translating, rotating, flipping, or scaling the main subject in a CT image, generating new occlusions, new subjects, or backgrounds in the main subject of a license plate image, etc., to achieve real-time image enhancement.

[0057] In step S120, the image recognition model is obtained by training image samples based on a pre-constructed generative adversarial network, such as... Figure 2 As shown, the specific steps include:

[0058] S210: Obtain image samples. The type of image samples is preferably similar to the image to be processed. For example, when the image to be processed is a medical image, the image samples are samples composed of medical images to improve the accuracy of the model and reduce the amount of computation.

[0059] S220: Input the image samples into a pre-constructed generative adversarial network to obtain enhanced image samples;

[0060] S230: Train the image recognition model based on the enhanced image samples to obtain the image recognition model.

[0061] Furthermore, such as Figure 3 As shown, the image recognition model is trained based on the enhanced image samples to obtain the model, and then the process further includes:

[0062] The training process is divided into multiple stages based on the current iteration number;

[0063] Different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model.

[0064] Specifically, the image processing method provided by this invention is based on Generative Adversarial Networks (GANs). First, similar to existing technologies, a GAN containing a generator G and a discriminator D is trained. Unlike existing GANs, when training the image recognition model M, the generator G is incorporated into the training process. The training of M consists of two phases: when the parameters of M are updated via backpropagation, the gradient of G remains closed; conversely, when the gradient of M is closed, the parameters of G are updated via backpropagation. This allows the generator G to change at different iterations, generating a series of G_1, G_2, ..., G_n, and the output images G(x) and G(y) of the generator also change accordingly. Existing GANs generate cold enhancements, meaning the generated enhanced images do not change further. In contrast, the method proposed in this invention is a hot enhancement, where the enhanced images generated in each iteration are different, better meeting the image enhancement requirements of deep learning training.

[0065] From a network architecture perspective, the pre-built generative adversarial network (GAN) generator includes an encoder and a decoder. The encoder includes convolutional layers and pooling layers. The convolutional layers constituting the encoder are used to encode the image into a high-dimensional vector. The decoder includes convolutional layers. The convolutional layers constituting the decoder perform deconvolution operations to output the high-dimensional vector output by the encoder as an image.

[0066] Existing GANs contain a generator and a discriminator. The generator consists of an encoder and a decoder, which are typically composed of several convolutional layers. The difference lies in that the convolutional layers constituting the encoder, in conjunction with pooling layers, encode the image into a high-dimensional vector, while the convolutional layers constituting the decoder perform deconvolution operations, further outputting the high-dimensional vector from the encoder as an image. The enhanced image output by the decoder differs from the original image; this difference constitutes the image enhancement content. Existing GANs use a discriminator to evaluate the enhanced image and update the model iteratively through generative adversarial mechanisms. The generative adversarial network provided in this invention eliminates the discriminator and uses an image recognition model to evaluate the generator's enhancement effect. A second loss function, loss_p, calculated using the enhanced image output by the generator and the input image, is used to update the generator's parameters. The image recognition model includes image classification, object detection, and semantic segmentation models. Regardless of the model used, the corresponding first loss function, loss_m, can be used to evaluate and, in conjunction with an optimizer, optimize and update the parameters of the corresponding image recognition model.

[0067] When updating parameters using the first loss function and the second loss function, different update strategies are required at different iteration stages. That is, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model.

[0068] In some embodiments, such as Figure 4 As shown, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model, specifically including the following steps:

[0069] S410: If the current iteration number is less than the first preset iteration number, the enhanced image sample is input into the image recognition model to obtain the recognition result;

[0070] S420: Obtain a first loss function based on the recognition result and the enhanced image sample;

[0071] S430: Update the parameters of the image recognition model in the direction of improving the first loss function.

[0072] In other embodiments, such as Figure 5 As shown, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model, specifically including the following steps:

[0073] S510: When the current iteration number is greater than the first preset iteration number and less than the second preset iteration number, the recognition result is obtained based on the enhanced image sample;

[0074] S520: Obtain a first loss function based on the recognition result and the enhanced image sample; obtain a second loss function based on the enhanced image sample and the image sample.

[0075] S530: Update the parameters of the generator of the generative adversarial network in the direction of increasing the first loss function and decreasing the second loss function.

[0076] In some other embodiments, such as Figure 6 As shown, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model, specifically including the following steps:

[0077] S610: If the current iteration number is greater than the second preset iteration number, the enhanced image sample is input into the image recognition model to obtain the recognition result;

[0078] S620: Obtain a first loss function based on the recognition result and the enhanced image sample;

[0079] S630: Update the parameters of the image recognition model in the direction of reducing the first loss function.

[0080] Generally speaking, the complete iterative update process is as Figure 7 shown. According to the number of iterations, the training process can be divided into three stages, and the two nodes corresponding to the three stages are the first preset iteration number a and the second preset iteration number b respectively.

[0081] In the first stage, when the current iteration number E is less than the first preset iteration number a, initialize the image recognition model M. The input image to be processed directly passes through the image recognition model to obtain a recognition result, calculate the first loss function loss_m, and update the parameters of the image recognition model;

[0082] In the second stage, when a ≤ E < b, freeze the parameters of M. The parameters of M will not be updated in this stage. The input image to be processed passes through the generator G to obtain an enhanced image, and then the enhanced image passes through M to obtain a recognition result. In this stage, to enhance the generalization of M, it is required that the optimizer尽可能 reduces the second loss function loss_p while increasing loss_m, and update the parameters of G according to this goal;

[0083] In the third stage, when the current iteration number E ≥ b, freeze the parameters of G. The parameters of G will not be updated in this stage. The input image to be processed passes through G to obtain an enhanced image, and then the enhanced image passes through M to obtain a recognition result. In this stage, in order to enhance the diversity of the images generated by G to meet the requirement of improving the generalization of M, the optimizer updates the parameters of M in the direction of reducing loss_m;

[0084] Repeat the second stage and the third stage until the generalization performance of M reaches the preset requirement.

[0085] In the above specific implementation manner, the image processing method based on the generative adversarial network provided by the present invention can obtain an enhanced image by acquiring an image to be processed and inputting the image to be processed into a pre-trained image recognition model; wherein, the image recognition model is trained based on a pre-constructed generative adversarial network using image samples. During the training process of the generative adversarial network, different optimization strategies are used to update the parameters of the generator of the generative adversarial network and / or the parameters of the image recognition model according to the current iteration number.

[0086] In this way, when training the image recognition model, the generator is added to the training process. The training of the image recognition model includes two stages. When the parameters of the image recognition model are updated with backpropagation of gradients, the gradient of the generator remains closed. When the gradient of the image recognition model is closed, the parameters of the generator are updated with backpropagation of gradients. In this way, the generator changes at different iterations, so that the enhanced image output by the generator also changes accordingly, making the enhanced image generated in each iteration different. When using this image recognition model for image recognition, it can better meet the image enhancement requirements of deep learning training and has good generalization, thus solving the problem of poor generalization of image enhancement.

[0087] In addition to the methods described above, this invention also provides an image processing apparatus based on generative adversarial networks, such as... Figure 8 As shown, the device includes:

[0088] The image acquisition unit 810 is used to acquire the image to be processed.

[0089] Image processing unit 820 is used to input the image to be processed into a pre-trained image recognition model to obtain an enhanced image;

[0090] The image recognition model is trained using image samples based on a pre-built generative adversarial network. During the training process of the generative adversarial network, the generator parameters of the generative adversarial network and / or the parameters of the image recognition model are updated using different optimization strategies according to the current iteration number.

[0091] In some embodiments, the image recognition model is obtained by training image samples based on a pre-built generative adversarial network, specifically including:

[0092] Obtain image samples;

[0093] The image samples are input into a pre-constructed generative adversarial network to obtain enhanced image samples;

[0094] The image recognition model is trained based on the enhanced image samples.

[0095] In some embodiments, the image recognition model is trained based on the enhanced image samples to obtain the model, and then the model further includes:

[0096] The training process is divided into multiple stages based on the current iteration number;

[0097] Different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model.

[0098] In some embodiments, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model, specifically including:

[0099] If the current iteration number is less than the first preset iteration number, the enhanced image sample is input into the image recognition model to obtain the recognition result;

[0100] A first loss function is obtained based on the recognition result and the enhanced image sample;

[0101] The parameters of the image recognition model are updated in the direction of improving the first loss function.

[0102] In some embodiments, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model, specifically including:

[0103] If the current iteration number is greater than the first preset iteration number and less than the second preset iteration number, the recognition result is obtained based on the enhanced image sample;

[0104] A first loss function is obtained based on the recognition result and the enhanced image sample, and a second loss function is obtained based on the enhanced image sample and the image sample;

[0105] The parameters of the generator of the generative adversarial network are updated in the direction of increasing the first loss function and decreasing the second loss function.

[0106] In some embodiments, different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and / or the parameters of the image recognition model, specifically including:

[0107] If the current iteration number is greater than the second preset iteration number, the enhanced image sample is input into the image recognition model to obtain the recognition result;

[0108] A first loss function is obtained based on the recognition result and the enhanced image sample;

[0109] The parameters of the image recognition model are updated in the direction of reducing the first loss function.

[0110] In some embodiments, the generator of the pre-built generative adversarial network includes:

[0111] An encoder, comprising convolutional layers and pooling layers, wherein the convolutional layers constituting the encoder are used to encode an image into a high-dimensional vector;

[0112] The decoder includes convolutional layers, which perform deconvolution operations to output the high-dimensional vector output by the encoder as an image.

[0113] In the above specific embodiments, the image processing apparatus based on generative adversarial networks provided by the present invention can obtain an enhanced image by acquiring an image to be processed and inputting the image to be processed into a pre-trained image recognition model; wherein, the image recognition model is obtained by training the pre-constructed generative adversarial network using image samples, and during the training process of the generative adversarial network, the generator parameters of the generative adversarial network and / or the parameters of the image recognition model are updated using different optimization strategies according to the current iteration number.

[0114] In this way, when training the image recognition model, the generator is added to the training process. The training of the image recognition model includes two stages. When the parameters of the image recognition model are updated with backpropagation of gradients, the gradient of the generator remains closed. When the gradient of the image recognition model is closed, the parameters of the generator are updated with backpropagation of gradients. In this way, the generator changes at different iterations, so that the enhanced image output by the generator also changes accordingly, making the enhanced image generated in each iteration different. When using this image recognition model for image recognition, it can better meet the image enhancement requirements of deep learning training and has good generalization, thus solving the problem of poor generalization of image enhancement.

[0115] Figure 9 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 9 As shown, the electronic device may include a processor 910, a communications interface 920, a memory 930, and a communication bus 940, wherein the processor 910, the communications interface 920, and the memory 930 communicate with each other via the communication bus 940. The processor 910 can call logical instructions in the memory 930 to execute the above-described method.

[0116] Furthermore, the logical instructions in the aforementioned memory 930 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0117] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, and when the program instructions are executed by a computer, the computer is able to perform the methods described above.

[0118] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the methods described above.

[0119] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0120] Those skilled in the art will recognize that, in one or more of the examples above, the functions described in this invention can be implemented using a combination of hardware and software. When applied as software, the corresponding functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of computer programs from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0121] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.

Claims

1. An image processing method based on generative adversarial networks, characterized in that, The method includes: Obtain the image to be processed; The image to be processed is input into a pre-trained image recognition model to obtain an enhanced image; The image recognition model is trained on image samples based on a pre-built generative adversarial network. During the training process of the generative adversarial network, the generator parameters of the generative adversarial network and the parameters of the image recognition model are updated using different optimization strategies according to the current iteration number. The image recognition model is trained using image samples based on a pre-constructed generative adversarial network, specifically including: Obtain image samples; The image samples are input into a pre-constructed generative adversarial network to obtain enhanced image samples; The image recognition model is trained based on the enhanced image samples to obtain the image recognition model; The image recognition model is trained based on the enhanced image samples to obtain the model, and then the process further includes: The training process is divided into multiple stages based on the current iteration number; Different optimization strategies are used at each stage to update the generator parameters of the generative adversarial network and the parameters of the image recognition model; At each stage, different optimization strategies are used to update the generator parameters of the generative adversarial network and the parameters of the image recognition model, specifically including: If the current iteration number is less than the first preset iteration number, the enhanced image sample is input into the image recognition model to obtain the recognition result; A first loss function is obtained based on the recognition result and the enhanced image sample; The parameters of the image recognition model are updated in the direction of improving the first loss function.

2. The image processing method based on generative adversarial networks according to claim 1, characterized in that, At each stage, different optimization strategies are used to update the generator parameters of the generative adversarial network and the parameters of the image recognition model, specifically including: If the current iteration number is greater than the first preset iteration number and less than the second preset iteration number, the recognition result is obtained based on the enhanced image sample; A first loss function is obtained based on the recognition result and the enhanced image sample, and a second loss function is obtained based on the enhanced image sample and the image sample; The parameters of the generator of the generative adversarial network are updated in the direction of increasing the first loss function and decreasing the second loss function.

3. The image processing method based on generative adversarial networks according to claim 1, characterized in that, At each stage, different optimization strategies are used to update the generator parameters of the generative adversarial network and the parameters of the image recognition model, specifically including: If the current iteration number is greater than the second preset iteration number, the enhanced image sample is input into the image recognition model to obtain the recognition result; A first loss function is obtained based on the recognition result and the enhanced image sample; The parameters of the image recognition model are updated in the direction of reducing the first loss function.

4. The image processing method based on generative adversarial networks according to claim 1, characterized in that, The generators for pre-built generative adversarial networks include: An encoder, comprising convolutional layers and pooling layers, wherein the convolutional layers constituting the encoder are used to encode an image into a high-dimensional vector; The decoder includes convolutional layers, which perform deconvolution operations to output the high-dimensional vector output by the encoder as an image.

5. An image processing apparatus based on a generative adversarial network, used to implement the method as described in any one of claims 1-4, characterized in that, The device includes: An image acquisition unit is used to acquire the image to be processed. An image processing unit is used to input the image to be processed into a pre-trained image recognition model to obtain an enhanced image; The image recognition model is trained using image samples based on a pre-built generative adversarial network. During the training process of the generative adversarial network, the generator parameters of the generative adversarial network and the parameters of the image recognition model are updated using different optimization strategies according to the current iteration number.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method as described in any one of claims 1 to 4.

7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method, apparatus and equipment for establishing voice enhancement network and computer storage medium

    CN109147810A

  • Image enhancement method and device, terminal equipment and storage medium

    CN114897728A