An underwater image enhancement method based on degraded codebook perception and negative prototype learning
Patent Information
- Application Number
- CN202610753100.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-28
- Publication Date
- 2026-08-18
AI Technical Summary
[0006]根据上述提出克服对水下图像非均匀复合退化表征不足、退化特征抑制不充分、增强结果中易残留色偏与雾化信息、以及难以兼顾退化去除与细节保持的技术问题,而提供一种基于退化码本感知与负原型学习的水下图像增强方法
本发明通过构建离散退化码本,对水下图像中的颜色偏移、对比度下降、细节模糊、散射雾化及其复合退化进行原型化表示,提高了对复杂退化模式的表征能力;同时,通过引入退化感知对比排斥约束和退化提示调制机制,在增强图像颜色、对比度和细节信息的同时,有效抑制潜在空间中的退化特征残留,并提高对非均匀复合退化的自适应增强能力;
Smart Images

Figure CN122597213A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of digital image processing, computer vision, and underwater image enhancement, and more particularly to an underwater image enhancement method based on degenerate codebook perception and negative prototype learning. Background Technology
[0002] Underwater images are crucial information carriers for ocean exploration, underwater robotic operations, underwater target identification, marine resource development, and marine environmental monitoring. Due to the significant differences in light propagation characteristics between water and air, underwater images are easily affected by various factors during imaging, including light absorption, light scattering, uneven distribution of suspended particles in the water, complex lighting conditions, and limitations of imaging equipment. This results in degradation phenomena such as color distortion, decreased contrast, blurred details, enhanced fogging, and uneven local visibility. These degradation phenomena often exhibit spatially non-uniform distribution within the same image, and different degradation factors are coupled with each other, making underwater image enhancement significantly more difficult than enhancing images of ordinary natural scenes.
[0003] Existing underwater image enhancement methods mainly include those based on physical imaging models, those based on image priors, and those based on deep learning. Physical imaging model-based methods typically correct degraded images by estimating transmittance, background light, or attenuation coefficients. While offering some interpretability, they are sensitive to water type, shooting depth, and lighting conditions, and their stability is limited in complex real-world scenarios. Image prior-based methods typically utilize color distribution, dark channels, contrast information, or color compensation rules for enhancement. The computational process is relatively simple, but they are prone to overcorrection, local distortion, or insufficient detail recovery in cases of compound or non-uniform degradation. Deep learning-based methods learn the mapping relationship from degraded to enhanced images through a large number of samples, achieving significant progress in enhancement effects. However, most existing methods focus on directly learning global mapping relationships and lack explicit modeling of complex underwater degradation patterns.
[0004] Furthermore, underwater image degradation is often not caused by a single factor, but rather by a complex degradation process resulting from the combined effects of light absorption, scattering, color cast, blurring, and environmental differences. For such complex degradation, using only a single enhancement target for overall restoration can easily lead to the network mixing different degradation factors into indistinguishable implicit perturbations during training, resulting in noticeable degradation traces remaining in the restored result, or damaging the original structure and texture information when removing certain types of degradation. Existing discrete representation or codebook learning methods primarily focus on clean image prototype modeling, achieving restoration by bringing degraded image features closer to a clean prototype space. However, in underwater image scenarios, due to the significant uncertainties in water type, imaging conditions, and color appearance, there is no single standard "clean" solution for the enhancement result. Simply forcibly aligning degraded image features to a single clean prototype space can easily limit the restoration results, making it difficult to simultaneously suppress complex degradation and preserve content details.
[0005] Therefore, how to construct an underwater image enhancement method that can effectively characterize degradation patterns, suppress degradation residues, and adaptively modulate the enhancement process, targeting the spatially non-uniform and complexly coupled degradation characteristics of underwater images, has become a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0006] To overcome the aforementioned technical problems of insufficient representation of non-uniform composite degradation in underwater images, inadequate suppression of degradation features, residual color shift and haze information in the enhancement results, and difficulty in balancing degradation removal and detail preservation, this invention provides an underwater image enhancement method based on degradation codebook perception and negative prototype learning. This invention addresses the composite degradation in underwater images caused by factors such as light absorption, light scattering, color shift, contrast reduction, and local detail blurring. It proposes learning and representing different degradation patterns using a discrete degradation codebook, and combining negative prototype exclusion constraints and degradation cue modulation mechanisms during the enhancement process. This allows the network to effectively suppress residual degradation patterns in the latent space while restoring image color and structural information, thereby improving the stability, adaptability, and perceptual usability of image enhancement in complex underwater scenes.
[0007] The technical means employed in this invention are as follows:
[0008] An underwater image enhancement method based on degenerate codebook perception and negative prototype learning includes the following steps: Step S01: Input the original underwater image, extract the latent features corresponding to the original underwater image through an encoding network, and map the latent features into a preset embedding space to obtain the latent feature representation. ; Step S02: Based on the latent feature representation Constructing a discrete degenerate codebook And represent the latent features The discrete degenerate codebook is then matched with each codeword in the discrete degenerate codebook to its nearest neighbor. The discrete degenerate codebook is then optimized through image reconstruction training, enabling it to characterize different degradation modes in the original underwater image. for: ; in, Indicates the total number of codewords. Indicates the first Each code character Indicates the codeword embedding dimension; Step S03: Input the underwater image to be enhanced. Input the underwater image to be enhanced into the encoding module of the enhancement network to obtain its enhancement potential features. Then, perform nearest neighbor matching on the enhancement potential features through the discrete degenerate codebook obtained in step S02 to obtain the degenerate index map. Step S04: Based on the degenerate index map and discrete degenerate codebook obtained in step S03, construct a degenerate-aware contrastive exclusion constraint and keep the enhanced latent features away from the corresponding degenerate prototypes in the discrete degenerate codebook. Step S05: Perform frequency statistics on the degradation index map obtained in step S03, determine the dominant degradation mode in the underwater image to be enhanced, and extract the corresponding codeword from the discrete degradation codebook according to the dominant degradation mode to generate degradation prompt features. Step S06: Inject the degradation cue features obtained in step S05 into the decoding module of the enhancement network, perform adaptive modulation on the decoding and recovery process, and output the enhanced underwater image.
[0009] Furthermore, the pre-training process for constructing the degenerate codebook in step S02 includes the following steps: First, the original underwater image Input the encoding network to obtain its latent feature representation. for: ; in, Represents the coding network, Represents the original underwater image. This represents the latent feature representation of the input image in the embedding space; Latent feature representation of the input image in the embedding space any spatial location Distance matching is performed between the codewords in the discrete degenerate codebook, and the index of the codeword with the smallest distance is selected. for: ; The quantization features are obtained based on the codeword index. for: ; quantified latent features The input is processed by a decoding network to reconstruct the image. The expression is: ; in, Indicates the decoding network. Represents the reconstructed image; Based on the original underwater images With reconstructed image Constructing Reconstruction Loss The expression is: ; Based on the latent features before quantification With quantified latent features Constructing Quantized Constraint Loss The expression is: ; in, This indicates that the gradient operation is stopped. Indicate the quantization constraint weights; the reconstruction loss With quantization constraint loss After joint optimization, a discrete degradation codebook is obtained to characterize different underwater degradation modes.
[0010] Furthermore, in step S03, the discrete degenerate codebook obtained through pre-training is used to perform nearest neighbor matching on the latent features of the input underwater image, including the following steps: First, input the underwater image. Inputting the augmented network encoder yields the corresponding latent feature representations. The expression is: ; in, This represents the encoder in the augmented network. This indicates that the input is an underwater image. Representing the latent feature representation corresponding to the input underwater image; representing the latent feature representation corresponding to the input underwater image Mapping to the same embedding space as the discrete degenerate codebook yields the embedding features. The expression is: ; in, Represents the feature mapping function. The embedded features are represented by the mapped features; let the discrete degenerate codebook obtained from pre-training be... Then for embedded features any spatial location Calculate the distance between it and each codeword to obtain the discrete index corresponding to the current position. for: ; in, Indicates position The corresponding degradation index is used to obtain the position. Quantitative features at the location for: ; Degenerate index of all spatial locations Constructing a Degradation Index Map The degradation index map is used to characterize the distribution of degradation patterns of the input underwater image at different spatial locations; the corresponding quantization feature set constitutes the quantization feature map. The quantized feature map serves as the input basis for subsequent degradation perception constraints and degradation cue modulation.
[0011] Furthermore, the degenerate perceptual contrast repulsion constraint in step S04 is composed of a perceptual contrast term and a negative prototype repulsion term, then the total loss function... for: ; in, Indicates a perceptual contrast item. This represents the negative prototype exclusion term. This represents the weighting coefficient of the negative prototype exclusion term. This indicates the enhanced image. Indicates a reference image. This represents a degraded input image. This represents the latent features of the input image in the embedding space. This represents a degenerate index graph. Represents a discrete degenerate codebook; the perceptual comparison term Constraint-enhanced result images in perceptual feature space To reference image Approach and degrade input image Separate; first, enhance the resulting image. Reference image and degraded input images Input the pre-trained perceptual feature extraction network respectively ( ), thus obtaining the corresponding multilayer perceptual features. , and Then the perceptual contrast term is represented as: ; in, Indicates the index of the perceptual feature layer. This indicates the number of perceptual feature layers selected. Indicates the first Weights of layer-aware features This represents a constant to prevent the denominator from being zero; the degradation-sensory contrast exclusion constraint is achieved through the sensing contrast term. The constraint enhancement results move closer to the reference image, while simultaneously using the negative prototype repulsion term. By constraining latent features away from the degenerate prototype, degradation suppression and content preservation can be achieved simultaneously during image restoration.
[0012] Furthermore, the negative prototype repulsion term in step S04 This is used to constrain the latent features of the input image in the embedding space from the degenerate index map. The corresponding degenerate prototype is first determined according to the degeneracy index diagram. From discrete degenerate codebook Extract the degenerate prototype features corresponding to each spatial location. The expression is: ; in, Represents the lookup mapping function for discrete degenerate codebooks. Indicates position Degenerate index at the location, ) indicates position The corresponding degenerate prototype features; the latent features of the input image in the embedding space. Corresponding degenerate prototype features Normalization was performed to obtain the normalized latent features. and normalized degenerate prototype features The expression is: ; ; The location is calculated based on the normalized latent features and the normalized degenerate prototype features. Similarity at location The expression is: ; in, Indicates position Cosine similarity between latent features and their corresponding degenerate prototypes; similarity across all spatial locations. Sort the results in descending order and select the results with the highest similarity. These locations constitute a set of highly similar locations. Alternatively, select the positions with the highest similarity from the previous preset proportions to form a set of highly similar positions. The negative prototype exclusion term Represented as: ; in, Represents the set of highly similar locations The number of positions in the middle, The similarity interval threshold is represented by the negative prototype exclusion term. By applying exclusion constraints only to spatial locations where latent features are highly similar to the degenerate prototype, latent representations in the input image that are highly aligned with the degenerate pattern are preferentially suppressed.
[0013] Furthermore, the generation of the degradation hint vector in step S05 includes the following steps: Step S051: Analyze the degradation index map obtained in step S03. Frequency statistics are performed to calculate the number of times each codeword in the discrete degenerate codebook appears in the current input image. Let the total number of codewords in the discrete degenerate codebook be... Then the first Frequency of occurrence of each code character for: ; in, This represents an indicator function, which takes the value 1 when the condition inside the parentheses is true, and takes the value 0 otherwise. Indicates the location of the degenerate index map The corresponding discrete index. Indicates the first The frequency of occurrence of each codeword in the current input image; Step S052: Based on the frequency of occurrence of each codeword Sort them in descending order and select the ones with the highest frequency. Each codeword is the dominant degenerate codeword set. Its expression is: ; in, Indicates the dominant degenerate codeword set, Indicates the number of dominant degenerate codewords; Step S053: For the dominant degenerate codeword set The frequency of each codeword is normalized to obtain its corresponding frequency weight. Its expression is: ; in, Indicates the first Normalized frequency weights of dominant degenerate codewords This represents a constant to prevent the denominator from being zero; Step S054: Based on the dominant degenerate codeword set Normalized frequency weights corresponding to each codeword For the corresponding codeword in the discrete degenerate codebook We perform a weighted summation to obtain the degradation hint vector. Its expression is: ; And satisfy: ; in, Indicates the first in the discrete degenerate codebook Each code character The degradation cue vector represents the dominant degradation pattern in the current input image and serves as the input for subsequent cue feature mapping and bottleneck modulation.
[0014] Furthermore, the process of mapping the degraded cue vector to cue features and injecting them into the bottleneck decoding features of the enhancement network in step S05 includes the following steps: The degradation hint vector obtained in step S054 Input a linear mapping layer to obtain a low-dimensional cue representation. Its expression is: ; in, Represents a linear mapping matrix. Indicates the bias term. This indicates a low-dimensional hint representation; Representing low-dimensional hints Expanded to spatial cue features consistent with the spatial resolution of the bottleneck decoding features in the enhanced network The cue features are obtained after convolutional mapping. Its expression is: ; ; in, Indicates an extension operation. This represents the convolution mapping operation. Indicates a prompt feature; The prompt feature Decoding features at enhanced network bottleneck locations Feature concatenation is performed to obtain fused features. Its expression is: ; in, This indicates a feature concatenation operation. Indicates bottleneck decoding features. Indicates fusion characteristics; For the fusion features Perform convolution mapping to generate modulation residuals Its expression is: ; in, Represents the fusion mapping function, This represents the modulation residual generated jointly by the degradation cue vector and the bottleneck decoding features; The modulation residual Applying residual injection to bottleneck decoding features Obtain the modulated bottleneck decoding features Its expression is: ; in, Indicates the learnable modulation coefficients. The modulated bottleneck decoding features are represented; the modulated bottleneck decoding features are represented. As input for subsequent decoding and recovery, the image enhancement process is adaptively adjusted according to the dominant degradation mode of the current input image.
[0015] Compared with the prior art, the present invention has the following advantages: This invention constructs a discrete degradation codebook to prototype the color shift, contrast reduction, detail blurring, scattering fogging, and their combined degradation in underwater images, thereby improving the ability to represent complex degradation patterns. At the same time, by introducing degradation-aware contrast rejection constraints and degradation-cue modulation mechanisms, it effectively suppresses residual degradation features in the latent space while enhancing image color, contrast, and detail information, and improves the adaptive enhancement capability for non-uniform combined degradation. Based on the above technical solution, the present invention can obtain enhanced results with more natural colors, clearer structures and higher perception usability, and can be widely applied in fields such as underwater detection, underwater robot vision, underwater target recognition, marine resource surveying and marine environmental monitoring. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic flowchart illustrating the principle of the present invention.
[0018] Figure 2 This is a comparison image showing the enhancement effects of this invention and other algorithms on the first test underwater image. Figure 2-1 This represents the original image. Figure 2-2 This is a graph showing the results of the WaterNet algorithm. Figure 2-3 This is a graph showing the results of the Ucolor algorithm. Figure 2-4 This is a diagram showing the result of the Ushape algorithm. Figure 2 -5 represents the result graph of the UDNet algorithm. Figure 2 -6 represents the result diagram of the method of the present invention.
[0019] Figure 3 This is a comparison image showing the enhancement effects of this invention and other algorithms on the second test underwater image. Figure 3-1 This represents the original image. Figure 3-2 This is a graph showing the results of the WaterNet algorithm. Figure 3-3 This is a graph showing the results of the Ucolor algorithm. Figure 3-4 This is a diagram showing the result of the Ushape algorithm. Figure 3 -5 represents the result graph of the UDNet algorithm. Figure 3 -6 represents the result diagram of the method of the present invention.
[0020] Figure 4 This is a comparison image showing the enhancement effects of this invention and other algorithms on the third test underwater image. Figure 4-1 This represents the original image. Figure 4-2 This is a graph showing the results of the WaterNet algorithm. Figure 4-3 This is a graph showing the results of the Ucolor algorithm. Figure 4-4 This is a diagram showing the result of the Ushape algorithm. Figure 4 -5 represents the result graph of the UDNet algorithm. Figure 4 -6 represents the result diagram of the method of the present invention. Detailed Implementation
[0021] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0023] like Figure 1 As shown, this invention provides an underwater image enhancement method based on degenerate codebook perception and negative prototype learning, comprising the following steps: Step S01: Input the original underwater image, extract the latent features corresponding to the original underwater image through an encoding network, and map the latent features into a preset embedding space to obtain the latent feature representation. ; Step S02: Based on the latent feature representation Constructing a discrete degenerate codebook And represent the latent features The discrete degenerate codebook is then matched with each codeword in the discrete degenerate codebook to its nearest neighbor. The discrete degenerate codebook is then optimized through image reconstruction training, enabling it to characterize different degradation modes in the original underwater image. for: ; in, Indicates the total number of codewords. Indicates the first Each code character The codeword embedding dimension is represented; the pre-training process for constructing the degenerate codebook in step S02 includes the following steps: First, the original underwater image Input the encoding network to obtain its latent feature representation. for: ; in, Represents the coding network, Represents the original underwater image. This represents the latent feature representation of the input image in the embedding space; Latent feature representation of the input image in the embedding space any spatial location Distance matching is performed between the codewords in the discrete degenerate codebook, and the index of the codeword with the smallest distance is selected. for: ; The quantization features are obtained based on the codeword index. for: ; quantified latent features The input is processed by a decoding network to reconstruct the image. The expression is: ; in, Indicates the decoding network. Represents the reconstructed image; Based on the original underwater images With reconstructed image Constructing Reconstruction Loss The expression is: ; Based on the latent features before quantification With quantified latent features Constructing Quantized Constraint Loss The expression is: ; in, This indicates that the gradient operation is stopped. Indicate the quantization constraint weights; the reconstruction loss With quantization constraint loss After joint optimization, a discrete degradation codebook is obtained to characterize different underwater degradation modes.
[0024] Step S03: Input the underwater image to be enhanced. Both the underwater image to be enhanced and the original underwater image in step S01 are underwater degraded images. The original underwater image is used for pre-training of the discrete degraded codebook, and the underwater image to be enhanced is used for image enhancement. Input the underwater image to be enhanced into the encoding module of the enhancement network to obtain its enhancement latent features. Then, perform nearest neighbor matching on the enhancement latent features using the discrete degraded codebook obtained in step S02 to obtain a degraded index map. Step S03, which uses the pre-trained discrete degraded codebook to perform nearest neighbor matching on the latent features of the input underwater image, includes the following steps: First, input the underwater image. Inputting the augmented network encoder yields the corresponding latent feature representations. The expression is: ; in, This represents the encoder in the augmented network. This indicates that the input is an underwater image. Representing the latent feature representation corresponding to the input underwater image; representing the latent feature representation corresponding to the input underwater image Mapping to the same embedding space as the discrete degenerate codebook yields the embedding features. The expression is: ; in, Represents the feature mapping function. The embedded features are represented by the mapped features; let the discrete degenerate codebook obtained from pre-training be... Then for embedded features any spatial location Calculate the distance between it and each codeword to obtain the discrete index corresponding to the current position. for: ; in, Indicates position The corresponding degradation index is used to obtain the position. Quantitative features at the location for: ; Degenerate index of all spatial locations Constructing a Degradation Index Map The degradation index map is used to characterize the distribution of degradation patterns of the input underwater image at different spatial locations; the corresponding quantization feature set constitutes the quantization feature map. The quantized feature map serves as the input basis for subsequent degradation perception constraints and degradation cue modulation.
[0025] Step S04: Based on the degenerate index map and discrete degenerate codebook obtained in step S03, construct a degenerate-aware contrastive exclusion constraint, and keep the enhanced latent features away from the corresponding degenerate prototypes in the discrete degenerate codebook; the degenerate-aware contrastive exclusion constraint in step S04 is composed of a perception contrastive term and a negative prototype exclusion term, then the total loss function... for: ; in, Indicates a perceptual contrast item. This represents the negative prototype exclusion term. This represents the weighting coefficient of the negative prototype exclusion term. This indicates the enhanced image. Indicates a reference image. This represents a degraded input image. This represents the latent features of the input image in the embedding space. This represents a degenerate index graph. Represents a discrete degenerate codebook; the perceptual comparison term Constraint-enhanced result images in perceptual feature space To reference image Approach and degrade input image Separate; first, enhance the resulting image. Reference image and degraded input images Input the pre-trained perceptual feature extraction network respectively ( ), thus obtaining the corresponding multilayer perceptual features. , and Then the perceptual contrast term is represented as: ; in, Indicates the index of the perceptual feature layer. This indicates the number of perceptual feature layers selected. Indicates the first Weights of layer-aware features This represents a constant to prevent the denominator from being zero; the degradation-sensory contrast exclusion constraint is achieved through the sensing contrast term. The constraint enhancement results move closer to the reference image, while simultaneously using the negative prototype repulsion term. By constraining latent features away from the degenerate prototype, degradation suppression and content preservation can be achieved simultaneously during image restoration.
[0026] Furthermore, the negative prototype repulsion term in step S04 This is used to constrain the latent features of the input image in the embedding space from the degenerate index map. The corresponding degenerate prototype is first determined according to the degeneracy index diagram. From discrete degenerate codebook Extract the degenerate prototype features corresponding to each spatial location. The expression is: ; in, Represents the lookup mapping function for discrete degenerate codebooks. Indicates position Degenerate index at the location, ) indicates position The corresponding degenerate prototype features; the latent features of the input image in the embedding space. Corresponding degenerate prototype features Normalization was performed to obtain the normalized latent features. and normalized degenerate prototype features The expression is: ; ; The location is calculated based on the normalized latent features and the normalized degenerate prototype features. Similarity at location The expression is: ; in, Indicates position Cosine similarity between latent features and their corresponding degenerate prototypes; similarity across all spatial locations. Sort the results in descending order and select the results with the highest similarity. These locations constitute a set of highly similar locations. Alternatively, select the positions with the highest similarity from the previous preset proportions to form a set of highly similar positions. The negative prototype exclusion term Represented as: ; in, Represents the set of highly similar locations The number of positions in the middle, The similarity interval threshold is represented by the negative prototype exclusion term. By applying exclusion constraints only to spatial locations where latent features are highly similar to the degenerate prototype, latent representations in the input image that are highly aligned with the degenerate pattern are preferentially suppressed.
[0027] Step S05: Perform frequency statistics on the degradation index map obtained in step S03 to determine the dominant degradation mode in the underwater image to be enhanced, and extract the corresponding codewords from the discrete degradation codebook according to the dominant degradation mode to generate degradation cue features; the generation of degradation cue vector in step S05 includes the following steps: Step S051: Analyze the degradation index map obtained in step S03. Frequency statistics are performed to calculate the number of times each codeword in the discrete degenerate codebook appears in the current input image. Let the total number of codewords in the discrete degenerate codebook be... Then the first Frequency of occurrence of each code character for: ; in, This represents an indicator function, which takes the value 1 when the condition inside the parentheses is true, and takes the value 0 otherwise. Indicates the location of the degenerate index map The corresponding discrete index. Indicates the first The frequency of occurrence of each codeword in the current input image; Step S052: Based on the frequency of occurrence of each codeword Sort them in descending order and select the ones with the highest frequency. Each codeword is the dominant degenerate codeword set. Its expression is: ; in, Indicates the dominant degenerate codeword set, Indicates the number of dominant degenerate codewords; Step S053: For the dominant degenerate codeword set The frequency of each codeword is normalized to obtain its corresponding frequency weight. Its expression is: ; in, Indicates the first Normalized frequency weights of dominant degenerate codewords This represents a constant to prevent the denominator from being zero; Step S054: Based on the dominant degenerate codeword set Normalized frequency weights corresponding to each codeword For the corresponding codeword in the discrete degenerate codebook We perform a weighted summation to obtain the degradation hint vector. Its expression is: ; And satisfy: ; in, Indicates the first in the discrete degenerate codebook Each code character The degradation cue vector represents the dominant degradation pattern in the current input image and serves as the input for subsequent cue feature mapping and bottleneck modulation.
[0028] Furthermore, the process of mapping the degraded cue vector to cue features and injecting them into the bottleneck decoding features of the enhancement network in step S05 includes the following steps: The degradation hint vector obtained in step S054 Input a linear mapping layer to obtain a low-dimensional cue representation. Its expression is: ; in, Represents a linear mapping matrix. Indicates the bias term. This indicates a low-dimensional hint representation; Representing low-dimensional hints Expanded to spatial cue features consistent with the spatial resolution of the bottleneck decoding features in the enhanced network The cue features are obtained after convolutional mapping. Its expression is: ; ; in, Indicates an extension operation. This represents the convolution mapping operation. Indicates a prompt feature; The prompt feature Decoding features at enhanced network bottleneck locations Feature concatenation is performed to obtain fused features. Its expression is: ; in, This indicates a feature concatenation operation. Indicates bottleneck decoding features. Indicates fusion characteristics; For the fusion features Perform convolution mapping to generate modulation residuals Its expression is: ; in, Represents the fusion mapping function, This represents the modulation residual generated jointly by the degradation cue vector and the bottleneck decoding features; The modulation residual Applying residual injection to bottleneck decoding features Obtain the modulated bottleneck decoding features Its expression is: ; in, Indicates the learnable modulation coefficients. The modulated bottleneck decoding features are represented; the modulated bottleneck decoding features are represented. As input for subsequent decoding and recovery, the image enhancement process is adaptively adjusted according to the dominant degradation mode of the current input image.
[0029] Step S06: Inject the degradation cue features obtained in step S05 into the decoding module of the enhancement network, perform adaptive modulation on the decoding and recovery process, and output the enhanced underwater image.
[0030] Example 1 like Figure 2 As shown, Figure 2-1 This is the original image. Figure 2-2 The result of WaterNet algorithm processing. Figure 2-3 The result of the Ucolor algorithm processing. Figure 2-4 The result of the Ushape algorithm processing. Figure 2 -5 represents the result of the UDNet algorithm processing. Figure 2 -6 represents the processing result of the method of this invention. Figure 2 As can be seen, the original image suffers from some color cast and insufficient visibility. While the WaterNet method enhances the image, the overall tone remains dark. The Ucolor and Ushape methods improve brightness and color, but there is still room for improvement in the naturalness of color and the representation of tonal gradation in local areas. The image enhanced by the UDNet method exhibits a noticeable color cast. In contrast, the image processed by the method of this invention has a more natural overall color, a more balanced color distribution in the background water, and clearer details in the target outline and seaweed area, with the enhancement effect more consistent with natural visual perception.
[0031] like Figure 3 As shown, Figure 3-1 This is the original image. Figure 3-2 The result of WaterNet algorithm processing. Figure 3-3 The result of the Ucolor algorithm processing. Figure 3-4 The result of the Ushape algorithm processing. Figure 3 -5 represents the result of the UDNet algorithm processing. Figure 3 -6 represents the processing result of the method of this invention. Figure 3 As can be seen, the original image is predominantly blue-green, and the sculpture and background areas lack depth. While WaterNet, Ucolor, and Ushape methods all improve image brightness and visibility to some extent, differences remain in local color balance, subject edge sharpness, and background transition. Although the UDNet method adjusts the overall color, the image structure and naturalness are only average. In contrast, the method of this invention better balances the overall color and contrast of the image, making the edge structure of the foreground sculpture clearer, the background transition more natural, and the overall image depth stronger.
[0032] like Figure 4 As shown, Figure 4-1 This is the original image. Figure 4-2 The result of WaterNet algorithm processing. Figure 4-3 The result of the Ucolor algorithm processing. Figure 4-4 The result of the Ushape algorithm processing. Figure 4 -5 represents the result of the UDNet algorithm processing. Figure 4 -6 represents the processing result of the method of this invention. Figure 4 As can be seen, the original image exhibits a noticeable blue cast, and the visual distinction between the target area and the background area is limited. WaterNet, Ucolor, and Ushape methods enhance the image to varying degrees, but still fall short in terms of color naturalness and local detail recovery; the image processed by the UDNet method shows a significant green cast. In contrast, the method of this invention effectively reduces the color cast while maintaining stable overall image brightness, making the texture and edge details of the target subject clearer, the background color more natural, and the overall visual effect better.
[0033] To avoid bias caused by relying solely on subjective observation, this embodiment uses three metrics—PSNR, SSIM, and UCIQE—to quantitatively evaluate the processing results of different methods. Table 1 shows the PSNR comparison results of the present invention and the comparative method on three test images; Table 2 shows the SSIM comparison results of the present invention and the comparative method on three test images; and Table 3 shows the UCIQE comparison results of the present invention and the comparative method on three test images. As can be seen from Table 1, in… Figure 2 , Figure 3 and Figure 4On the test images shown, the PSNR of the method of this invention are 26.483, 30.287, and 30.816, respectively, all higher than those of the WaterNet, Ucolor, Ushape, and UDNet methods, indicating that the method of this invention has superior performance in terms of pixel fidelity. Table 2 shows that the SSIM of the method of this invention are 0.971, 0.978, and 0.916, respectively, all the highest values among the methods, indicating that the method of this invention has good effect in preserving image structure. Table 3 shows that the UCIQE of the method of this invention are 0.709, 0.678, and 0.675, respectively, also better than the comparison methods, indicating that the method of this invention has higher visual quality in terms of overall color, contrast, and sharpness of underwater images.
[0034] comprehensive Figures 2-4 As can be seen from Tables 1 to 3, the method of the present invention can improve the naturalness of underwater image colors, overall contrast and clarity of local details while maintaining image structure information well. Furthermore, it achieves better results than the comparison method in three indicators: PSNR, SSIM and UCIQE, indicating that the method of the present invention has a better enhancement effect on complex underwater scene images.
[0035] Table 1. Comparison of PSNR between the algorithm of this invention and other algorithms.
[0036] Table 2. Comparison of SSIM results between the algorithm of this invention and other algorithms.
[0037] Table 3. Comparison of UCIQE results between the algorithm of this invention and other algorithms.
[0038] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. In the above embodiments of the present invention, the descriptions of each embodiment have their own emphasis; parts not described in detail in a certain embodiment can be referred to in the relevant descriptions of other embodiments. It should be understood that the disclosed technical content in the several embodiments provided in this application can be implemented in other ways.
[0039] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An underwater image enhancement method based on degenerate codebook perception and negative prototype learning, characterized in that, Includes the following steps: Step S01: Input the original underwater image, extract the latent features corresponding to the original underwater image through an encoding network, and map the latent features into a preset embedding space to obtain the latent feature representation. ; Step S02: Based on the latent feature representation Constructing a discrete degenerate codebook And represent the latent features The discrete degenerate codebook is then used for nearest neighbor matching with each codeword in the discrete degenerate codebook. This optimization is achieved through image reconstruction training, enabling the discrete degenerate codebook to characterize different degradation modes in the original underwater image. for: ; in, Indicates the total number of codewords. Indicates the first Each code character Indicates the codeword embedding dimension; Step S03: Input the underwater image to be enhanced. Input the underwater image to be enhanced into the encoding module of the enhancement network to obtain its enhancement potential features. Then, perform nearest neighbor matching on the enhancement potential features through the discrete degenerate codebook obtained in step S02 to obtain the degenerate index map. Step S04: Based on the degenerate index map and discrete degenerate codebook obtained in step S03, construct a degenerate-aware contrastive exclusion constraint and keep the enhanced latent features away from the corresponding degenerate prototypes in the discrete degenerate codebook. Step S05: Perform frequency statistics on the degradation index map obtained in step S03, determine the dominant degradation mode in the underwater image to be enhanced, and extract the corresponding codeword from the discrete degradation codebook according to the dominant degradation mode to generate degradation prompt features. Step S06: Inject the degradation cue features obtained in step S05 into the decoding module of the enhancement network, perform adaptive modulation on the decoding and recovery process, and output the enhanced underwater image.
2. The underwater image enhancement method based on degenerate codebook perception and negative prototype learning according to claim 1, characterized in that: The pre-training process for constructing the degenerate codebook in step S02 includes the following steps: First, the original underwater image Inputting the input into the encoding network yields its latent feature representation. for: ; in, Represents the coding network, Represents the original underwater image. This represents the latent feature representation of the input image in the embedding space; Latent feature representation of the input image in the embedding space any spatial location Distance matching is performed between the codewords in the discrete degenerate codebook, and the index of the codeword with the smallest distance is selected. for: ; The quantization features are obtained based on the codeword index. for: ; quantified latent features The input is processed by a decoding network to reconstruct the image. The expression is: ; in, Indicates the decoding network. Represents the reconstructed image; Based on the original underwater images With reconstructed image Constructing Reconstruction Loss The expression is: ; Based on the latent features before quantification With quantified latent features Constructing Quantized Constraint Loss The expression is: ; in, This indicates that the gradient operation is stopped. Indicate the quantization constraint weights; the reconstruction loss With quantization constraint loss After joint optimization, a discrete degradation codebook is obtained to characterize different underwater degradation modes.
3. The underwater image enhancement method based on degenerate codebook perception and negative prototype learning according to claim 1, characterized in that: Step S03 involves using the pre-trained discrete degenerate codebook to perform nearest neighbor matching on the latent features of the input underwater image, including the following steps: First, input the underwater image. Inputting the augmented network encoder yields the corresponding latent feature representations. The expression is: ; in, This represents the encoder in the augmented network. This indicates that the input is an underwater image. Representing the latent feature representation corresponding to the input underwater image; representing the latent feature representation corresponding to the input underwater image Mapping to the same embedding space as the discrete degenerate codebook yields the embedding features. The expression is: ; in, Represents the feature mapping function. The embedded features are represented by the mapped features; let the discrete degenerate codebook obtained from pre-training be... Then for embedded features any spatial location Calculate the distance between it and each codeword to obtain the discrete index corresponding to the current position. for: ; in, Indicates position The corresponding degradation index is used to obtain the position. Quantitative features at the location for: ; Degenerate index of all spatial locations Constructing a Degradation Index Map The degradation index map is used to characterize the distribution of degradation patterns of the input underwater image at different spatial locations; the corresponding quantization feature set constitutes the quantization feature map. The quantized feature map serves as the input basis for subsequent degradation perception constraints and degradation cue modulation.
4. The underwater image enhancement method based on degenerate codebook perception and negative prototype learning according to claim 1, characterized in that: The degenerate perceptual contrast rejection constraint in step S04 is composed of a perceptual contrast term and a negative prototype rejection term, then the total loss function... for: ; in, Indicates a perceptual contrast item. This represents the negative prototype exclusion term. This represents the weighting coefficient of the negative prototype exclusion term. This indicates the enhanced image. Indicates a reference image. This represents a degraded input image. This represents the latent features of the input image in the embedding space. This represents a degenerate index graph. Represents a discrete degenerate codebook; the perceptual comparison term Constraint-enhanced result images in perceptual feature space To reference image Approach and degrade input image Separate; first, enhance the resulting image. Reference image and degraded input images Input the pre-trained perceptual feature extraction network respectively ( ), thus obtaining the corresponding multilayer perceptual features. , and Then the perceptual contrast term is represented as: ; in, Indicates the index of the perceptual feature layer. This indicates the number of perceptual feature layers selected. Indicates the first Weights of layer-aware features This represents a constant to prevent the denominator from being zero; the degradation-sensory contrast exclusion constraint is achieved through the sensing contrast term. The constraint enhancement results move closer to the reference image, while simultaneously using the negative prototype repulsion term. By constraining latent features away from the degenerate prototype, degradation suppression and content preservation can be achieved simultaneously during image restoration.
5. The underwater image enhancement method based on degenerate codebook perception and negative prototype learning according to claim 1, characterized in that: The negative prototype repulsion term in step S04 This is used to constrain the latent features of the input image in the embedding space from the degenerate index map. The corresponding degenerate prototype is first determined according to the degeneracy index diagram. From discrete degenerate codebook Extract the degenerate prototype features corresponding to each spatial location. The expression is: ; in, Represents the lookup mapping function for discrete degenerate codebooks. Indicates position Degenerate index at the location, ) indicates position The corresponding degenerate prototype features; the latent features of the input image in the embedding space. Corresponding degenerate prototype features Normalization was performed to obtain the normalized latent features. and normalized degenerate prototype features The expression is: ; ; The location is calculated based on the normalized latent features and the normalized degenerate prototype features. Similarity at location The expression is: ; in, Indicates position Cosine similarity between latent features and their corresponding degenerate prototypes; similarity across all spatial locations. Sort the results in descending order and select the results with the highest similarity. These locations constitute a set of highly similar locations. Alternatively, select the positions with the highest similarity from the previous preset proportions to form a set of highly similar positions. The negative prototype exclusion term Represented as: ; in, Represents the set of highly similar locations The number of positions in the middle, The similarity interval threshold is represented by the negative prototype exclusion term. By applying exclusion constraints only to spatial locations where latent features are highly similar to the degenerate prototype, latent representations in the input image that are highly aligned with the degenerate pattern are preferentially suppressed.
6. The underwater image enhancement method based on degenerate codebook perception and negative prototype learning according to claim 1, characterized in that: The generation of the degradation hint vector in step S05 includes the following steps: Step S051: Analyze the degradation index map obtained in step S03. Frequency statistics are performed to calculate the number of times each codeword in the discrete degenerate codebook appears in the current input image. Let the total number of codewords in the discrete degenerate codebook be... Then the first Frequency of occurrence of each code character for: ; in, This represents an indicator function, which takes the value 1 when the condition inside the parentheses is true, and takes the value 0 otherwise. Indicates the location of the degenerate index map The corresponding discrete index. Indicates the first The frequency of occurrence of each codeword in the current input image; Step S052: Based on the frequency of occurrence of each codeword Sort them in descending order and select the ones with the highest frequency. Each codeword is the dominant degenerate codeword set. Its expression is: ; in, Indicates the dominant degenerate codeword set, Indicates the number of dominant degenerate codewords; Step S053: For the dominant degenerate codeword set The frequency of each codeword is normalized to obtain its corresponding frequency weight. Its expression is: ; in, Indicates the first Normalized frequency weights of dominant degenerate codewords This represents a constant to prevent the denominator from being zero; Step S054: Based on the dominant degenerate codeword set Normalized frequency weights corresponding to each codeword For the corresponding codeword in the discrete degenerate codebook We perform a weighted summation to obtain the degradation hint vector. Its expression is: ; And satisfy: ; in, Indicates the first in the discrete degenerate codebook Each code character The degradation cue vector represents the dominant degradation pattern in the current input image and serves as the input for subsequent cue feature mapping and bottleneck modulation.
7. The underwater image enhancement method based on degenerate codebook perception and negative prototype learning according to claim 1, characterized in that: The process of mapping the degraded cue vector to cue features and injecting them into the bottleneck decoding features of the enhancement network in step S05 includes the following steps: The degradation hint vector obtained in step S054 Input a linear mapping layer to obtain a low-dimensional cue representation. Its expression is: ; in, Represents a linear mapping matrix. Indicates the bias term. This indicates a low-dimensional hint representation; Representing low-dimensional hints Expanded to spatial cue features consistent with the spatial resolution of the bottleneck decoding features in the enhanced network The cue features are obtained after convolutional mapping. Its expression is: ; ; in, Indicates an extension operation. This represents the convolution mapping operation. Indicates a prompt feature; The prompt feature Decoding features at enhanced network bottleneck locations Feature concatenation is performed to obtain fused features. Its expression is: ; in, This indicates a feature concatenation operation. Indicates bottleneck decoding features. Indicates fusion characteristics; For the fusion features Perform convolution mapping to generate modulation residuals Its expression is: ; in, Represents the fusion mapping function, This represents the modulation residual generated jointly by the degradation cue vector and the bottleneck decoding features; The modulation residual Applying residual injection to bottleneck decoding features Obtain the modulated bottleneck decoding features Its expression is: ; in, Indicates the learnable modulation coefficients. The modulated bottleneck decoding features are represented; the modulated bottleneck decoding features are represented. As input for subsequent decoding and recovery, the image enhancement process is adaptively adjusted according to the dominant degradation mode of the current input image.