Underwater image enhancement system and method based on multi-head transposition space attention
By introducing probability network, wavelet transform and multi-head transpose spatial attention mechanism into the underwater image enhancement system, combining feature refining submodules and adaptive instance normalization modules, the problem of poor robustness in complex environments in the existing technology is solved, and the higher quality and more robust underwater image enhancement effect is achieved.
Patent Information
- Application Number
- CN202510336137.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-03-21
AI Technical Summary
Existing underwater image enhancement algorithms are poorly robust in complex environments and are difficult to adapt to the lighting conditions, weather conditions and sensor noise in different underwater environments.
Probability network, wavelet transform and multi-head transposed spatial attention mechanism are introduced, combined with feature refining submodules and adaptive instance normalization modules to form an underwater image enhancement system based on multi-head transposed spatial attention.
It significantly improves image quality, enhances the generalization ability and robustness of the model, can better adapt to different underwater environments, and improves the effect and stability of image enhancement.
Smart Images

Figure CN119850463A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of underwater image enhancement based on computer vision, and in particular relates to an underwater image enhancement system and method based on multi-head transposed spatial attention. Background Art
[0002] In recent years, underwater image enhancement has been an important research direction of underwater deep learning. Due to the particularity of the underwater environment, underwater images suffer from degradation due to the harsh and complex lighting conditions in the water. Due to factors such as light scattering, absorption and refraction, underwater images will have problems such as low contrast, blur, color cast, and a lot of image noise. Therefore, underwater image enhancement technology is to improve image quality and adjust image parameters to improve image quality as much as possible, so as to better observe the underwater environment, and further lay the foundation for underwater target detection, underwater drones and other work.
[0003] In order to achieve underwater image enhancement, many studies are currently focusing on underwater image enhancement technology. It is mainly divided into traditional methods and deep learning-based methods. Traditional methods include histogram equalization, local contrast limited adaptive histogram equalization (CLAHE), ultra-high contrast map (UCM) and other methods. Deep learning includes methods based on convolutional neural network (CNN), generative adversarial network (GAN), autoencoder and other methods. These methods learn a large amount of underwater image data to adaptively restore the details and colors of the image, while removing noise and distortion. However, the various algorithms currently available for underwater image enhancement cannot adapt to different underwater environments, resulting in poor robustness of the model in complex environments, such as different lighting conditions, weather conditions, sensor noise, etc. How to improve generalization ability, reduce dependence on training data, and improve model interpretability is still an important direction for future research. Summary of the invention
[0004] To address the above problems, the present invention introduces a probabilistic network, wavelet transform, and multi-head transposed spatial attention, which can greatly improve the quality of images, achieve better results in underwater image enhancement, and have high robustness, improve the generalization ability of the model, and can adapt to different underwater environments.
[0005] The first aspect of the present invention proposes an underwater image enhancement system based on multi-head transposed spatial attention, including a feature extraction encoding module, a probabilistic adaptive instance normalization module and a decoding module; The feature extraction and encoding module includes a processing submodule, a feature extraction submodule and a feature perception submodule; the processing submodule extracts local features from the input image scanned by the convolution kernel and downsamples the feature map; the feature extraction submodule refines the features, enhances the valuable features and suppresses the features with less information, and obtains the refined feature map; the feature perception submodule uses the multi-head transposition self-attention mechanism to process the long-distance dependency and adjusts the spatial dimension of the feature map through the transposition operation to enhance the spatial perception ability, and at the same time increases the spatial attention calculation to assign weights to each spatial position to obtain the enhanced feature map; The probabilistic adaptive instance normalization module matches the image features with the desired enhancement effect by adaptively adjusting the mean and standard deviation of the input features, and adjusts the feature statistics of the image based on random samples through the learned distribution, aligning the input mean and standard deviation to match the corresponding statistics; The decoding module reconstructs the feature map through multiple convolutions and activation functions, restores spatial information and improves resolution, and then uses a multi-head transposed self-attention mechanism to focus the decoder on the key area, dynamically adjusts the spatial weight of the feature map to enhance the feature expression of the target area, and obtains the final enhanced image result.
[0006] Preferably, the feature extraction coding module is specifically: The input image is subjected to two sets of 3×3 two-dimensional convolutions and activation functions for local feature extraction to obtain the output feature map a; a is subjected to maximum pooling, feature refinement submodules and two sets of 3×3 two-dimensional convolutions and activation functions to perform feature map dimensionality reduction and feature refinement operations, enhance valuable features while suppressing features with less information, enhance the expressiveness of the model, and obtain the refined feature map b; b is subjected to two sets of 3×3 two-dimensional convolutions and activation functions for further local feature extraction to obtain feature map c; c is subjected to maximum pooling, two feature perception submodules and upsampling for feature map dimensionality reduction and feature weight allocation to achieve feature enhancement, focus on key areas and suppress redundant information, and obtain feature map d, d is added to c to obtain e, e is subjected to two sets of 3×3 two-dimensional convolutions and activation functions and upsampling for further feature extraction and addition to b to obtain f1, f1 is subjected to two sets of 3×3 two-dimensional convolutions and activation functions and upsampling and then added to a to obtain the output feature map.
[0007] Preferably, the feature extraction submodule is specifically: For the input feature map E, its size is B C H W, where B is the batch size, C is the number of channels, H and W are the spatial dimensions, split the input into two parts X1 and X2 along the channel dimension, perform a convolution operation on X1, and then reconcatenate the convolved X1 and the unprocessed X2 and rearrange them to size B (H W) C, that is, flattening the two-dimensional spatial information into one dimension; passing the flattened features into the linear layer and dividing them into two parts x_1 and x_2 along the last dimension; x_1 is processed by deep convolution, and the convolution result is rearranged back to size B (H W) C; Finally, x_1 and x_2 are multiplied to form a gating mechanism, which controls the information flow through the multiplication operation, and then undergoes a linear transformation through the linear layer, and then recovers to B C H The W size is restored to the image form, and the processed output is added to the original input for residual connection.
[0008] Preferably, the feature perception submodule includes two-dimensional convolution, wavelet convolution and multi-head transposed spatial self-attention unit; the input feature map is first subjected to 3*3 two-dimensional convolution, then to activation function, then to two consecutive wavelet convolutions, and finally to multi-head transposed spatial self-attention unit, and the obtained result is added to the input feature map and then output; The wavelet convolution includes a wavelet transform filter, and its input is divided into four parts after passing through the filter, and then after a depth convolution with a step size of 2, a two-dimensional convolution and a transposed convolution are performed, and the output is added to the feature map of the input after the two-dimensional convolution; The multi-head transposition spatial self-attention unit includes a multi-head transposition self-attention subunit and a spatial attention subunit; the input feature map F is obtained by multiplying the input feature map by the attention weight output by the multi-head transposition self-attention subunit. , and then input the spatial attention subunit to get the spatial attention weight, which is After dot multiplication, the output feature map is obtained.
[0009] Preferably, the multi-head transposed spatial self-attention subunit is specifically: First, for the input feature map F, its size is B C H W, where B is the batch size, C is the number of channels, H and W are the spatial dimensions; first perform a 1x1 two-dimensional convolution on the input to obtain a B C H The tensor W represents the query q, key k and value v in the attention mechanism; then the result is deep convolution, and the output size is B C H W tensor; then split the output value into three parts according to the channel dimension: query q, key k and value v, with sizes: q has a size of B C H The size of W, k is B C H The dimensions of W and v are B C H W; Rearrange the query tensor q from B C H W to B Head (C / head) (H W) shape, where head represents the number of attention heads, c / head represents the number of channels per head, and H W is the result of flattening the spatial dimensions; similarly, a similar rearrangement is performed on the key tensor k to obtain a size of B Head (C / head) (H W); perform the same rearrangement on the value tensor v to get a tensor of size B Head (C / head) (H W); then q and k are normalized in the last feature dimension and the dot product of query q and key k is calculated to obtain a tensor of shape B Head (C / head) (H W) tensor; and scale and softmax the tensor to obtain the attention weight of each position, ensuring that its value is in the range of [0, 1] and the sum is 1, and obtain the attention weight attn; By multiplying the attention weight attn with the tensor v, we get the final output, whose size is B Head (C / head) (H W); then rearrange the output tensor to restore it to its original spatial dimension B C H W, but now the number of channels becomes head*c / head; Last passed 1 1 two-dimensional convolution layer, adjust the number of channels to make the number of channels consistent with the input dimension, and obtain the multi-head transposed self-attention weight matrix , transpose the multi-head self-attention weight matrix Applied to the input feature map F, we can get the feature map of the image obtained by multi-head transposed self-attention, that is:
[0010] in, Represents the multi-head transposed self-attention weight matrix obtained by the above operation , which is used to calculate the attention weight between each element and other elements in the input feature map, capture the global dependency, and determine the degree of influence of each element on other elements, thereby achieving effective fusion of information. represents the input feature map, Represents the output feature map after multi-head transposed self-attention calculation.
[0011] Preferably, the spatial attention subunit is specifically: First, for the input feature map , whose size is B C H W, where B is the batch size, C is the number of channels, H and W are the spatial dimensions (height and width), perform global maximum pooling and global average pooling operations, and get two B 1 H The feature map of W; the results of global maximum pooling and global average pooling are spliced according to the channel to obtain a size of B 2 H The feature map of W; perform 7 on the concatenated feature map 7 two-dimensional convolution operation, resulting in a size of B 1 H The feature map of W; the spatial attention weight matrix can be obtained by passing the feature map through the Sigmoid activation function ,Right now:
[0012]
[0013] Among them, the spatial attention weight matrix , The global average pooling operation is used to reduce the dimension and aggregate the features of the feature map. The spatial information is aggregated by average pooling, and the global information of each feature map is retained to facilitate better calculation of the spatial attention matrix. The feature map generated by global average pooling is , this feature map retains the global information of each feature map; It is a maximum pooling operation, which is mainly used to extract local significant features, enhance the model's attention to key areas, and help the model pay more attention to the areas with the strongest response in the feature map, thereby improving the sensitivity to key features. The feature map generated by the global maximum pooling , the feature map extracts local salient features, Indicates 7 The convolution operation of 7, that is, the results of average pooling and maximum pooling are connected and then subjected to convolution operation for feature enhancement, which can not only retain the global context information, but also enhance the attention to local significant features, further integrate the global and local information, and generate spatial attention weights; The spatial attention weight matrix Applied to the input feature map On the above, we can get the feature map of the image calculated by spatial attention; Transpose the multi-head self-attention weight matrix and the spatial attention weight matrix Apply it to the input feature map F in sequence, and you can get the feature map of the image calculated by multi-head transposed self-attention and spatial attention, that is, the final refined feature map .
[0014] Preferably, the probability adaptive instance normalization module is specifically: For the input feature map, the size is B×C×H×W, where B, C, H, and W represent the batch size, number of channels, height, and width, respectively. First, the average pooling of each channel in terms of height and width is calculated, and the feature map is compressed into a single tensor to obtain a tensor of B×C×1×1. Then, a 1×1 convolution is used to obtain the mean and logarithmic standard deviation vectors B×2N×1×1, which are divided into the mean vector and the logarithmic standard deviation vector, where the mean vector size is B×N×1×1 and the logarithmic standard deviation vector size is B×N×1×1. The Gaussian distribution is constructed using the standard deviation vector obtained by transforming the mean vector and the logarithmic standard deviation. At the same time, each channel calculates the standard deviation of the spatial dimension in terms of height and width, compresses the feature map into a single tensor, and obtains a tensor of B×C×1×1, which represents the degree of change of the input feature in the spatial dimension; then, a 1×1 convolution is used to obtain the mean of the standard deviation and the logarithmic standard deviation vector B×2N×1×1, which is divided into a mean vector and a logarithmic standard deviation vector, where the size of the mean vector is B×N×1×1 and the size of the logarithmic standard deviation vector is B×N×1×1, and the Gaussian distribution is constructed with the standard deviation vector obtained by transforming the mean vector and the logarithmic standard deviation; When the distribution is constructed, random samples are drawn from the Gaussian distribution, and random samples are generated using reparameterized sampling. The size of the random samples of the mean and standard deviation is B×N×1×1; The random samples are then injected into the adaptive instance normalization unit AdaIN to transform the statistics of the received features by extracting random activation values from the learned distribution to align the mean and standard deviation of the received features based on random sampling.
[0015] Preferably, the adaptive instance normalization unit AdaIN is specifically: The mean and standard deviation of the latent variables are randomly sampled from the posterior distribution. After the mean and standard deviation are mapped by the convolution operation, the size changes from B×N×1×1 to B×C×1×1, and the feature map corresponding to the mean and standard deviation is obtained; the original feature map is instance-normalized and then fused with the feature map corresponding to the sampled mean and standard deviation, that is, by applying the random sample mean g and standard deviation h to the standardized features, the mean and standard deviation of the content features are adjusted to the new target values; The adaptive instance normalization unit AdaIN is implemented by the following operations:
[0016] in, are input features, and are the mean and standard deviation of the features of the image to be enhanced, i.e., the content features, and is the mean and standard deviation of the enhanced features, i.e., style features.
[0017] Preferably, the input is 3 two-dimensional convolution after the activation function and then a 3 3 two-dimensional convolution after the activation function, and then through two consecutive feature perception sub-modules and 1 1, the output image is obtained after the two-dimensional convolution, in which the feature perception submodule structure is the same as the feature perception submodule of the feature extraction and encoding module.
[0018] The second aspect of the present invention proposes an underwater image enhancement method based on multi-head transposed spatial attention, which applies the underwater image enhancement system as described in the first aspect and includes the following process: Shoot and obtain real underwater images; Inputting the preprocessed image into the underwater image enhancement system; Output enhanced underwater image.
[0019] Compared with the prior art, the present invention has the following beneficial effects: The present invention proposes multi-head transposed spatial attention, which effectively combines multi-head transposed self-attention and spatial attention, wherein the multi-head transposed self-attention combines the advantages of multi-head attention and transposition operation, so that the model has significant improvements in capturing complex dependencies, enhancing context modeling, and improving parallel computing efficiency, and improves the interpretability and generalization ability of the model. At the same time, spatial attention is integrated on this basis, and the weights of various positions of the feature map are dynamically adjusted by calculating the importance of different spatial positions, so that the key areas can be better focused when processing visual data. At the same time, the introduction of wavelet convolution can better capture detail information and analyze it at multiple scales, and has better robustness to noise and signal interference, and can effectively extract useful features from complex or noisy input signals, especially underwater images, and can effectively retain and reconstruct details. And a feature extraction submodule is added to further refine the features of the input image, which can refine the feature representation of the image, improve the feature expression ability of the model, and significantly improve the task performance. And the adaptive instance normalization module of image style transfer is applied to image enhancement, which further improves the effect of image enhancement. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, what is described below is only one embodiment of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1 The figure is an overall principle block diagram of the underwater image enhancement system of the present invention.
[0022] Figure 2 Schematic diagram of the network structure of the feature extraction encoding module of the present invention.
[0023] Figure 3 Schematic diagram of the network structure of the probability adaptive instance normalization module of the present invention.
[0024] Figure 4 Schematic diagram of the network structure of the decoding module of the present invention.
[0025] Figure 5 Schematic diagram of the network structure of the feature extraction submodule of the present invention.
[0026] Figure 6 Schematic diagram of the network structure of the feature perception submodule of the present invention.
[0027] Figure 7 Schematic diagram of the network structure of the multi-head transposed spatial self-attention unit of the present invention.
[0028] Figure 8 Schematic diagram of the network structure of the multi-head transposed spatial self-attention sub-unit of the present invention.
[0029] Fig. 9 Schematic diagram of the network structure of the spatial attention subunit of the present invention.
[0030] Fig.10 Schematic diagram of the network structure of the wavelet convolution unit of the present invention.
[0031] Fig.11 This is the original experimental picture in the embodiment of the present invention.
[0032] Fig.12 This is the enhanced image in the embodiment of the present invention. DETAILED DESCRIPTION
[0033] The present invention provides an underwater image enhancement system based on multi-head transposed spatial attention, the overall structure of which is as follows: Figure 1 As shown, it includes a feature extraction encoding module, a probability adaptive instance normalization module and a decoding module.
[0034] The feature extraction encoding module structure is as follows: Figure 2As shown in the figure, the input image features are extracted, and the pre-processed underwater target image is used as the input. After multiple convolutions, activation functions, maximum pooling, feature extraction submodules, feature perception submodules, and upsampling, the features are extracted and then output. First, the processing submodule (including multiple convolutions, activation functions, and maximum pooling operations) extracts local features from the input data by scanning the input image through the convolution kernel, and downsamples the feature map through the activation function and pooling operation to reduce the size of the feature map and generate a higher-level and more abstract feature representation. Then, the feature extraction submodule is used to refine the features, enhance the valuable features, and suppress the features with less information, so as to obtain the refined feature map. The underwater image degradation problem is diverse and complex (such as fogging in local areas, global hue shift, noise interference, etc.). The deep convolutional network in the feature extraction submodule has a hierarchical structure. The low layer can capture subtle edge and texture information, while the high layer focuses on global illumination, structure, and semantic information. The extraction of multi-scale features can capture degradation phenomena of different frequencies, and linear transformation helps integrate this information to form a unified and clear restored image. The refined and efficient feature fusion and reconstruction can significantly improve the image degradation caused by low contrast, color deviation and noise in underwater images. The feature perception submodule is then used to further enhance the feature extraction capability. The multi-head transposition self-attention mechanism is used to handle long-distance dependencies and the spatial dimension of the feature map is adjusted through the transposition operation to enhance the spatial perception capability and thus improve the feature expression capability. At the same time, the spatial attention calculation is increased to assign weights to each spatial position, suppressing irrelevant or unimportant information, thereby obtaining richer feature maps at multiple scales and angles. That is, local features are obtained through this module and information is extracted from the global context, and the enhanced feature map is obtained by combining spatial information processing.
[0035] The feature perception submodule includes wavelet convolution and multi-head transposed spatial self-attention unit. The wavelet convolution is mainly used for multi-scale feature extraction and signal analysis. It can perform multi-scale analysis on images for the problem that various degradation factors in underwater environments perform differently at different scales. It can decompose signals or images into sub-bands of different frequencies, which can capture low-frequency parts (global information, such as background, overall brightness) and extract high-frequency details (edges, textures, etc.), which is very critical for the subsequent restoration of underwater images. The multi-head transposed spatial self-attention unit processes long-distance dependencies through multi-head transposed self-attention and adjusts the spatial dimension of the feature map through transposition operation to enhance spatial perception and thus improve feature expression. At the same time, the subsequent spatial attention calculation can obtain richer feature maps at multiple scales and multiple angles, that is, local features are obtained through this module and information is extracted from the global context. Combined with spatial information processing, the receptive field of the model is expanded through multi-head transposed self-attention and spatial attention. The larger receptive field enables the processing unit to observe information in a larger area, thereby more accurately estimating the global illumination and color distribution underwater. This underwater global information helps to compensate for the color deviation problem caused by changes in water quality and illumination. In addition, the increase in receptive field can capture local details and overall structural information at the same time, realizing the fusion of multi-scale features. This can not only preserve details, but also effectively balance the overall tone and brightness, achieve a more natural enhancement effect, reduce the interference of single local area anomalies on the overall result, and thus improve the stability and robustness of the enhancement effect. Global information helps to restore the contrast and color of the image more accurately. A larger receptive field can better capture overall illumination changes, thereby achieving a balance between dynamic range compression, color consistency, and detail enhancement, and ultimately achieving better underwater image restoration.
[0036] The structure of the probability adaptive instance normalization module is as follows: Figure 3 As shown, based on the feature map output by the feature extraction encoding module, the image features are matched with the desired enhancement effect by adaptively adjusting the mean and standard deviation of the input features. The feature statistics of the image are adjusted based on random samples through the learned distribution, and the input mean and standard deviation are aligned with the matching statistics, that is, the mean and standard deviation are adjusted to obtain the adjusted feature map.
[0037] The structure of the decoding module is as follows Figure 4 As shown in the figure, based on the feature map output by the probability adaptive instance normalization module after mean and standard deviation adjustment, the feature map is reconstructed through multiple convolution and activation functions to restore the spatial information and improve the resolution. Then, it passes through the multi-head transposed spatial attention unit to make the decoder focus on the key area to suppress irrelevant information, and dynamically adjust the spatial weight of the feature map to enhance the feature expression of the target area, and obtain the final enhanced image result.
[0038] Underwater images usually have global problems such as uneven lighting, color shift and haze, and there are phenomena and problems such as uneven lighting of the entire picture. Ordinary image enhancement algorithms are unable to accurately estimate the lighting and color shift of underwater images due to their limited perception range and inability to estimate global lighting conditions. In addition, various degradation factors in underwater environments often behave differently at different scales, making ordinary enhancement algorithms unable to be effectively applied underwater. Therefore, the present invention adopts a feature extraction submodule and a feature perception submodule in both the feature extraction encoding module and the decoding module. The feature perception submodule includes a wavelet convolution and a multi-head transposition spatial self-attention unit, wherein: the wavelet convolution is mainly used for multi-scale feature extraction and signal analysis, and can perform multi-scale analysis on images for the problem that various degradation factors in underwater environments perform differently at different scales, decompose the signal or image into sub-bands of different frequencies, and can capture low-frequency parts (global information, such as background, overall brightness) and extract high-frequency details (edges, textures, etc.), which is very critical for the subsequent recovery of underwater images; the multi-head transposition spatial self-attention mechanism processes long-distance dependencies through multi-head transposition self-attention and adjusts the spatial dimension of the feature map through transposition operation to enhance the spatial perception ability and thus improve the feature expression ability, and the subsequent spatial attention calculation can obtain a richer feature map of multiple scales and multiple angles, that is, obtain local features through this module and extract information from the global context, combined with spatial information processing. The receptive field of the model is expanded by multi-head transposition self-attention and spatial attention, and the larger receptive field enables the processing unit to observe information in a larger area, thereby more accurately estimating the underwater global illumination and color distribution. This underwater global information helps to compensate for color casts caused by changes in water quality and illumination. In addition, the increase in receptive field can capture both local details and overall structural information, and achieve the fusion of multi-scale features. This can not only preserve details, but also effectively balance the overall hue and brightness, achieve a more natural enhancement effect, reduce the interference of single local area anomalies on the overall result, and thus improve the stability and robustness of the enhancement effect. Global information helps to restore the contrast and color of the image more accurately. A larger receptive field can better capture overall illumination changes, thereby achieving a balance between dynamic range compression, color consistency, and detail enhancement, and ultimately achieving better underwater image restoration.
[0039] In summary, the present invention enables the image processing algorithm to integrate more global and local detail information, perform more comprehensive optimization on the global degradation problem in underwater images, and thus improve the overall quality of image enhancement.
[0040] The specific structures of the three modules are further explained below.
[0041] 1. Feature Extraction and Encoding Module The feature extraction and encoding module includes multiple convolutions, activation functions, maximum pooling, feature refinement submodules, multi-head transposition spatial attention submodules and upsampling units; the input image is subjected to two sets of 3×3 two-dimensional convolutions and activation functions for local feature extraction to obtain the output feature map a, a is subjected to maximum pooling, feature refinement submodules and two sets of 3×3 two-dimensional convolutions and activation functions to perform feature map dimensionality reduction and feature refinement operations, enhance valuable features while suppressing features with less information, enhance the expression ability of the model, and obtain the refined feature map b, b is subjected to two sets of 3× 3's two-dimensional convolution and activation function are used for further local feature extraction to obtain feature map c. c is subjected to maximum pooling, two multi-head transposed spatial attention sub-modules and upsampling for feature map dimensionality reduction and feature weight assignment to achieve feature enhancement, focus on key areas and suppress redundant information to obtain feature map d. D is added to c to obtain e. e is subjected to two groups of 3×3 two-dimensional convolutions and activation functions and upsampling for further feature extraction and added to b to obtain f1. f1 is subjected to two groups of 3×3 two-dimensional convolutions, activation functions and upsampling and then added to a to obtain the output feature map.
[0042] 1. Feature extraction submodule The feature extraction submodule refines the input image features through deep convolution and linear transformation, extracts rich multi-scale features using deep convolution, and performs efficient feature fusion and reconstruction through linear transformation. The deep convolution network has a hierarchical structure. The low layers can capture subtle edge and texture information, while the high layers focus on global illumination, structure, and semantic information. The extraction of multi-scale features can capture degradation phenomena at different frequencies, while linear transformation helps integrate this information to form a unified and clear restored image. The refined and efficient feature fusion and reconstruction can significantly improve the image degradation caused by low contrast, color deviation, and noise in underwater images. The structure is as follows: Figure 5 As shown in the figure, the main steps include: splitting the input features and partially convolving them. Expanding the feature dimension through linear transformation and applying the gating mechanism. Using depthwise separable convolution to optimize the features and then combining them with the original features for output. Finally, through residual connection, the optimized features are added to the original input to enhance the model's expressiveness. The detailed steps are: For the input feature map E, its size is B C H W, where B is the batch size, C is the number of channels, and H and W are the spatial dimensions (height and width). Split the input into two parts X1 and X2 along the channel dimension, perform a convolution operation on X1, and then reconstruct the convolved X1 and unprocessed X2 and rearrange them to size B. (H W) C, that is, flattening the two-dimensional spatial information into one dimension. After the flattened features are passed to the linear layer, they are divided into two parts x_1 and x_2 along the last dimension. x_1 is processed by deep convolution, and the convolution result is rearranged back to size B. (H W) C. Finally, x_1 and x_2 are multiplied to form a gating mechanism, which controls the information flow through multiplication operations. Then it is linearly transformed by the linear layer and restored to B C H The W size is restored to the image form. The processed output is added to the original input and a residual connection is performed.
[0043] 2. Feature perception submodule The feature perception submodule in the feature extraction encoding module is as follows Figure 6 As shown in Figure 1, it includes two-dimensional convolution, wavelet convolution and multi-head transposed spatial self-attention unit. The input feature map is 3 3, followed by an activation function (LeakyRelu), two consecutive wavelet convolutions, and a multi-head transposed spatial self-attention unit. The result is added to the input feature map and output.
[0044] The feature perception submodule includes two-dimensional convolution, wavelet convolution and multi-head transposed spatial self-attention unit. The input feature map is 3 3, followed by an activation function (LeakyRelu), two consecutive wavelet convolutions, and a multi-head transposed spatial self-attention unit. The result is added to the input feature map and output.
[0045] (1) Multi-head transposed spatial self-attention unit Among them, the multi-head transposed spatial self-attention unit is Figure 7 As shown in Figure 1, it includes a multi-head transposed self-attention subunit and a spatial attention subunit. The input feature map F is obtained by multiplying the attention weight output by the multi-head transposed self-attention subunit with the input feature map to obtain the feature map , as input to the spatial attention subunit to obtain the spatial attention weight, which is After dot multiplication, the output feature map is obtained.
[0046] 1) Multi-head transposed self-attention sub-unit The multi-head transposed self-attention sub-unit structure is as follows Figure 8 As shown, first, for the input feature map F, its size is B C H W, where B is the batch size, C is the number of channels, and H and W are the spatial dimensions (height and width). First, a 1x1 2D convolution is performed on the input to obtain a B C H The tensor W represents the query (q), key (k), and value (v) in the attention mechanism. Then, a deep convolution operation is performed on the result, and the output size is B. C H The output value is then split into three parts according to the channel dimension: query (q), key (k), and value (v), with sizes of: q is of size B C H The size of W, k is B C H The dimensions of W and v are B C H W.
[0047] Rearrange the query tensor q from B C H W to B Head (C / head) (H W) shape, where head represents the number of attention heads, c / head represents the number of channels per head, and H W is the result of flattening the spatial dimensions. Similarly, a similar rearrangement is performed on the key tensor k to obtain a size of B Head (C / head) (H W). A similar rearrangement is performed on the value tensor v to obtain a tensor of size B Head (C / head) (H W). Then q and k are normalized in the last dimension (i.e., feature dimension) and the dot product of query q and key k is calculated to obtain a tensor with shape B Head (C / head) (H W). The tensor is scaled and softmaxed to obtain the attention weight of each position, ensuring that its value is in the range [0,1] and sums to 1, and the attention weight (attn) is obtained. The final output is obtained by multiplying the attention weight (attn) with the tensor v, whose size is B Head (C / head) (H W). Then rearrange the output tensor to restore the original spatial dimension B C H W, but now the number of channels becomes head*c / head, that is, the multi-head information is restored. 1 two-dimensional convolution layer, adjust the number of channels to make the number of channels consistent with the input dimension, and obtain the multi-head transposed self-attention weight matrix , transpose the multi-head self-attention weight matrix Applied to the input feature map F, we can get the feature map of the image obtained by multi-head transposed self-attention, that is:
[0048] in, Represents the multi-head transposed self-attention weight matrix obtained by the above operation , which is used to calculate the attention weight between each element and other elements in the input feature map, capture the global dependency, and determine the degree of influence of each element on other elements, thereby achieving effective fusion of information. represents the input feature map, Represents the output feature map after multi-head transposed self-attention calculation.
[0049] The multi-head transposed self-attention weight matrix Processing long-distance dependencies and adjusting the spatial dimensions of feature maps through transposition operations enhances spatial perception and thus improves feature expression capabilities, expanding the receptive field of the model. A larger receptive field enables the processing unit to observe information from a larger area, and this matrix can more accurately estimate underwater global illumination and color distribution. This underwater global information helps compensate for color deviation problems caused by changes in water quality and illumination. In addition, the increase in the receptive field can capture local details and overall structural information at the same time, achieving the fusion of multi-scale features, which can not only retain details, but also effectively balance the overall hue and brightness, achieving a more natural enhancement effect, reducing the interference of a single local area anomaly on the overall result, thereby improving the stability and robustness of the enhancement effect.
[0050] 2) Spatial Attention Subunit The spatial attention subunits are Fig. 9As shown, first, for the input feature map , whose size is B C H W, where B is the batch size, C is the number of channels, H and W are the spatial dimensions (height and width), perform global maximum pooling and global average pooling operations, and get two B 1 H The feature map of W; the results of global maximum pooling and global average pooling are spliced according to the channel to obtain a size of B 2 H The feature map of W; perform 7 on the concatenated feature map 7 two-dimensional convolution operation, resulting in a size of B 1 H The feature map of W; the spatial attention weight matrix can be obtained by passing the feature map through the Sigmoid activation function ,Right now:
[0051]
[0052] Among them, the spatial attention weight matrix , The global average pooling operation is used to reduce the dimension and aggregate the features of the feature map. The spatial information is aggregated by average pooling, and the global information of each feature map is retained to facilitate better calculation of the spatial attention matrix. The feature map generated by global average pooling is , the feature map retains the global information of each feature map; it can gather the statistical information of the entire image, thereby helping the network understand the global distribution of illumination and color characteristics of the image, and is used to solve the problems of uneven illumination, color deviation and haze that often exist in underwater images. It is a maximum pooling operation, which is mainly used to extract local significant features, enhance the model's attention to key areas, and help the model pay more attention to the areas with the strongest response in the feature map, thereby improving the sensitivity to key features and focusing on local details. It is mainly used to solve the problems of local scattered light, low contrast and noise in underwater images. Through local detail focusing, it is possible to automatically identify areas in underwater images that are severely damaged or lack details, and give them higher weights, so that the enhancement algorithm can perform more effective detail recovery in these key areas. Feature map generated by global maximum pooling , the feature map extracts local salient features, Indicates 7 The convolution operation of 7, that is, connecting the results of average pooling and maximum pooling and performing convolution operation for feature enhancement, can not only retain the global context information, but also enhance the attention to local significant features, further integrate the global and local information, and generate spatial attention weights.
[0053] The spatial attention weight matrix Applied to the input feature map On the above, we can get the feature map of the image calculated by spatial attention, that is:
[0054] in, It represents the calculation of the spatial attention weight matrix, which is used to calculate the relationship between each spatial position in the feature map and other positions, capture the global spatial dependencies in the feature map, gather the statistical information of the entire image, and help the network understand the illumination and color characteristics of the global distribution of the image. It is used to solve the problems of uneven illumination, color deviation and haze that often exist in underwater images. At the same time, by focusing on local details, it can automatically identify the areas in the underwater image that are severely damaged or lack details, and give them higher weights, so that the enhancement algorithm can restore details in these key areas more effectively, capture the global spatial dependencies in the feature map, represents the input feature map, Represents the output feature map after spatial attention calculation.
[0055] Transpose the multi-head self-attention weight matrix and the spatial attention weight matrix Apply it to the input feature map F in sequence, and you can get the feature map of the image calculated by multi-head transposed self-attention and spatial attention, that is, the final refined feature map :
[0056]
[0057] (2) Wavelet convolution unit The wavelet convolution is as follows Fig.10 As shown; the wavelet convolution includes the wavelet transform filter:
[0058]
[0059]
[0060]
[0061] After the filter, the image is divided into four parts: (Low-Low) represents the filter of the low-frequency part. The part obtained by this filter contains the main information and energy of the image and is used for image compression and feature extraction; (Low-High) represents the filter from low frequency to high frequency. The part obtained by this filter mainly contains horizontal features. (High-Low) represents the filter from high frequency to low frequency. The part obtained by this filter mainly contains the features in the vertical direction. (High-High) represents the filter of the high-frequency part. The part obtained by this filter contains the least information and is used for noise processing; Multi-scale features can be extracted through wavelet convolution. Multi-scale analysis of images can be performed to address the problem that various degradation factors in underwater environments have different performances at different scales. Signals or images can be decomposed into sub-bands of different frequencies, which can capture both low-frequency parts (global information, such as background, overall brightness) and high-frequency details (edges, textures, etc.), which is critical for the subsequent restoration of underwater images. Then after a depthwise convolution with a stride of 2, it undergoes a two-dimensional convolution and a transposed convolution, and is added to the input feature map after the two-dimensional convolution to obtain the output.
[0062] 2. Probabilistic Adaptive Instance Normalization Module The probabilistic adaptive instance normalization module can effectively match content features with the desired enhancement effect by adaptively adjusting the mean and standard deviation of input features.
[0063] For the input feature map, the size is B×C×H×W, where B, C, H, and W represent the batch size, number of channels, height, and width, respectively. First, calculate the average pooling mean of each channel in terms of the height and width spatial dimensions, and compress the feature map into a single tensor to obtain a tensor of B×C×1×1. Then, use 1×1 convolution to obtain the mean and logarithmic standard deviation vectors B×2N×1×1, which are divided into mean vectors and logarithmic standard deviation vectors, where the mean vector size is B×N×1×1 and the logarithmic standard deviation vector size is B×N×1×1. The standard deviation vector obtained by transforming the mean vector and the logarithmic standard deviation is used to construct a Gaussian distribution, that is, the Gaussian distribution of the mean distribution of the input features. (N can take any value, depending on the enhancement effect, here it is 20) At the same time, the standard deviation of each channel in terms of height and width is calculated for the spatial dimension, and the feature map is compressed into a single tensor, resulting in a tensor of B×C×1×1, which represents the degree of change of the input feature in the spatial dimension. Then, a 1×1 convolution is used to obtain the mean of the standard deviation and the logarithmic standard deviation vector B×2N×1×1, which is divided into a mean vector and a logarithmic standard deviation vector, where the mean vector size is B×N×1×1 and the logarithmic standard deviation vector size is B×N×1×1. The standard deviation vector obtained by transforming the mean vector and the logarithmic standard deviation constructs a Gaussian distribution, that is, a Gaussian distribution of the standard deviation distribution of the input feature.
[0064] Once the distribution is constructed, random samples are drawn from the Gaussian distribution and reparameterized sampling is used to generate random samples.
[0065]
[0066]
[0067] where g and h are two random samples from the prior distribution of the mean and standard deviation of the input feature map, respectively. and are the N-dimensional Gaussian distributions of the mean and standard deviation of the input feature map, is the mean of the mean Gaussian distribution of the input feature map, is the standard deviation of the mean Gaussian distribution of the input feature map, is the mean of the Gaussian distribution of the standard deviation of the input feature map, is the standard deviation of the Gaussian distribution of the standard deviation of the input feature map, and x is the original input feature map.
[0068] It should be noted that in the inference phase, g and h only depend on the input image. In the training phase, the posterior distribution is learned through the input image and the corresponding reference image. That is, the main difference between the training and testing phases is that the training phase requires additional calculation of the posterior distribution (i.e., the reference enhanced image) and random sampling, while the testing phase directly uses the prior distribution for image generation. The random activation values extracted from the distribution learned in the training phase are used to align the mean and standard deviation of the received features. The random sample size of the mean and standard deviation obtained in this step is B×N×1×1.
[0069] The random samples are then injected into the Adaptive Instance Normalization Unit (AdaIN) to transform the statistics of the received features. A typical AdaIN receives a content input and a style input and simply aligns the mean and standard deviation of the content input to the mean and standard deviation of the style input to match their statistics. In this method, the mean and standard deviation of the received features are aligned based on random sampling by extracting random activations from the learned distribution. Latent variables (mean and standard deviation) are randomly sampled from the posterior distribution. The mean and standard deviation are mapped by convolution operations, and the size changes from B×N×1×1 to B×C×1×1, respectively, to obtain feature maps corresponding to the mean and standard deviation. The original feature maps are instance-normalized and fused with the feature maps corresponding to the sampled mean and standard deviation. That is, the mean and standard deviation of the content features are adjusted to the new target values by applying random samples g (mean) and h (standard deviation) to the normalized features. This means that the statistics of the input features, i.e., the content features, are adjusted to meet the desired enhancement effect (i.e., the style features).
[0070] Specifically, the adaptive instance normalization unit (AdaIN) is implemented by the following operations:
[0071] in, are input features, and are the mean and standard deviation of the features of the image to be enhanced, i.e., the content features, i.e., the features of the original underwater image, and It is the mean and standard deviation of the enhanced features, namely the style features, that is, the features of the enhanced image.
[0072] Input 3 3 two-dimensional convolution after the activation function (LeakyRelu) and then a 3 3 two-dimensional convolution after the activation function, and then through two consecutive multi-head transposed spatial attention sub-modules and 1 The output image is obtained after two-dimensional convolution of 1. The structure of the feature perception submodule is the same as that of the feature extraction and encoding module.
[0073] IV. Experimental Results The experimental original image used in this embodiment is as follows Fig.11 As shown, the enhanced experimental results Fig.12As shown in Table 1. The model effect data uses two commonly used image quality evaluation indicators, PSNR and SSIM, which are often used to compare the quality difference between the original image and the compressed or processed image. Among them, PSNR (peak signal-to-noise ratio) is an indicator to measure image quality. It is often used in tasks such as image compression and denoising. It represents the ratio between the signal intensity and the noise intensity of the image. The larger the PSNR, the better the image quality and the smaller the error. SSIM (structural similarity index) is an image quality evaluation standard based on human eye perception. It not only considers the brightness and contrast of the image, but also the structural information of the image. The goal of SSIM is to evaluate the degradation of image quality by simulating the perception mechanism of the human eye. As shown in Table 1.
[0074] Table 1 Experimental results
[0075] Among them, Retinex represents the enhancement algorithm of retinal cortex theory, CLAHE is the contrast-constrained adaptive histogram equalization algorithm, and other models are the names of conventional image enhancement algorithms in this field.
[0076] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0077] Although the above describes the specific implementation methods of the present invention, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.
Claims
1. An underwater image enhancement system based on multi-head transposed spatial attention, characterized by: It includes a feature extraction encoding module, a probability adaptive instance normalization module and a decoding module; The feature extraction and encoding module includes a processing submodule, a feature extraction submodule and a feature perception submodule; The processing submodule extracts local features from the input image scanned by the convolution kernel and downsamples the feature map; the feature extraction submodule refines the features, enhances the valuable features and suppresses the features with less information, and obtains the refined feature map; The feature perception submodule uses a multi-head transposition self-attention mechanism to process long-distance dependencies and adjusts the spatial dimension of the feature map through a transposition operation to enhance spatial perception capabilities. At the same time, it increases spatial attention calculation to assign weights to each spatial position to obtain an enhanced feature map. The probabilistic adaptive instance normalization module matches the image features with the desired enhancement effect by adaptively adjusting the mean and standard deviation of the input features, and adjusts the feature statistics of the image based on random samples through the learned distribution, aligning the input mean and standard deviation to match the corresponding statistics; The decoding module reconstructs the feature map through multiple convolutions and activation functions, restores spatial information and improves resolution, and then uses a multi-head transposed self-attention mechanism to focus the decoder on the key area, dynamically adjusts the spatial weight of the feature map to enhance the feature expression of the target area, and obtains the final enhanced image result.
2. The underwater image enhancement system based on multi-head transposed spatial attention as claimed in claim 1, characterized in that: The feature extraction coding module is specifically: The input image is subjected to two sets of 3×3 two-dimensional convolutions and activation functions for local feature extraction to obtain the output feature map a; a is subjected to maximum pooling, feature refinement submodules and two sets of 3×3 two-dimensional convolutions and activation functions to perform feature map dimensionality reduction and feature refinement operations, enhance valuable features while suppressing features with less information, enhance the expressiveness of the model, and obtain the refined feature map b; b is subjected to two sets of 3×3 two-dimensional convolutions and activation functions for further local feature extraction to obtain feature map c; c is subjected to maximum pooling, two feature perception submodules and upsampling for feature map dimensionality reduction and feature weight allocation to achieve feature enhancement, focus on key areas and suppress redundant information, and obtain feature map d, d is added to c to obtain e, e is subjected to two sets of 3×3 two-dimensional convolutions and activation functions and upsampling for further feature extraction and addition to b to obtain f1, f1 is subjected to two sets of 3×3 two-dimensional convolutions and activation functions and upsampling and then added to a to obtain the output feature map.
3. The underwater image enhancement system based on multi-head transposed spatial attention as claimed in claim 1, characterized in that: The feature extraction submodule is specifically: For the input feature map, its size is B C H W, where B is the batch size, C is the number of channels, H and W are the spatial dimensions, split the input into two parts X1 and X2 along the channel dimension, perform a convolution operation on X1, and then reconcatenate the convolved X1 and the unprocessed X2 and rearrange them to size B (H W) C, that is, flattening the two-dimensional spatial information into one dimension; passing the flattened features into the linear layer and dividing them into two parts x_1 and x_2 along the last dimension; x_1 is processed by deep convolution, and the convolution result is rearranged back to size B (H W) C; Finally, x_1 and x_2 are multiplied to form a gating mechanism, which controls the information flow through the multiplication operation, and then undergoes a linear transformation through the linear layer, and then recovers to B C H The W size is restored to the image form, and the processed output is added to the original input for residual connection.
4. The underwater image enhancement system based on multi-head transposed spatial attention as claimed in claim 1, characterized in that: The feature perception submodule includes two-dimensional convolution, wavelet convolution and multi-head transposed spatial self-attention unit; its input feature map is first subjected to 3*3 two-dimensional convolution, then to activation function, then to two consecutive wavelet convolutions, and finally to multi-head transposed spatial self-attention unit, and the result is added to the input feature map and then output; The wavelet convolution includes a wavelet transform filter, and its input is divided into four parts after passing through the filter, and then after a depth convolution with a step size of 2, a two-dimensional convolution and a transposed convolution are performed, and the output is added to the feature map of the input after the two-dimensional convolution; The multi-head transposition spatial self-attention unit includes a multi-head transposition self-attention subunit and a spatial attention subunit; the input feature map F is obtained by multiplying the input feature map by the attention weight output by the multi-head transposition self-attention subunit. , and then input the spatial attention subunit to get the spatial attention weight, which is After dot multiplication, the output feature map is obtained.
5. The underwater image enhancement system based on multi-head transposed spatial attention as claimed in claim 4, characterized in that: The multi-head transposed spatial self-attention subunit is specifically: First, for the input feature map F, its size is B C H W, where B is the batch size, C is the number of channels, H and W are the spatial dimensions; first perform a 1x1 two-dimensional convolution on the input to obtain a B C H The tensor W represents the query q, key k and value v in the attention mechanism; then the result is deep convolution, and the output size is B C H W tensor; then split the output value into three parts according to the channel dimension: query q, key k and value v, with sizes: q has a size of B C H The size of W, k is B C H The dimensions of W and v are B C H W; Rearrange the query tensor q from B C H W to B Head (C / head) (H W) shape, where head represents the number of attention heads, c / head represents the number of channels per head, and H W is the result of flattening the spatial dimensions; similarly, a similar rearrangement is performed on the key tensor k to obtain a size of B Head (C / head) (H W); perform the same rearrangement on the value tensor v to get a tensor of size B Head (C / head) (H W); then q and k are normalized in the last feature dimension and the dot product of query q and key k is calculated to obtain a tensor of shape B Head (C / head) (H W) tensor; and scale and softmax the tensor to obtain the attention weight of each position, ensuring that its value is in the range of [0, 1] and the sum is 1, and obtain the attention weight attn; By multiplying the attention weight attn with the tensor v, we get the final output, whose size is B Head (C / head) (H W); then rearrange the output tensor to restore it to its original spatial dimension B C H W, but now the number of channels becomes head*c / head; Last passed 1 1 two-dimensional convolution layer, adjust the number of channels to make the number of channels consistent with the input dimension, and obtain the multi-head transposed self-attention weight matrix , transpose the multi-head self-attention weight matrix Applied to the input feature map F, we can get the feature map of the image obtained by multi-head transposed self-attention, that is: in, Represents the multi-head transposed self-attention weight matrix obtained by the above operation , used to calculate the attention weights between each element in the input feature map and other elements, capturing global dependencies, represents the input feature map, Represents the output feature map after multi-head transposed self-attention calculation.
6. The underwater image enhancement system based on multi-head transposed spatial attention as claimed in claim 4, characterized in that: The spatial attention subunit is specifically: First, for the input feature map , whose size is B C H W, where B is the batch size, C is the number of channels, H and W are the spatial dimensions, perform global maximum pooling and global average pooling operations, and get two B 1 H The feature map of W; the results of global maximum pooling and global average pooling are spliced according to the channel to obtain a size of B 2 H The feature map of W; perform 7 on the concatenated feature map 7 two-dimensional convolution operation, resulting in a size of B 1 H The feature map of W; the spatial attention weight matrix can be obtained by passing the feature map through the Sigmoid activation function ,Right now: Among them, the spatial attention weight matrix , The global average pooling operation is used to reduce the dimension and aggregate the features of the feature map. The spatial information is aggregated by average pooling, and the global information of each feature map is retained to facilitate better calculation of the spatial attention matrix. The feature map generated by global average pooling is , this feature map retains the global information of each feature map; It is a maximum pooling operation, which is used to extract local significant features, enhance the model's attention to key areas, and help the model pay more attention to the areas with the strongest response in the feature map. The feature map generated by the global maximum pooling , the feature map extracts local salient features, Indicates 7 The convolution operation of 7, that is, the results of average pooling and maximum pooling are connected and then subjected to convolution operation for feature enhancement, which can not only retain the global context information, but also enhance the attention to local significant features, fuse global and local information, and generate spatial attention weights; The spatial attention weight matrix Applied to the input feature map On the above, we can get the feature map of the image calculated by spatial attention; Transpose the multi-head self-attention weight matrix and the spatial attention weight matrix Apply it to the input feature map F in sequence, and you can get the feature map of the image calculated by multi-head transposed self-attention and spatial attention, that is, the final refined feature map .
7. The underwater image enhancement system based on multi-head transposed spatial attention as claimed in claim 1, characterized in that: The probability adaptive instance normalization module is specifically: For the input feature map, the size is B×C×H×W, where B, C, H, and W represent the batch size, number of channels, height, and width, respectively. First, the average pooling of each channel in terms of height and width is calculated, and the feature map is compressed into a single tensor to obtain a tensor of B×C×1×1. Then, a 1×1 convolution is used to obtain the mean and logarithmic standard deviation vectors B×2N×1×1, which are divided into the mean vector and the logarithmic standard deviation vector, where the mean vector size is B×N×1×1 and the logarithmic standard deviation vector size is B×N×1×1. The Gaussian distribution is constructed using the standard deviation vector obtained by transforming the mean vector and the logarithmic standard deviation. At the same time, each channel calculates the standard deviation of the spatial dimension in terms of height and width, compresses the feature map into a single tensor, and obtains a tensor of B×C×1×1, which represents the degree of change of the input feature in the spatial dimension; then, a 1×1 convolution is used to obtain the mean of the standard deviation and the logarithmic standard deviation vector B×2N×1×1, which is divided into a mean vector and a logarithmic standard deviation vector, where the size of the mean vector is B×N×1×1 and the size of the logarithmic standard deviation vector is B×N×1×1, and the Gaussian distribution is constructed with the standard deviation vector obtained by transforming the mean vector and the logarithmic standard deviation; When the distribution is constructed, random samples are drawn from the Gaussian distribution, and random samples are generated using reparameterized sampling. The size of the random samples of the mean and standard deviation is B×N×1×1; The random samples are then injected into the adaptive instance normalization unit AdaIN to transform the statistics of the received features by extracting random activation values from the learned distribution to align the mean and standard deviation of the received features based on random sampling.
8. The underwater image enhancement system based on multi-head transposed spatial attention as claimed in claim 7, characterized in that: The adaptive instance normalization unit AdaIN is specifically: The mean and standard deviation of the latent variables are randomly sampled from the posterior distribution. After the mean and standard deviation are mapped by the convolution operation, the size changes from B×N×1×1 to B×C×1×1, and the feature maps corresponding to the mean and standard deviation are obtained; After the original feature map is instance-normalized, it is fused with the feature map corresponding to the mean and standard deviation obtained by sampling, that is, the mean and standard deviation of the content feature are adjusted to the new target value by applying the random sample mean g and standard deviation h to the standardized feature; The adaptive instance normalization unit AdaIN is implemented by the following operations: in, are input features, and are the mean and standard deviation of the features of the image to be enhanced, i.e., the content features, and is the mean and standard deviation of the enhanced features, i.e., style features.
9. The underwater image enhancement system based on multi-head transposed spatial attention as claimed in claim 1, characterized in that: The input is 3 3 two-dimensional convolution after the activation function and then a 3 3 two-dimensional convolution after the activation function, and then through two consecutive feature perception sub-modules and 1 1, the output image is obtained after the two-dimensional convolution, in which the feature perception submodule structure is the same as the feature perception submodule of the feature extraction and encoding module.
10. An underwater image enhancement method based on multi-head transposed spatial attention, characterized in that: The underwater image enhancement system according to any one of claims 1 to 9 is applied, and includes the following process: Shoot and obtain real underwater images; Inputting the preprocessed image into the underwater image enhancement system; Output enhanced underwater image.
Citation Information
Patent Citations
Face image restoration method based on multi-scale local self-attention generative adversarial network
CN113962893A
Dynamic illumination face image quality enhancement method based on multi-scale attention mechanism
CN115880225A
Information fusion vision enhancement network method and computer equipment
CN117522698A
Low-light image enhancement method of image hierarchical structure network based on stream learning
CN118115378A
Infrared image denoising method based on convolution transpose self-attention
CN118229572A
Cited By
Image restoration method, system and device based on prior features and linear scanning
CN120219245A
Image Restoration Method, System, and Device Based on Prior Features and Linear Scanning
CN120219245B
Underwater image enhancement method and system based on combination of multiple convolution models and attention mechanism
CN120278912A