Underwater image enhancement method based on diffusion model and adversarial learning
Through methods based on diffusion models and adversarial learning, combined with multi-scale dynamic window attention modules and PatchGAN discriminators, the problems of blur and distortion in underwater image processing are solved, significantly improving the clarity and contrast of images, and are suitable for underwater applications Image enhancement of the environment.
Patent Information
- Application Number
- CN202410738392.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-07
AI Technical Summary
Existing underwater image processing technology is difficult to effectively remove blur and distortion in underwater images, especially in underwater environments that deal with large-scale brightness and color changes. Traditional methods lack an in-depth understanding of the physical process of underwater imaging, and are based on Data-driven deep learning methods such as GAN have limitations in processing global contextual information.
Adopting a method based on diffusion model and adversarial learning, through the multi-scale dynamic window attention module and PatchGAN discriminator, combined with the generator of U-Net structure for adversarial training, to capture cross-scale similarity and non-homogeneous features, the generator and Mutual optimization between discriminators improves the image enhancement effect.
It significantly improves the clarity and contrast of underwater images, and can effectively remove blur and distortion while maintaining image details and textures. It is suitable for underwater photography, underwater robot vision systems, underwater environment monitoring and other fields.
Smart Images

Figure CN118736178A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of underwater image processing, and in particular to an underwater image enhancement method based on a diffusion model and adversarial learning. Background Art
[0002] Due to the special properties of the underwater environment, underwater images are usually accompanied by serious quality degradation and distortion. In the water medium, light is selectively absorbed, resulting in various degrees of color distortion. In addition, the scattering phenomenon will change the propagation direction of light, further resulting in a decrease in image contrast. This degraded image has a huge negative impact on many practical applications such as underwater biological recognition, topographic analysis, and underwater resource exploration. Therefore, in order to meet the needs of practical applications, improving the degradation of underwater images and restoring their potential high-quality state has become an urgent problem to be solved, which has also spawned in-depth research on underwater image processing technology.
[0003] In recent years, with the increasing popularity of underwater exploration, researchers have devoted themselves to the study of underwater image enhancement. According to the different methods adopted, underwater image enhancement can be divided into traditional methods and data-driven methods.
[0004] Traditional methods include non-model methods and model-based methods. Non-model methods do not directly consider the physical process of underwater imaging, but are mainly implemented by modifying pixels. For example, histogram stretching is used to improve the contrast of the image, and filters are used to reduce noise. Non-model methods are usually more flexible and intuitive, but may lack a deep understanding of the physical process of underwater imaging. Model-based methods focus on establishing underwater imaging models and obtaining clear images through inverse operations of the model. For example, the scattering model needs to consider the scattering and absorption process of underwater light, and improve image quality by constructing corresponding physical models. These models usually take into account multiple factors such as water quality, light propagation, and camera parameters, making the image enhancement process more scientific. Although model-based methods are more rigorous in logic and more interpretable, they usually require more prior knowledge and may involve complex calculations.
[0005] Data-driven deep learning methods, especially deep learning models such as generative adversarial networks (GANs), have attracted much attention due to their outstanding performance in feature learning. These models automatically learn effective strategies for image enhancement by training large amounts of data without explicitly building physical models. However, traditional GAN networks are mostly built based on convolutional neural networks (CNNs). Although CNNs have a strong perception of local features due to their inherent local correlation bias, they are unable to cope with global contextual information. Underwater images often have a wide range of brightness and color changes, and this uneven degradation is difficult for traditional CNNs to overcome. Summary of the invention
[0006] In view of the shortcomings of the prior art, the present invention provides an underwater image enhancement method based on diffusion model and adversarial learning. Starting from the characteristics of underwater images, the present invention incorporates the capture mechanism of cross-scale similarity and anisotropy into the deep learning method, which helps to improve the effect and applicability of underwater image enhancement.
[0007] The technical means adopted by the present invention are as follows:
[0008] An underwater image enhancement method based on diffusion model and adversarial learning comprises the following steps:
[0009] S1. Acquire paired images as training data, wherein the paired images include a degraded underwater image and a corresponding enhanced reference image; acquire a pure noise image based on the reference image corresponding to the degraded underwater image;
[0010] S2. According to the training data, adversarial training is performed on a generator based on a diffusion model, wherein the generator is used to enhance a spliced degraded image, wherein the spliced degraded image is obtained by connecting a degraded underwater image and a pure noise image at the channel level; the generator adopts a diffusion model based on a U-Net structure, and replaces the original attention module in the U-Net structure with a multi-scale dynamic window attention module, wherein the multi-scale dynamic window attention module is used to extract spatial features of different scales from input features, and obtain proxy feature tokens rich in multi-scale information after extracting spatial features of different scales; the multi-scale dynamic window attention module includes a multi-scale convolution block and a rectangular window self-attention block, wherein the rectangular window self-attention block is used to capture features of different directions in the input image by simulating the dependency between horizontal rectangles and vertical rectangles;
[0011] S3. Obtain the underwater image to be enhanced and input it into the trained generator, and obtain the generator output as the enhanced image.
[0012] Further, obtaining a pure noise image based on a reference image corresponding to the degraded underwater image includes:
[0013] The forward process of the diffusion model is used to perform forward diffusion on the enhanced image corresponding to the degraded underwater image in the training data to obtain a pure noise image.
[0014] Furthermore, adversarial training is performed on the generator based on the diffusion model according to the training data, including:
[0015] S201, obtaining an enhanced image output by the generator;
[0016] S202, inputting the enhanced image and the reference image into a PatchGAN-based discriminator, and performing feature extraction through a feature extraction network in the discriminator;
[0017] S203, the discriminator compares the features of the enhanced image with the reference image, so that the discriminator can accurately distinguish the enhanced image from the reference image and provide effective feedback to the generator.
[0018] Furthermore, adversarial training is performed on the generator based on the diffusion model according to the training data, and further includes:
[0019] The generator and discriminator optimize each other: when the discriminator can easily distinguish the enhanced image from the reference image, it provides feedback to the generator, instructing the generator to improve the generation effect, and the generator adjusts its parameters and structure according to the feedback from the discriminator.
[0020] Furthermore, adversarial training is performed on the generator based on the diffusion model according to the training data, and further includes:
[0021] The training loss is set to include: the difference loss between the augmented image and the reference image, the optimization loss of the generator, and the adversarial loss between the generator and the discriminator.
[0022] Furthermore, the working process of the multi-scale dynamic window attention module includes:
[0023] After the convolution operation of the encoding part of the U-Net is performed on the spliced degraded image, the feature map X is obtained, and then X is input to the multi-scale convolution block layer and the Linear layer respectively. The multi-scale convolution block layer is used to generate the proxy feature token, and the Linear layer is used to generate the key key token, value token and query token; the MCB layer inputs the feature X∈R C×H×W Divided into four parts, each with the same number of channels Feature map after segmentation For each divided feature map, convolution kernels of different sizes are used to extract their respective spatial information, thereby obtaining a series of feature maps. The series of feature maps are concatenated in the channel dimension to obtain a proxy feature token;
[0024] The proxy feature tokens and key tokens are processed as follows using the rectangular window self-attention mechanism:
[0025] Divide the feature map X into a series of non-overlapping rectangular windows X j ∈R C×sh×sw , the height of each window is sh, the width is sw, where j represents the number of the jth window, and there are a total of windows, one side of each window is consistent with the width or length of the feature map;
[0026] The feature map X is split into two groups in the channel dimension, and the attention mechanism with different direction windows is applied to each group, including calculating the dot product of the proxy feature token and the key token in each window, so as to obtain a score matrix of size sh×sw. Then the Softmax function is applied to the matrix to convert the score into a normalized weight. Next, these weights are used to perform a weighted sum operation with the value token. This step generates an attention-weighted feature representation for each group of feature maps. After completing the attention calculation of the two groups of feature maps, the two groups of attention-weighted feature representations are spliced in the channel dimension to restore the number of channels of the original feature map. Finally, these interactively processed information is passed to the query token.
[0027] Compared with the prior art, the present invention has the following advantages:
[0028] 1. The present invention not only gives full play to the advantages of diffusion model in feature extraction and image enhancement, but also draws on the unique ability of adversarial learning in image enhancement. Through the organic combination of the two, the present invention can effectively remove the blur and distortion of underwater images while maintaining image details and texture, and significantly improve the clarity and contrast of the image.
[0029] 2. The present invention also proposes a multi-scale dynamic window attention mechanism, which can keenly capture the cross-scale similarity features commonly found in underwater images, while also finely depicting the inhomogeneous texture details.
[0030] Based on the above reasons, the present invention can be widely promoted in the fields of underwater photography, underwater robot vision system, underwater environment monitoring, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0032] Figure 1 The present invention is a flowchart of an underwater image enhancement method based on a diffusion model and adversarial learning in an embodiment of the present invention.
[0033] Figure 2 Schematic diagram of the generator training process in an embodiment of the present invention.
[0034] Figure 3 This is the model architecture in the embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0036] The present invention provides an underwater image enhancement method based on a diffusion model and adversarial learning, using a public underwater UIEB dataset, which includes degraded underwater images and enhanced reference images corresponding to the degradation. During the network training process, the reference image y0 is firstly denoised to gradually obtain a pure noise image close to a Gaussian distribution. Next, the input degraded underwater image and the noise image are input into the network together for reverse denoising. During the denoising process, an attention module is designed, and the denoising is iterated using a diffusion model to finally obtain an enhanced underwater image. The enhanced underwater image The reference image y0 is input into the discriminator, which judges its authenticity and returns the result to the generator based on the diffusion mode model, so that the two can optimize each other. Figure 1 As shown, the specific steps include:
[0037] S1. Obtain paired images as training data, wherein the paired images include a degraded underwater image and a corresponding enhanced reference image. Use the diffusion model forward process to forward diffuse the enhanced image y0 corresponding to the degraded underwater image x in the UIEB dataset to obtain a pure noise image y T .
[0038] S2. According to the training data, adversarial training is performed on a generator based on a diffusion model, wherein the generator is used to enhance a spliced degraded image, wherein the spliced degraded image is obtained by connecting a degraded underwater image and a pure noise image at the channel level; the generator adopts a diffusion model based on a U-Net structure, and replaces the original attention module in the U-Net structure with a multi-scale dynamic window attention module, wherein the multi-scale dynamic window attention module is used to extract spatial features of different scales from input features, and obtain proxy feature tokens rich in multi-scale information after extracting spatial features of different scales; the multi-scale dynamic window attention module includes a multi-scale convolution block and a rectangular window self-attention block, wherein the rectangular window self-attention block is used to capture features of different directions in the input image by simulating the dependency between horizontal rectangles and vertical rectangles.
[0039] In the present invention, one of the key components of the generator is the attention module. This application abandons the original attention module of U-Net and designs a multi-scale dynamic window attention mechanism. Then the degraded underwater image x and the pure noise image y are T The generator uses a similar overall structure to U-Net, but improves on the attention mechanism. A multi-scale dynamic window attention mechanism is proposed, which can capture the cross-scale similarity and heterogeneity in underwater images. In the generator, the degraded underwater image x and the pure noise image y are first T After inputting into the convolutional layer in the original U-Net for downsampling, the obtained feature map is then input into the improved attention mechanism to obtain the noise feature map, such as Figure 2 As shown in Figure 2, the training process specifically includes:
[0040] Step 2.1: Design an improved attention module and replace the original attention module in U-Net with a multi-scale dynamic window attention mechanism. H×W×3 With pure noise image Y T ∈R H×W×3 The feature map X is obtained by inputting it into the convolution module in the generator through channel-level connections, and then the feature map X is input into the multi-scale dynamic window attention.
[0041] Step 2.2: In the multi-scale dynamic window attention, the obtained feature map X∈R H×W×C Different operations are performed, among which the operation steps of the multi-scale convolution block are: the input feature X∈R C×H×W Divided into four parts, each with the same number of channels Feature map after segmentation For each divided feature map, convolution kernels of different sizes are used to extract their respective spatial information, thereby obtaining a series of feature maps. To fully capture spatial information of different scales. Then, by concatenating these feature maps in the channel dimension, a proxy feature token rich in multi-scale information can be obtained:
[0042] A=Cat([X'1,X'2,X'3,X'4])
[0043] where A∈R C×H×W On the other hand, for the feature map X∈R H×W×C Perform linear operations to obtain the key, value, and query, providing necessary input for the subsequent attention mechanism.
[0044] Step 2.3: After getting A∈R C×H×W , Key∈R C×H×W ,Value∈R C×H×W ,Query∈R C×H×W Finally, a rectangular window self-attention mechanism is introduced to process the proxy feature tokens and key tokens. This mechanism effectively captures features in different directions in the image by simulating the long-term dependencies between horizontal rectangles and vertical rectangles. Specifically, the feature map X is first divided into a series of non-overlapping rectangular windows X j ∈R C×sh×sw , the height of each window is sh, the width is sw, where j represents the number of the jth window, and there are a total of windows, one side of each window is consistent with the width or length of the feature map, that is, X j ∈R C×H×sw or X j ∈R C×sh×W , to provide a larger interaction space and stronger feature interaction capabilities. Then, we split the feature map into two groups in the channel dimension And apply the attention mechanism with different direction windows for each group. Specifically, in each window, the dot product of the proxy feature token and the key token is calculated to obtain a score matrix of size sh×sw. Then the Softmax function is applied to the matrix to convert the scores into normalized weights. Next, these weights are used to perform a weighted sum operation with the value token. This step generates an attention-weighted feature representation for each set of feature maps. After completing the attention calculation of the two sets of feature maps, the two sets of feature representations with attention weights are spliced in the channel dimension to restore the number of channels of the original feature map X'∈R C×sh×sw This approach allows us to establish intra-window dependencies over a larger range of specific dimensions. Ultimately, this interactively processed information is passed to the query token to further enrich its information content:
[0045]
[0046] in represents a constant factor to prevent weight concentration and attention collapse.
[0047] Through a series of nested operations, including dimension transformation, linear transformation, attention calculation and shape rearrangement, we get the final feature representation Subsequently, the feature representation is subjected to convolution, group normalization, and SiLU activation to enhance the expressiveness of the feature. At the same time, we randomly apply the Dropout technique in the channel dimension to prevent overfitting. Next, an upsampling operation is performed to restore the spatial resolution of the image. At each upsampling layer, a residual connection and a multi-scale dynamic window attention module are used to further enhance the representation of the feature. Finally, after a convolutional layer output, a noise feature map is obtained.
[0048] In the generator, the above diffusion model based on multi-scale dynamic window attention is used to train the pure noise image y T An iterative denoising process was performed for a total of 2000 iterations to obtain a significantly enhanced image. The enhanced image was then fed into the discriminator for further processing and analysis.
[0049] After obtaining the enhanced image, the enhanced image and the reference image are input into the discriminator based on PatchGAN together, and feature extraction is performed through the feature extraction network in the discriminator. During the feature extraction process, the discriminator gradually extracts high-level semantic information in the image through multi-layer convolution and pooling operations. Next, the discriminator compares the features of the enhanced image with those of the reference image, aiming to enable the discriminator to accurately distinguish the enhanced image from the reference image and provide effective feedback to the generator. At the same time, the generator and the discriminator perform a mutual optimization process. When the discriminator can easily distinguish the enhanced image from the reference image, it will provide feedback to the generator, indicating that the generator needs to improve its generation effect. The generator adjusts its parameters and structure based on the feedback from the discriminator to generate an enhanced image that is closer to the reference image. As the training progresses, the enhancement effect of the generator gradually improves, and the discriminant's discriminative ability continues to increase. Finally, a high-quality enhanced image is obtained. In addition, the L2 loss function is introduced in the optimization process to further reduce the difference between the enhanced image and the reference image, providing clearer guidance for the training of the generator and the discriminator. The network architecture of the present invention is as follows Figure 3 shown.
[0050] S3. Obtain the underwater image to be enhanced and input it into the trained generator, and obtain the generator output as the enhanced image.
[0051] The scheme and effect of the present invention are further described below through specific application examples.
[0052] This embodiment provides an underwater image processing method based on a diffusion model and adversarial learning. The method combines the advantages of the diffusion model and adversarial learning, and generates an enhanced image consistent with the characteristics of a degraded underwater image.
[0053] During the training process, paired images (degraded underwater images and enhanced reference images corresponding to the degradation) are used as training data. In the generator based on the diffusion model, the reference image is first subjected to a forward diffusion operation. The role of the forward chain is to perturb the data. It gradually adds Gaussian noise to the data according to a pre-designed noise schedule until the distribution of the data tends to a standard Gaussian distribution. It is worth noting that the noise addition process is a process driven by mathematical laws and does not require additional learning. However, the denoising process relies on the training of the neural network. By providing pure noise as input, the neural network gradually learns and restores the distribution of the original data. In the generator design of the present invention, we focus on learning a specific inverse process p θ (y (0:T) |x), while maintaining the forward diffusion process q(y (1:t) |y0). In order to ensure that the generated enhanced image is consistent with the degraded image in terms of high-level semantic information, it is necessary to use the degraded underwater image x to guide the inverse process of the diffusion model. Specifically, given the input (y T ,x,t), where y T is a noisy image obtained by gradually adding Gaussian noise to the clean image y0, x is the degraded underwater image, and t is the time step. At time t, the relationship between the noisy state and the previous time t-1 can be described by a specific mathematical expression:
[0054]
[0055] in is the hyperparameter of the noise table, t∈{0,1,.....T}, I is an identity matrix with the same dimension as the initial state y0. Given y0, we can deduce y1,y2...y T The joint distribution of can be expressed as:
[0056]
[0057] Furthermore, by using the properties of the Markov chain, we can derive the noisy state at any time t after the input y0.
[0058]
[0059] Finally, the noisy state y TWill approach a Gaussian distribution. For each image in the training set, we can generate a series of noisy images with different noise levels. These images and the degraded underwater images together constitute the actual training samples. In the reverse process, the existing noise state is used to estimate the noise distribution through learning, and the state of the previous moment is further obtained. This process gradually reconstructs the real data from the Gaussian distribution. Since the goal of underwater image enhancement is to generate the expected enhanced image, we introduce the degraded underwater image x as a condition into the noise estimation network to estimate the conditional noise distribution. Specifically, we concatenate the degraded image x with the noise state as the input of the noise estimation network. Therefore, the joint probability distribution of the reverse diffusion process can be expressed as:
[0060]
[0061] The present invention uses a neural network model δ θ To learn the reverse process, predict the noise vector ∈, the enhanced image It is expressed as:
[0062]
[0063] Where γ represents the current noise level. Each iteration of the inverse process can be expressed as: (The image at step t-1 is obtained by subtracting a noise from the image at step t, but this noise is fitted by the network, and each sampling step will also add a pure noise sampled from a normal distribution.)
[0064]
[0065] where ∈ t ~N(0,I). That is, in each iteration of the inverse process, we use the noise fitted by the network and the pure noise sampled from the normal distribution to update the image state. This process is repeated until the final enhanced image is generated.
[0066] In order to ensure that the model gradually reduces the difference between the enhanced image and the reference image during the training phase, and thus optimizes the image enhancement effect, the present invention uses L2 loss as the key optimization indicator. The specific formula is as follows:
[0067]
[0068] Where ∈ is a noise vector. The purpose of this loss function is to minimize the error in the image enhancement process. By minimizing such errors, the model can more accurately capture and learn the structure and characteristics of the reference image, and thus more effectively preserve the image's detailed features and structure when enhancing underwater images. The core goal of the present invention is to enhance the degraded underwater image x. According to the variational inference theory, the optimization goal of the generator is ultimately to minimize q(y t-1 |y t ,y0) and p θ (y t-1 |y t ,x) The KL divergence of the two distributions, that is:
[0069]
[0070] In addition, in order to enhance the robustness of the model, the present invention introduces a discriminator D based on PatchGAN. Through adversarial training between the discriminator and the generator based on the diffusion model, the generator can generate samples that are sufficient to deceive the discriminator. During the training process of GAN, the discriminator is committed to accurately distinguishing whether the input samples are real samples or generated samples, while the generator strives to generate samples that are sufficient to confuse the discriminator. This adversarial training mechanism greatly improves the generation ability of the generator and also enhances the robustness of the model. The specific expression of the adversarial loss function is:
[0071]
[0072] Taking all the above factors into consideration, the overall optimization goal of the final model can be expressed as:
[0073] L=L m +L θ (y0|x)+L adv (G,D) (10)
[0074] In the generator based on the diffusion model, U-Net is mainly used as the basic structure. On this basis, the present invention proposes a multi-scale dynamic window attention mechanism. Underwater images often show significant features of cross-scale similarity and inhomogeneity, which are crucial for image enhancement tasks. Cross-scale similarity means that certain features and textures in underwater images will show similar characteristics at different scales. In order to capture these similarities more accurately, the feature map is scaled and local features are extracted with the help of multi-scale convolution blocks to achieve fine capture of information at different scales. On the other hand, underwater images often show features of different directions and structures due to the influence of factors such as light diffusion and water flow, which requires us to pay special attention to inhomogeneity when processing. In order to effectively deal with this problem, a rectangular window self-attention mechanism is introduced. The core idea of this mechanism is to divide the input features into two independent parts, and apply the window self-attention mechanism in the horizontal and vertical directions respectively, so as to simulate the long-term dependencies in different directions. In the specific implementation process, the feature map X is first input into the multi-scale convolution block layer (MCB) and the Linear layer respectively. The MCB layer is designed to generate proxy feature tokens, while the Linear layer is used to generate key Q (query), K (key), and V (value) components. The design of the MCB layer fully considers the multi-scale information of the input data. Specifically, it converts the input feature X∈R C×H×W Divided into four parts, each with the same number of channels Feature map after segmentation For each divided feature map, convolution kernels of different sizes (such as 3×3, 5×5, 7×7, 9×9) are used to extract their respective spatial information, thereby obtaining a series of feature maps. To fully capture spatial information of different scales. Then, by concatenating these feature maps in the channel dimension, a proxy feature token rich in multi-scale information can be obtained:
[0075] A=Cat([X'1,X'2,X'3,X'4]) (11)
[0076] where A∈R C×H×W . The token not only maintains the local details of the original feature map, but also integrates the contextual information at different scales, thus providing a rich feature representation for subsequent image processing. Next, we use the rectangular window self-attention mechanism to process the proxy feature token and key token. This mechanism effectively captures features in different directions in the image by simulating the long-term dependencies between horizontal and vertical rectangles. Specifically, the feature map X is divided into a series of non-overlapping rectangular windows X j ∈R C×sh×sw , the height of each window is sh, the width is sw, where j represents the number of the jth window, and there are a total of windows. In the design, we intentionally ensure that one side of each window is consistent with the width or length of the feature map. Compared with the traditional rectangular window, this design provides more interaction space and enhances the interaction ability between features. Subsequently, we split the feature map into two groups in the channel dimension and apply an attention mechanism with different direction windows to each group. This approach allows us to establish intra-window dependencies over a larger range of a specific dimension. After the window attention process, the two groups of features are reconnected in the channel dimension to achieve aggregation of key information. Finally, this interactively processed information is passed to the query token to further enrich its information content.
[0077] This interaction is achieved through the following formula:
[0078]
[0079] Through the synergy of multi-scale convolutional blocks and rectangular window self-attention mechanism, not only can the unique characteristics of underwater images be accurately captured and processed, but also indirect interaction is achieved by introducing proxy feature tokens, which not only reduces the computational burden but also improves the efficiency of information integration and processing performance. This optimization of information aggregation helps improve the perception of complex structures and changes in underwater scenes.
[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An underwater image enhancement method based on diffusion model and adversarial learning, characterized in that: The following steps are involved: S1. Acquire paired images as training data, wherein the paired images include a degraded underwater image and a corresponding enhanced reference image; acquire a pure noise image based on the reference image corresponding to the degraded underwater image; S2. According to the training data, adversarial training is performed on a generator based on a diffusion model, wherein the generator is used to enhance a spliced degraded image, wherein the spliced degraded image is obtained by connecting a degraded underwater image and a pure noise image at the channel level; the generator adopts a diffusion model based on a U-Net structure, and replaces the original attention module in the U-Net structure with a multi-scale dynamic window attention module, wherein the multi-scale dynamic window attention module is used to extract spatial features of different scales from input features, and obtain proxy feature tokens rich in multi-scale information after extracting spatial features of different scales; The multi-scale dynamic window attention module includes a multi-scale convolution block and a rectangular window self-attention block, wherein the rectangular window self-attention block is used to capture features in different directions in the input image by simulating the dependency between horizontal rectangles and vertical rectangles; S3. Obtain the underwater image to be enhanced and input it into the trained generator, and obtain the generator output as the enhanced image.
2. The underwater image enhancement method based on diffusion model and adversarial learning according to claim 1, characterized in that: A pure noise image is obtained based on a reference image corresponding to the degraded underwater image, including: The forward process of the diffusion model is used to perform forward diffusion on the enhanced image corresponding to the degraded underwater image in the training data to obtain a pure noise image.
3. The underwater image enhancement method based on diffusion model and adversarial learning according to claim 1, characterized in that: Performing adversarial training on a generator based on a diffusion model according to the training data, including: S201, obtaining an enhanced image output by the generator; S202, inputting the enhanced image and the reference image into a PatchGAN-based discriminator, and performing feature extraction through a feature extraction network in the discriminator; S203, the discriminator compares the features of the enhanced image with the reference image, so that the discriminator can accurately distinguish the enhanced image from the reference image and provide effective feedback to the generator.
4. The underwater image enhancement method based on diffusion model and adversarial learning according to claim 3 is characterized in that: Performing adversarial training on a generator based on a diffusion model according to the training data also includes: The generator and discriminator optimize each other: when the discriminator can easily distinguish the enhanced image from the reference image, it provides feedback to the generator, instructing the generator to improve the generation effect, and the generator adjusts its parameters and structure according to the feedback from the discriminator.
5. The underwater image enhancement method based on diffusion model and adversarial learning according to claim 3, characterized in that: Performing adversarial training on a generator based on a diffusion model according to the training data also includes: The training loss is set to include: the difference loss between the augmented image and the reference image, the optimization loss of the generator, and the adversarial loss between the generator and the discriminator.
6. The underwater image enhancement method based on diffusion model and adversarial learning according to claim 1, characterized in that: The working process of the multi-scale dynamic window attention module includes: After the convolution operation of the encoding part of the U-Net is performed on the spliced degraded image, the feature map X is obtained, and then X is input to the multi-scale convolution block layer and the Linear layer respectively. The multi-scale convolution block layer is used to generate the proxy feature token, and the Linear layer is used to generate the key key token, value token and query token; the MCB layer inputs the feature X∈R C ×H×W Divided into four parts, each with the same number of channels Feature map after segmentation For each divided feature map, convolution kernels of different sizes are used to extract their respective spatial information, thereby obtaining a series of feature maps. The series of feature maps are concatenated in the channel dimension to obtain a proxy feature token; The proxy feature tokens and key tokens are processed as follows using the rectangular window self-attention mechanism: Divide the feature map X into a series of non-overlapping rectangular windows X j ∈R C×sh×sw , the height of each window is sh, the width is sw, where j represents the number of the jth window, and there are a total of windows, one side of each window is consistent with the width or length of the feature map; The feature map X is split into two groups in the channel dimension, and the attention mechanism with different direction windows is applied to each group, including calculating the dot product of the proxy feature token and the key token in each window, so as to obtain a score matrix of size sh×sw. Then the Softmax function is applied to the matrix to convert the score into a normalized weight. Next, these weights are used to perform a weighted sum operation with the value token. This step generates an attention-weighted feature representation for each group of feature maps. After completing the attention calculation of the two groups of feature maps, the two groups of attention-weighted feature representations are spliced in the channel dimension to restore the number of channels of the original feature map. Finally, these interactively processed information is passed to the query token.
Citation Information
Patent Citations
Underwater image enhancement method based on de-noising diffusion probability model
CN116883259A
Underwater image restoration method based on improved generative adversarial network model
CN117058037A
Underwater low-illumination image enhancement method based on conditional diffusion model
CN117911302A
Apparatus and method for style transfer between images in the underwater domain and images in the air haze domain based on a machine learning model
KR102578364B1
