An underwater image enhancement method and device based on color perception fusion attention and background light separation contrast learning
By combining color perception with attention and background light-driven contrast learning, the problem of color distortion and blurring in underwater image enhancement is solved, restoring the real details and natural colors of underwater images and adapting them to complex underwater environments.
Patent Information
- Application Number
- CN202411366554.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-09-29
AI Technical Summary
Existing underwater image enhancement methods struggle to effectively address severe degradation issues such as detail blurring and color cast, leading to a decrease in image clarity and color accuracy.
We employ a method based on color perception fusion attention and background light removal contrast learning. Through a color extraction module, a local color recovery branch, a global light recovery branch, and a triple attention branch, combined with color histograms, self-attention mechanisms, and contrast learning strategies, we can restore the color and detail information of underwater images.
It significantly improves the quality of underwater images, corrects color distortion and blurring, restores the true details and natural colors of the images, and adapts to complex underwater environments.
Smart Images

Figure CN119444593B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of image classification, specifically relating to an underwater image enhancement method and apparatus based on color perception fusion attention and background light removal contrast learning. Background Technology
[0002] Underwater imaging is crucial for applications such as underwater robotics and marine resource exploration. However, underwater image quality deteriorates significantly due to light absorption and scattering, leading to problems such as color cast, low contrast, haze, and blur. These degradations adversely affect the performance and reliability of underwater vision tasks, highlighting the importance of underwater image enhancement. Underwater image enhancement plays a vital role in improving the visual quality and fidelity of images, contributing to a more accurate understanding of the underwater environment. The degradation of underwater images can be attributed to two main factors. First, the wavelength of light varies with propagation distance, unlike the uniform attenuation of terrestrial light. As propagation distance increases, longer wavelengths such as red and orange attenuate more drastically, resulting in a blue-green cast associated with shorter wavelengths. This effect becomes more pronounced as the distance between the subject and the camera increases. Second, suspended particles in the water, including organic particles and planktonic microorganisms, cause light scattering, deflecting the direction of light propagation and reducing image contrast and sharpness. To improve the quality of underwater images, numerous methods have emerged, broadly categorized into two types: traditional methods and deep learning-based methods. Traditional underwater image enhancement methods include prior-based and physics-based approaches. Prior-based methods utilize rich priors to explore the spatial relationships between pixel values in the original underwater image, enhancing it by adjusting contrast, brightness, and saturation, such as the gray world assumption, RGB maximization, and white balance. However, these methods often neglect the physical imaging process, limiting their enhancement effectiveness. Physics-based underwater image enhancement methods focus on accurately estimating the underwater image formation model or medium transport parameters. These methods aim to obtain a clean image by reversing the physical underwater imaging model. Despite their potential, the performance of traditional underwater image enhancement methods is often limited by the complexity and diversity of real-world underwater environments. Recently, deep learning has driven significant progress in underwater image enhancement techniques, with major methods built on Convolutional Neural Networks (CNNs), Generative Adversarial Networks (GANs), and Transformers. In this work, existing techniques focus on CNN architectures due to their powerful visual feature learning capabilities and flexible training processes. However, CNN-based underwater image enhancement methods encounter challenges in real-world underwater scenes with complex distortions and diverse image content, hindering accurate and adaptive restoration. As described in underwater imaging models, global color distortion caused by global illumination and local complex distortions within scene brightness pose significant obstacles to underwater image enhancement, greatly reducing image sharpness.
[0003] As can be seen from the above problems, there is an urgent need to solve the problem of how to deal with severe degradation such as blurred details and color cast during underwater image enhancement. Summary of the Invention
[0004] The main objective of this invention is to overcome the shortcomings and deficiencies of the prior art and provide an underwater image enhancement method and device based on color perception fusion attention and background light removal contrast learning. This method improves the quality of underwater images and can realistically and delicately restore the color and texture of images, thereby enhancing the realism and visibility of the enhanced images, while also mitigating the effects of degradation commonly found underwater, such as color deviation and detail blurring.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] In a first aspect, the present invention provides an underwater image enhancement method based on color perception fusion attention and background light removal contrast learning, comprising the following steps:
[0007] A color extraction module based on color histograms and linear modules extracts color information from raw underwater images.
[0008] The color information is input into the local color recovery branch to obtain reasonably distributed color weight information;
[0009] The original underwater image is processed through a triple attention branch to restore details and blurry information, resulting in an enhanced underwater image rich in detail and texture. The triple attention branch integrates multiple triple attention content-aware modules in a U-shaped manner with skip connections, forming a hierarchical structure. It enhances key image regions and contextual dependencies through a series of downsampling and upsampling operations. The triple attention branch captures features at different resolutions using multi-scale inputs, and its output is obtained by combining spatial features, channel features, and self-attention features. Downsampling is used to acquire high-level semantic features, while upsampling is used to restore fine-grained details. The triple attention content-aware module aims to enhance the features of the underwater image by integrating spatial attention, channel attention, and self-attention mechanisms.
[0010] The reasonably distributed color weight information and the underwater enhanced image rich in detail and texture information are input into the global light restoration branch. A contrastive learning strategy is used to adjust the global light characteristics of the underwater image, and finally the restored underwater image enhancement result is obtained.
[0011] As a preferred technical solution, the calculation process for the color extraction module to extract color information from the original underwater image is expressed as follows:
[0012] hc (i)=∑ x,y δ(I c (x,y)-i),
[0013] Where h c (i) is the histogram of color channel c in image i, I c (x,y) represents the pixel value of channel c at (x,y), and δ is an indicator function; a histogram is calculated for each color channel (R,G,B) to obtain the color distribution; then the histogram is passed to the linear module, and then through the convolutional layer to obtain the color-related feature C; wherein, the linear module is used for dimension alignment.
[0014] As a preferred technical solution, the local color recovery branch is constructed based on a self-attention mechanism of color information. The self-attention mechanism achieves adaptive adjustment in the following ways:
[0015]
[0016] Where C represents color-related features, K and V are obtained by transforming the input image through convolutional layers, and d k It is the dimension of the key vector; then a series of deep learning layers are applied to the output of the attention operation to generate an adaptive color-corrected map M. LCR =f LCR (I); The color correction map is designed to provide accurate, color-guided weights to enhance the model’s underwater image enhancement capabilities.
[0017] As a preferred technical solution, the triple attention branch integrates the triple attention content-aware module with skip connections in a U-shape, forming a hierarchical structure. It enhances key image regions and contextual dependencies through a series of downsampling and upsampling operations. It progressively applies the triple attention content-aware module and downsamples the input to obtain high-level semantic features, then upsamples to recover fine-grained details, thereby ensuring the refinement of both global and local image features. Furthermore, it utilizes multi-scale input to capture features at different resolutions, which is crucial for processing objects and details of different scales in underwater images. The triple attention content-aware module aims to enhance underwater image features by integrating three attention mechanisms: spatial attention, channel attention, and self-attention. Spatial attention in the triple attention content-aware module is used to identify and enhance important spatial regions; by focusing on these regions, the triple attention branch highlights important features of marine life and underwater structures.
[0018] In the spatial attention, given the input feature mapping F = R H×W×C The process is as follows:
[0019]
[0020] Where σ represents the sigmoid function, f 7×7 This represents a convolution operation with a filter size of 7×7. AvgPool and MaxPool are two cross-channel pooling operations, which are then processed through a spatial mapping M. s ∈R 1×H×W Element-wise multiplication of each channel of F with the spatial feature map F yields the spatial feature map F. s .
[0021] As a preferred technical solution, the channel attention in the triple attention content perception module focuses on the most informative channel, balances the color channels and enhances key features to correct color distortion caused by water absorption and scattering.
[0022] In the channel attention, given the input feature map F, the channel attention vector M c ∈R C Calculated as:
[0023]
[0024] GAP represents global average pooling. It is a convolution operation of a 1×1 filter, where σ and δ represent the sigmoid and ReLU activation functions, respectively; GAP is global average pooling, which puts channel-based global spatial information into the channel:
[0025]
[0026] Where F c (i,j) represents the c-th channel X at position (i,j). c The value of the feature map F involving the channel c It is through element-wise multiplication of F and M c It is obtained by copying in the spatial dimension.
[0027] As a preferred technical solution, the self-attention module in the triple attention content awareness module is used to capture long-distance dependency features and understand the global context;
[0028] In the self-attention framework, given F, the self-attention mapping M... self ∈R HW×HW The calculation is as follows:
[0029]
[0030] Among them, Q s =f Q (F), K s =f K (F) represent the query mapping and key mapping, respectively.Q and f K For linear transformations, T represents the transpose; by applying a self-attention mask M self value mapping V s =f V (F), thus obtaining the self-attention feature map F. self Then, it is further refined through additional deep learning layers.
[0031] As a preferred technical solution, the underwater enhanced image with reasonably distributed color weight information and rich detail texture information is input into the global light restoration branch, and a contrastive learning strategy is used to adjust the global light characteristics of the underwater image to finally obtain the restored underwater image enhancement result, specifically as follows:
[0032] The global light restoration branch simulates image pairs under different lighting conditions, and the network learns robust features to approximate the true solution space of the background light, which is then applied to global correction. Background light estimation is based on an underwater image formation model, which describes the absorption and scattering processes of light propagating in water, thus affecting the color and sharpness of the image. The underwater image formation model is expressed as follows:
[0033] I(x)=J(x)t(x)+A(1-t(x)),
[0034] Where x is the pixel index, I(x) is the scene intrinsic brightness at pixel x, representing the true color and intensity of the scene in clear water or air; A is the global ambient light map with all A values, representing the background light in the water; t(x) is the medium transmittance at pixel x, obtained through transformation:
[0035] A=(I(x)-J(x)t(x)) / (1-t(x)),
[0036] For the i-th distorted underwater image τ i and its truth value τ i ′,Global Background Light A′ i Using the above formula, to generate samples that are significantly different from the true value in terms of background light, the available data τ is first calculated. i Background light and store it in a library In this process, after filtering by the global light filter, a negative sample set is effectively constructed. In the global light filter, each With A′ i The Euclidean distance d between them n Then remove l n Less than the threshold d n The calculation process is as follows:
[0037]
[0038] In the formula, r n g n b n Indicates having the same b m The three RGB dimensions of the value, in In the diagram, r, g, b represent having A′ i The three RGB dimensions of the same a' in the model;
[0039] The specific process of synthesizing negative samples is as follows: given the i-th original underwater image τ i Based on the formula for calculating global ambient light above, the scene brightness map I is calculated. i and medium transmission diagram t i Then by τ i The resulting M negative samples are calculated as follows:
[0040]
[0041] In contrastive learning strategies, ground-truth is used. The anomalous light image Z is used as positive and negative samples, respectively, to recover the global light of the underwater image; the goal of contrastive learning is to learn a representation that clusters "positive" pairs together in the latent feature space and separates the representations between "negative" pairs.
[0042] Secondly, the present invention provides an underwater image enhancement system based on color perception fusion attention and background light removal contrast learning, which is applied to the underwater image enhancement method based on color perception fusion attention and background light removal contrast learning, including a feature information extraction module, a color restoration module, a detail information restoration module, and a global light restoration module;
[0043] The feature information extraction module is used to extract color information from the original underwater image based on the color extraction module designed with color histogram and linear module.
[0044] The color restoration module is used to input the color information into the local color restoration branch to obtain reasonably distributed color weight information;
[0045] The detail information restoration module is used to process the original underwater image through a triple attention branch to restore details and blur information in the image, resulting in an enhanced underwater image rich in detail and texture. The triple attention branch integrates multiple triple attention content-aware modules with jump connections in a U-shape, forming a hierarchical structure. It enhances key image regions and contextual dependencies through a series of downsampling and upsampling operations. The triple attention branch utilizes multi-scale input to capture features at different resolutions, and its output is obtained by combining spatial features, channel features, and self-attention features. Downsampling is used to acquire high-level semantic features, and upsampling is used to restore fine-grained details. The triple attention content-aware module aims to enhance the features of the underwater image by integrating spatial attention, channel attention, and self-attention mechanisms.
[0046] The global light restoration module is used to input the reasonably distributed color weight information and the underwater enhanced image with rich detail and texture information into the global light restoration branch, and to use a contrastive learning strategy to adjust the global light characteristics of the underwater image, so as to finally obtain the restored underwater image enhancement result.
[0047] Thirdly, the present invention provides an electronic device, the electronic device comprising:
[0048] At least one processor; and,
[0049] A memory communicatively connected to the at least one processor; wherein,
[0050] The memory stores computer program instructions that can be executed by the at least one processor to enable the at least one processor to perform the underwater image enhancement method based on color perception fusion attention and background light removal contrast learning.
[0051] Fourthly, the present invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements the underwater image enhancement method based on color perception fusion attention and background light removal contrast learning.
[0052] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0053] (1) The present invention provides a color-based attention branch, which consists of a color extraction module and a local color recovery branch. It uses color histograms and linear modules to extract color information and integrates a self-attention mechanism to obtain reasonably distributed color weight information, so that the network can adaptively correct non-uniform color distortion in degraded images and recover an enhanced image with reasonable and satisfactory color information distribution.
[0054] (2) The triple attention branch provided by this invention combines spatial attention, channel attention, and self-attention mechanisms to enhance feature analysis of key channels, key regions, and global dependencies. This branch can effectively solve problems such as color deviation, blurring, and low contrast in underwater images, and effectively solve the problem of local and global distortion of image content, enabling the network to recover clearer and more detailed enhanced images.
[0055] (32) The global light restoration branch provided by this invention is a novel method that combines global uniform background light information with contrastive learning techniques to reduce the solution space of clean images and promote global color adjustment of underwater images. By generating image pairs simulating different lighting conditions, the model of this invention learns to identify and correct the color deviation between underwater degraded images and natural colors, enabling the network to adapt to complex underwater environments and restore enhanced images unaffected by global light, thus solving the problem of global color deviation caused by global background light. Attached Figure Description
[0056] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0057] Figure 1 This is a flowchart of an underwater image enhancement method based on color perception fusion attention and background light removal contrast learning according to an embodiment of the present invention;
[0058] Figure 2 This is a schematic diagram of an underwater image enhancement network based on color perception fusion attention and background light removal contrast learning according to an embodiment of the present invention;
[0059] Figure 3 This is a schematic diagram of the linear module structure in the color extraction module of this embodiment of the invention;
[0060] Figure 4 This is a schematic diagram of the three attention modules in an embodiment of the present invention;
[0061] Figure 5 This is a comparison chart of the enhancement effects of the present invention and several advanced underwater image enhancement algorithms on a reference dataset;
[0062] Figure 6 This is a comparison chart of the enhancement effects of this invention and several advanced underwater image enhancement algorithms on a no-reference dataset;
[0063] Figure 7This is a schematic diagram of the underwater image enhancement system based on color perception fusion attention and background light removal contrast learning according to an embodiment of the present invention;
[0064] Figure 8 This is a structural diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0065] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative effort are within the scope of protection of the present application.
[0066] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application can be combined with other embodiments.
[0067] Please see Figure 1 This embodiment proposes a nighttime defogging method based on nighttime physical perception and the grayscale world, which includes the following steps:
[0068] S1. A color extraction module based on color histogram and linear module design extracts color information from the original underwater image.
[0069] The color extraction module is designed based on color histograms and linear modules. The calculation process for color histogram extraction can be represented as follows:
[0070] h c (i)=∑ x,y δ(I c (x,y)-i),
[0071] Where h c (i) is the histogram of color channel c in image i, I c (x, y) represents the pixel value of channel c at (x, y), and δ is an indicator function. A histogram is calculated for each color channel (R, G, B) to obtain the color distribution. The histogram is then passed to a linear module, followed by a convolutional layer, to obtain the color-related feature C. The linear module is used for dimension alignment. The structure of the linear module is as follows: Figure 3 As shown.
[0072] Furthermore, the color information is input into the local color recovery branch to obtain reasonably distributed color weight information.
[0073] The local color recovery branch is constructed based on a self-attention mechanism for color information. This self-attention mechanism achieves adaptive adjustment in the following ways:
[0074]
[0075] Where C represents color-related features, K and V are obtained by transforming the input image through a convolutional layer, T represents the transpose, and d k It is the dimension of the key vector; then a series of deep learning layers are applied to the output of the attention operation to generate an adaptive color-corrected map M. LCR =f LCR (I); The color correction map is designed to provide accurate, color-guided weights to enhance the model’s underwater image enhancement capabilities.
[0076] S2. Simultaneously, the original underwater image undergoes a triple attention branch to restore details and blurry information in the image.
[0077] The triple attention branch integrates the triple attention content-aware module with skip connections in a U-shape, forming a hierarchical structure that enhances key image regions and contextual dependencies through a series of downsampling and upsampling operations. It progressively applies the triple attention content-aware module and downsamples the input to obtain high-level semantic features, then upsamples to recover fine-grained details, thus ensuring refinement of both global and local image features. Furthermore, it utilizes multi-scale input to capture features at different resolutions, which is crucial for handling objects and details of varying scales in underwater images. The triple attention content-aware module aims to enhance underwater image features by integrating three attention mechanisms: spatial attention, channel attention, and self-attention.
[0078] The spatial attention module within the triple attention content-aware module is used to identify and enhance important spatial regions, which is crucial for underwater image enhancement due to the uneven lighting and visibility conditions in underwater images. By focusing on important spatial regions, the triple attention branch highlights key features such as marine life and underwater structures, given the input feature mapping F=R. H×W×C The process is as follows:
[0079]
[0080] Where σ represents the sigmoid function, f 7×7 This represents a convolution operation with a filter size of 7×7. AvgPool and MaxPool are two cross-channel pooling operations, which are then processed through a spatial mapping M. s∈R 1×H×W Element-wise multiplication of each channel of F with the spatial feature map F yields the spatial feature map F. s .
[0081] The channel attention module in the triple attention content-aware module focuses on the most informative channels, balances color channels, and enhances key features. This is crucial for correcting color distortion caused by water absorption and scattering. Given an input feature map F, the channel attention vector M... c ∈R C Calculated as:
[0082]
[0083] GAP represents global average pooling. This is a convolution operation on a 1×1 filter, where σ and δ represent the sigmoid and ReLU activation functions, respectively. GAP is global average pooling, which incorporates channel-based global spatial information into each channel.
[0084]
[0085] Where F c (i,j) represents the c-th channel X at position (i,j). c The value of . The feature map F involving the channel. c It is through element-wise multiplication of F and M c It is obtained by copying in the spatial dimension.
[0086] The self-attention module in the triple-attention content-aware module plays a role in capturing long-range dependency features and understanding global context. Given f, the self-attention mapping M self ∈R HW×HW The calculation is as follows:
[0087]
[0088] Among them, Q s =f Q (F), K s =f K (F) represent the query mapping and key mapping, respectively. Q and f K For linear transformations, T represents the transpose; by applying a self-attention mask M self value mapping V s =f V (F), thus obtaining the self-attention feature map F. self Then, it is further refined through additional deep learning layers.
[0089] The final output of the triple-attention content-aware module is obtained by effectively combining spatial features, channel features, and self-attention features. By using a connection between two convolutional layers and a ReLU layer, the channel dimension can be reduced and a fused representation can be learned, thereby improving the overall feature quality.
[0090] S3. Next, the reasonably distributed color weight information and the underwater enhanced image rich in detail and texture information are input into the global light restoration branch. A contrastive learning strategy is used to adjust the global light characteristics of the underwater image, and finally the restored underwater image enhancement result is obtained, such as... Figure 2 As shown.
[0091] The global light restoration branch simulates image pairs under different lighting conditions, and the network learns robust features to approximate the true solution space of the background light, which is then applied to global correction. Background light estimation is based on an underwater image formation model, which describes the absorption and scattering processes of light propagating in water, thus affecting the color and sharpness of the image. The underwater image formation model is expressed as:
[0092] I(x)=J(x)t(x)+A(1-t(x)),
[0093] Where x is the pixel index, I(x) is the scene intrinsic brightness at pixel x, representing the true color and intensity of the scene in clear water or air; A is the global ambient light map with all A values, representing the background light in the water; t(x) is the medium transmittance at pixel x, obtained through transformation:
[0094] A=(I(x)-J(x)t(x)) / (1-t(x)),
[0095] For the i-th distorted underwater image τ i and its truth value τ i ′,Global Background Light A′ i Using the above formula, to generate samples that are significantly different from the true value in terms of background light, the available data τ is first calculated. i Background light and store it in a library In this process, after filtering by the global light filter, a negative sample set is effectively constructed. In the global light filter, each With A′ i The Euclidean distance d between them m Then remove l n Less than the threshold d n The calculation process is as follows:
[0096]
[0097] In the formula, r n g n b n Indicates having the same b m The three RGB dimensions of the value, in In the diagram, r, g, b represent having Ai i The three RGB dimensions of the same a' in the equation.
[0098] The specific process of synthesizing negative samples is as follows: given the i-th original underwater image τ i The scene brightness map I can be calculated based on the formula for calculating global ambient light above. i and medium transmission diagram t i Then, by τ i The resulting M negative samples can be calculated as follows:
[0099]
[0100] In contrastive learning strategies, ground-truth is used. The anomalous light image Z is used as positive and negative samples, respectively, to recover the global light of the underwater image; the goal of contrastive learning is to learn a representation that clusters "positive" pairs together in the latent feature space and separates the representations between "negative" pairs.
[0101] In one embodiment, training is performed on an RTX3090 with a batch size of 8. The Adam optimizer is used during training, and a cosine annealing strategy is employed. In this invention, each image is cropped to a size of 256×256, and the resulting images are used as input to the network for training.
[0102] This embodiment can better address various degradation factors in underwater scenes, such as uneven lighting, color degradation, low brightness, severe loss of detail, and color cast, resulting in underwater enhanced images with rich detail and texture and correct color cast processing. Figure 5 As shown in sections (a) and (b) above, UNTV, USUIR, PUGAN, GDCP, HLRP, UWnet, and MLLE have not been adequately addressed. Figure 5 The greenish distortion in (Figure 4) results in residual color cast. In contrast, this embodiment produces more natural and realistic colors. Figure 5 (Figure 6) further confirms the advantages of this invention in similar scenarios. Furthermore, blue distortion is another common issue, such as... Figure 5As shown in Figure 2, only PUIE-Net, PUGAN, and this embodiment effectively alleviate blue color cast, while GDCP, UNTV, UWnet, USUIR, HLRP, and MLLE perform poorly. Although PUIE-Net and PUGAN correct the blue tint, this embodiment achieves better color recovery in critical areas. In summary, these examples demonstrate the advantages of this embodiment in adaptively correcting various color distortions (such as green and blue casts). Compared to current techniques, this embodiment recovers more natural and vivid colors. In underwater images, forward scattering often causes low contrast and insufficient lighting, requiring enhancement methods to increase color contrast while eliminating blur. Figure 6 As shown in sections (a), (b), and (c), traditional techniques struggle to handle low-contrast images, sometimes introducing distortions like HLRP. Deep learning methods, such as UWnet and USUIR, may not be able to sufficiently improve brightness without introducing color distortion. This embodiment effectively handles low-contrast and low-light images without introducing distortion. Figure 6 As shown, this embodiment performs excellently in detail restoration. The results verify the powerful advantages of this embodiment in adaptively increasing brightness and contrast to restore sharpness, while avoiding human-induced factors such as over-enhancement, color deviation, and detail loss present in current technologies. This embodiment can reliably enhance low-contrast, low-light underwater images. Furthermore, in... Figure 6 (Image 5) In complex, coral-rich scenes, this embodiment demonstrates superior performance. Despite the challenging task of restoring corals with many different colors and depths, this embodiment outperforms other methods. HLRP, MLLE, UNTV, and PUIE-Net inaccurately restore coral colors. UWnet and USUIR struggle to restore red coral hues, while GDCP exhibits over-enhancement, leading to noticeable color deviations. While PUGAN performs quite well, it lacks sharpness in terms of detail. In contrast, the results obtained by BCTA-Net in this embodiment are closest to the ground truth, accurately adjusting colors and preserving the sharpness of corals and background elements.
[0103] Table 1
[0104]
[0105] To more concretely demonstrate the technical effects of this embodiment, as shown in Table 1, which presents the objective evaluation results of the method, Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity (SSIM) are used as evaluation metrics. Red and blue represent the first and second ranked metrics, respectively. Higher metric values indicate that the generated image is closer to a standard clear image. In the table, this embodiment was trained on the UIEB training set and tested on the UIEB test set, and trained on the EUVP training set and tested on the EUVP test set. Its PSNR and SSIM values are significantly higher than other image processing algorithms. As shown in Table 2, which presents the objective evaluation results of the method, single-image metrics UIQM and ILNIQE are used as evaluation metrics. Red and blue represent the first and second ranked metrics, respectively. Higher UIQM or lower ILNIQE indicates better image quality. In the table, this embodiment was trained on the UIEB training set and tested on the UIEB test set, EUVP test set, MABLS dataset, U45 dataset, and SUIM dataset. This embodiment achieves the best UIQM metric on the EUVP, MABLS, and SUIM datasets, and the second best UIQM metric on the UIEB and U45 datasets, demonstrating its superior performance in enhancing key attributes such as color, sharpness, and contrast. Furthermore, in terms of the ILNIQE metric, this embodiment ranks first among learning-based methods on UIEB, EUVP, MABLS, and U45, and second on SUIM, a metric used to measure the perceptual quality of natural images. These combined results validate that the method of this invention reliably outperforms existing techniques, demonstrating consistently excellent performance across different datasets, confirming the effectiveness of this embodiment in improving overall underwater image quality, and showcasing outstanding performance and robustness in image processing.
[0106] Table 2
[0107]
[0108] It should be noted that, for the sake of simplicity, the aforementioned method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously.
[0109] Based on the same ideas as the underwater image enhancement method based on color-perceptual fusion attention and background light removal contrast learning in the above embodiments, the present invention also provides an underwater image enhancement system based on color-perceptual fusion attention and background light removal contrast learning. This system can be used to execute the above-described underwater image enhancement method based on color-perceptual fusion attention and background light removal contrast learning. For ease of explanation, the structural schematic diagram of the embodiment of the underwater image enhancement system based on color-perceptual fusion attention and background light removal contrast learning only shows the parts related to the embodiments of the present invention. Those skilled in the art will understand that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0110] Please see Figure 7 In another embodiment of this application, an underwater image enhancement system 100 based on color perception fusion attention and background light removal contrast learning is provided. The system includes a feature information extraction module 101, a color restoration module 102, a detail information restoration module 103, and a global light restoration module 104.
[0111] The feature information extraction module 101 is used to extract color information from the original underwater image based on the color extraction module designed with color histogram and linear module.
[0112] The color restoration module 102 is used to input the color information into the local color restoration branch to obtain reasonably distributed color weight information;
[0113] The detail information restoration module 103 is used to process the original underwater image through a triple attention branch to restore details and blur information in the image, resulting in an enhanced underwater image rich in detail and texture. The triple attention branch integrates multiple triple attention content-aware modules with jump connections in a U-shape, forming a hierarchical structure. It enhances key image regions and contextual dependencies through a series of downsampling and upsampling operations. The triple attention branch utilizes multi-scale input to capture features at different resolutions, and its output is obtained by combining spatial features, channel features, and self-attention features. Downsampling is used to acquire high-level semantic features, and upsampling is used to restore fine-grained details. The triple attention content-aware module aims to enhance the features of the underwater image by integrating spatial attention, channel attention, and self-attention mechanisms.
[0114] The global light restoration module 104 is used to input the reasonably distributed color weight information and the underwater enhanced image with rich detail and texture information into the global light restoration branch, and to use a contrastive learning strategy to adjust the global light characteristics of the underwater image, so as to finally obtain the restored underwater image enhancement result.
[0115] It should be noted that the underwater image enhancement system based on color perception fusion attention and background light removal contrast learning of the present invention corresponds one-to-one with the underwater image enhancement method based on color perception fusion attention and background light removal contrast learning of the present invention. The technical features and beneficial effects described in the embodiments of the underwater image enhancement method based on color perception fusion attention and background light removal contrast learning are applicable to the embodiments of underwater image enhancement based on color perception fusion attention and background light removal contrast learning. For details, please refer to the description in the embodiments of the method of the present invention, which will not be repeated here.
[0116] Furthermore, in the above embodiments of the underwater image enhancement system based on color perception fusion attention and background light removal contrast learning, the logical division of each program module is only an example. In actual applications, the above functions can be assigned to different program modules as needed, for example, for the sake of corresponding hardware configuration requirements or the convenience of software implementation. That is, the internal structure of the underwater image enhancement system based on color perception fusion attention and background light removal contrast learning is divided into different program modules to complete all or part of the functions described above.
[0117] Please see Figure 8 In one embodiment, an electronic device is provided for implementing an underwater image enhancement method based on color perception fusion attention and background light removal contrast learning. The electronic device 200 may include a first processor 201, a first memory 202 and a bus, and may also include a computer program stored in the first memory 202 and executable on the first processor 201, such as an underwater image enhancement program 203 based on color perception fusion attention and background light removal contrast learning.
[0118] The first memory 202 includes at least one type of readable storage medium, including flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the first memory 202 can be an internal storage unit of the electronic device 200, such as the portable hard drive of the electronic device 200. In other embodiments, the first memory 202 can also be an external storage device of the electronic device 200, such as a plug-in portable hard drive, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device 200. Furthermore, the first memory 202 can include both internal and external storage units of the electronic device 200. The first memory 202 can be used not only to store application software and various types of data installed on the electronic device 200, such as the code of the underwater image enhancement program 203 based on color perception fusion attention and background light separation contrast learning, but also to temporarily store data that has been output or will be output.
[0119] In some embodiments, the first processor 201 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The first processor 201 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the first memory 202 and calls data stored in the first memory 202 to perform various functions of the electronic device 200 and process data.
[0120] Figure 8 Only electronic devices with components are shown; it will be understood by those skilled in the art that... Figure 8 The structure shown does not constitute a limitation on the electronic device 200, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0121] The underwater image enhancement program 203, stored in the first memory 202 of the electronic device 200, based on color perception fusion attention and background light removal contrast learning, is a combination of multiple instructions. When run in the first processor 201, it can achieve the following:
[0122] A color extraction module based on color histograms and linear modules extracts color information from raw underwater images.
[0123] The color information is input into the local color recovery branch to obtain reasonably distributed color weight information;
[0124] The original underwater image is processed through a triple attention branch to restore details and blurry information, resulting in an enhanced underwater image rich in detail and texture. The triple attention branch integrates multiple triple attention content-aware modules in a U-shaped manner with skip connections, forming a hierarchical structure. It enhances key image regions and contextual dependencies through a series of downsampling and upsampling operations. The triple attention branch captures features at different resolutions using multi-scale inputs, and its output is obtained by combining spatial features, channel features, and self-attention features. Downsampling is used to acquire high-level semantic features, and upsampling is used to restore fine-grained details. The triple attention content-aware module aims to enhance the features of the underwater image by integrating spatial attention, channel attention, and self-attention mechanisms.
[0125] The reasonably distributed color weight information and the underwater enhanced image rich in detail and texture information are input into the global light restoration branch. A contrastive learning strategy is used to adjust the global light characteristics of the underwater image, and finally the restored underwater image enhancement result is obtained.
[0126] Furthermore, if the modules / units integrated in the electronic device 200 are implemented as software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0127] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0128] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0129] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
Claims
1. An underwater image enhancement method based on color perception fusion attention and background light-driven contrast learning, characterized in that, Includes the following steps: A color extraction module based on color histograms and linear modules extracts color information from raw underwater images. The color information is input into the local color recovery branch to obtain reasonably distributed color weight information; The original underwater image is processed through a triple attention branch to restore details and blur information, resulting in an enhanced underwater image rich in detail and texture. The triple attention branch integrates multiple triple attention content-aware modules with skip connections in a U-shape, forming a hierarchical structure. It enhances key image regions and contextual dependencies through a series of downsampling and upsampling operations. The triple attention branch captures features at different resolutions using multi-scale inputs, and its output is obtained by combining spatial features, channel features, and self-attention features. Downsampling is used to acquire high-level semantic features, while upsampling is used to recover fine-grained details. The triple attention content-aware module aims to enhance underwater image features by integrating spatial attention, channel attention, and self-attention mechanisms. The triple attention branch integrates the triple attention content awareness module with the jump connection in a U-shape to form a hierarchical structure, which enhances key image regions and contextual dependencies through a series of downsampling and upsampling operations; It ensures the refinement of both global and local features of the image by progressively applying a triple attention content-aware module and downsampling the input to obtain high-level semantic features, followed by upsampling to restore fine-grained details. Furthermore, it utilizes multi-scale input to capture features at different resolutions, which is crucial for processing objects and details of varying scales in underwater images. The triple attention content-aware module aims to enhance the features of underwater images by integrating three attention mechanisms: spatial attention, channel attention, and self-attention. Spatial attention within the triple attention content-aware module is used to identify and enhance important spatial regions; by focusing on these regions, the triple attention branch highlights key features of marine life and underwater structures. The reasonably distributed color weight information and the underwater enhanced image rich in detail and texture information are input into the global light restoration branch. A contrastive learning strategy is used to adjust the global light characteristics of the underwater image, and finally the restored underwater image enhancement result is obtained.
2. The underwater image enhancement method based on color perception fusion attention and background light separation contrast learning according to claim 1, characterized in that, The calculation process by which the color extraction module extracts color information from the original underwater image is represented as follows: h c (i)=∑ x,y δ(I c (x,y)-i), Where h c (i) is the histogram of color channel c in image i, I c (x,y) represents the pixel value of channel c at (x,y), and δ is an indicator function; a histogram is calculated for each color channel (R,G,B) to obtain the color distribution; then the histogram is passed to the linear module, and then through the convolutional layer to obtain the color-related feature C; wherein, the linear module is used for dimension alignment.
3. The underwater image enhancement method based on color perception fusion attention and background light separation contrast learning according to claim 1, characterized in that, The local color recovery branch is constructed based on a self-attention mechanism for color information. This self-attention mechanism achieves adaptive adjustment in the following ways: Where C represents color-related features, K and V are obtained by transforming the input image through convolutional layers, and d k It is the dimension of the key vector; then a series of deep learning layers are applied to the output of the attention operation to generate an adaptive color-corrected map M. LCR =f LCR (I); The color correction map is designed to provide accurate, color-guided weights to enhance the model’s underwater image enhancement capabilities.
4. The underwater image enhancement method based on color perception fusion attention and background light separation contrast learning according to claim 1, characterized in that, In the spatial attention, given the input feature map F∈R H×W×C The process is as follows: Where σ represents the sigmoid function, f 7×7 This represents a convolution operation with a filter size of 7×7. AvgPool and MaxPool are two cross-channel pooling operations, which are then processed through a spatial mapping M. s ∈R 1×H×W Element-wise multiplication of each channel of F with the spatial feature map F yields the spatial feature map F. s .
5. The underwater image enhancement method based on color perception fusion attention and background light separation contrast learning according to claim 1, characterized in that, The channel attention in the triple attention content perception module focuses on the most informative channel, balances the color channel, and enhances key features to correct color distortion caused by water absorption and scattering. In the channel attention, given the input feature map F, the channel attention vector M c ∈R C Calculated as: GAP represents global average pooling. It is a convolution operation of a 1×1 filter, where σ and δ represent the sigmoid and ReLU activation functions, respectively; GAP is global average pooling, which puts channel-based global spatial information into the channel: Where F c (i,j) represents the value of the c-th channel at position (i,j); the feature mapping F in which the channels participate. c It is through element-wise multiplication of F and M c It is obtained by copying in the spatial dimension.
6. The underwater image enhancement method based on color perception fusion attention and background light separation contrast learning according to claim 1, characterized in that, The self-attention module in the triple attention content awareness module is used to capture long-distance dependency features and understand the global context. In the self-attention framework, given F, the self-attention mapping M... self ∈R HW×HW The calculation is as follows: Among them, Q s =f Q (F), K s =f K (F) represent the query mapping and key mapping, respectively. Q and f K For linear transformations, T represents the transpose; by applying a self-attention mask M self value mapping V s =f V (F), thus obtaining the self-attention feature map F. self Then, it is further refined through additional deep learning layers.
7. The underwater image enhancement method based on color perception fusion attention and background light separation contrast learning according to claim 1, characterized in that, The process involves inputting the reasonably distributed color weight information and the underwater enhanced image rich in detail and texture information into the global illumination restoration branch. A contrastive learning strategy is then employed to adjust the global illumination characteristics of the underwater image, ultimately yielding the restored underwater image enhancement result. Specifically: The global light restoration branch simulates image pairs under different lighting conditions, and the network learns robust features to approximate the true solution space of the background light, which is then applied to global correction. Background light estimation is based on an underwater image formation model, which describes the absorption and scattering processes of light propagating in water, thus affecting the color and sharpness of the image. The underwater image formation model is expressed as follows: I(x)=J(x)t(x)+A(1-t(x)), Where x is the pixel index, I(x) is the scene intrinsic brightness at pixel x, representing the true color and intensity of the scene in clear water or air; A is the global ambient light map, representing the background light in the water; t(x) is the medium transmittance at pixel x, obtained through transformation: A=(I(x)-J(x)t(x)) / (1-t(x)), For the i-th distorted underwater image τ i and its truth value τ i ′,Global Background Light A′ i Using the above formula, to generate samples that are significantly different from the true value in terms of background light, the available data τ is first calculated. i Background light and store it in a library In this process, after filtering by the global light filter, a negative sample set is effectively constructed. In the global light filter, each With A′ i The Euclidean distance d between them n Then remove d n Less than the threshold d n The calculation process is as follows: In the formula, r n g n b n Indicates having the same b m The three RGB dimensions of the value, in In the diagram, r, g, b represent having A′ i The three RGB dimensions of the same a' in the model; The specific process of synthesizing negative samples is as follows: given the i-th original underwater image τ i Based on the formula for calculating global ambient light above, the scene brightness map I is calculated. i and medium transmission diagram t i Then by τ i The resulting M negative samples are calculated as follows: In contrastive learning strategies, ground-truth is used. The anomalous light image Z is used as positive and negative samples, respectively, to recover the global light of the underwater image; the goal of contrastive learning is to learn a representation that clusters "positive" pairs together in the latent feature space and separates the representations between "negative" pairs.
8. An underwater image enhancement system based on color perception fusion attention and background light-driven contrast learning, characterized in that, The underwater image enhancement method based on color perception fusion attention and background light removal contrast learning, as described in any one of claims 1-7, includes a feature information extraction module, a color restoration module, a detail information restoration module, and a global light restoration module; The feature information extraction module is used to extract color information from the original underwater image based on the color extraction module designed with color histogram and linear module. The color restoration module is used to input the color information into the local color restoration branch to obtain reasonably distributed color weight information; The detail information restoration module is used to process the original underwater image through a triple attention branch to restore the details and blur information in the image, thereby obtaining an underwater enhanced image rich in detail and texture information. The triple attention branch integrates multiple triple attention content-aware modules with skip connections in a U-shape, forming a hierarchical structure. It enhances key image regions and contextual dependencies through a series of downsampling and upsampling operations. The triple attention branch captures features at different resolutions using multi-scale inputs, and its output is obtained by combining spatial features, channel features, and self-attention features. Downsampling is used to acquire high-level semantic features, while upsampling is used to recover fine-grained details. The triple attention content-aware module aims to enhance underwater image features by integrating spatial attention, channel attention, and self-attention mechanisms. The global light restoration module is used to input the reasonably distributed color weight information and the underwater enhanced image with rich detail and texture information into the global light restoration branch, and to use a contrastive learning strategy to adjust the global light characteristics of the underwater image, so as to finally obtain the restored underwater image enhancement result.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor to enable the at least one processor to perform the underwater image enhancement method based on color perception fusion attention and background light removal contrast learning as described in any one of claims 1-7.
10. A computer-readable storage medium storing a program, characterized in that, When the program is executed by the processor, it implements the underwater image enhancement method based on color perception fusion attention and background light removal contrast learning as described in any one of claims 1-7.
Citation Information
Patent Citations
Deep learning underwater image enhancement method based on embedded multi-feature fusion
CN115034981A
Underwater image enhancement method for efficiently guiding information flow
CN117392032A