Semantic-driven frequency consistency underwater image enhancement method
By calculating the low-frequency residual components of underwater images and optimizing attention weights using semantic partitioning masks, the problems of global structural distortion and local detail imbalance in underwater image enhancement are solved, achieving a balance between global consistency and local detail, and improving the underwater image enhancement effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN UNIV OF SCI & TECH
- Filing Date
- 2026-03-31
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies do not fully utilize frequency domain compensation mechanisms in underwater image enhancement, making it difficult to quantify the degree of global degradation. This results in distortion of the global image structure and imbalance of local details, and fails to finely divide the degradation region and dynamically and adaptively allocate weights.
By acquiring the low-frequency components of underwater degraded and clear images of the same scene, calculating the difference in deep feature vectors to obtain global low-frequency residual components, combining semantic segmentation to generate semantic partition masks, optimizing attention weights, and weighted fusing local low-frequency residual components, dynamic adaptive enhancement is achieved.
It improves the global structural consistency and local detail balance of underwater image enhancement, thereby enhancing the integrity and consistency of underwater image enhancement.
Smart Images

Figure CN121961897A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of underwater image processing technology, specifically to a semantically driven frequency-consistency underwater image enhancement method. Background Technology
[0002] Underwater images are susceptible to scattering and absorption by water, and generally suffer from problems such as global structural distortion, uneven local degradation, and poor consistency in semantic region enhancement. These issues severely restrict the application of underwater exploration and resource exploration. Therefore, the core requirement of underwater image enhancement technology is to balance global structural stability with targeted repair of local degradation.
[0003] In the prior art, CN116596795A provides an underwater map based on semantic guidance and attention fusion. The image enhancement method includes the following steps: constructing an underwater image enhancement network, including a generator (encoder, decoder), a semantic segmentation network, a semantic fusion module, and a discriminator; the semantic segmentation network obtains the semantic map of the input image, the encoder extracts image features, and its (N+1-i)th layer encoded features are input to the next layer encoder and the i-th layer decoder respectively; the decoder upsamples the output of the previous layer at the i-th layer to obtain the decoded features, and concatenates them with the corresponding encoded features to obtain the concatenated features; each decoder layer is equipped with a semantic fusion module, the semantic map is processed by convolution and downsampling layers to obtain semantic-aware features, and these features are input with the concatenated features into the attention module to generate semantic fusion features and fed back to the decoder; the decoder uses the semantic fusion features to generate a reconstructed image. This method effectively improves the enhancement consistency of semantically similar regions by utilizing semantic cues, while also improving the image edge blurring problem. It integrates spatial and channel attention, accurately assigns reasonable weights to severely degraded regions, and ultimately optimizes the overall image enhancement effect.
[0004] However, the following shortcomings still exist: existing technologies rely solely on the splicing and fusion of semantic maps and feature layers to achieve image enhancement. They do not introduce a frequency domain compensation mechanism and do not make full use of low-frequency components and residual information. It is difficult to quantify the degree of global degradation, which can easily cause distortion of the global image structure. Furthermore, they do not perform fine-grained division of image degradation regions, do not complete transition features for region boundaries, and do not achieve dynamic adaptive allocation of weights, which further exacerbates the imbalance between global image features and local details.
[0005] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] The purpose of this invention is to provide a semantically driven frequency-consistent underwater image enhancement method to solve the problems mentioned in the background art.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A semantically driven frequency consistency underwater image enhancement method, comprising the following steps: S1. Collect underwater degraded images and clear underwater images of the same scene, obtain their low-frequency components, extract the deep feature vectors corresponding to the low-frequency components through a pre-trained encoder, calculate the difference between the deep feature vectors of the two types of images, and obtain the global low-frequency residual components. S2. Standardize the underwater degraded image to obtain standardized image and pixel data. Perform grayscale processing on the standardized image. Use a pre-trained semantic segmentation model to perform semantic segmentation on the grayscale processed image, divide it into multiple semantic categories and generate semantic partition masks. Based on the grayscale variance of each semantic category, divide it into degraded region, transition zone region and non-degraded region. Based on the adjacent semantic degradation association rules, filter the transition zone regions adjacent to each degraded region and complete it to obtain the final degraded region. S3. Input the corresponding pixel data of the standardized image and the semantic partition mask into the linear projection layer, introduce the semantic adaptive coefficient of each semantic category, optimize the attention weight of each degraded region and output the semantic enhancement feature, combine the semantic adaptive coefficient and gray variance to obtain the fusion weight coefficient, simultaneously extract the local low frequency residual component corresponding to each degraded region, and fuse it with the semantic enhancement feature to generate the fusion feature of each degraded region. S4. The standardized images of each degraded region are stitched together with the corresponding fusion features to form a combined feature map, which is then input into the trained image enhancement network model. The model outputs clear underwater image fragments of each degraded region and stitches them together with the original images of the non-degraded regions to obtain a complete underwater enhanced image.
[0008] Furthermore, the semantic categories include coral regions, rock regions, and water regions. The semantic partitioning mask assigns a unique pixel identifier to multiple semantic categories, wherein the coral region corresponds to pixel value 1, the rock region corresponds to pixel value 2, and the water region corresponds to pixel value 3. Based on the gray-level variance of each semantic category, the region is divided into degenerate region, transition zone region, and non-degenerate region. The specific logic is as follows: The gray-level variance is calculated for each semantic category one by one. Based on the relationship between the gray-level variance and the preset high variance threshold and low variance threshold, the degradation region category corresponding to each semantic category is determined. The degradation region category includes degradation region, transition zone region and non-degradation region. If the gray-level variance of a semantic category is greater than the high variance threshold, the semantic category is determined to be a degenerate region. If the gray-level variance of a semantic category is greater than or equal to the low variance threshold and less than or equal to the high variance threshold, the semantic category is determined to be a transition zone region. If the gray-level variance of a semantic category is less than the low variance threshold, the semantic category is determined to be a non-degenerate region.
[0009] Furthermore, based on the adjacent semantic degradation association rules, the transition zone regions adjacent to each degradation region are selected and completed to obtain the final degradation region. The specific steps are as follows: Based on the pixel identifiers of the semantic partition mask, the pixel boundaries and spatial distribution range of the corresponding regions are extracted to determine the adjacent boundary pixel range of each semantic category. When two boundary pixels of different semantic categories are in direct contact, i.e. there are no other semantic category pixels between them, they are determined to be adjacent semantic categories, and the range of their corresponding adjacent boundary pixels is recorded simultaneously. Based on the determination results of degraded regions, transition zones, and non-degraded regions for each semantic category, and taking the degraded region as the benchmark, we traverse the range of adjacent boundary pixels that have been recorded for the degraded region, match the transition zone regions that are in direct contact with its boundary, and filter them as regions to be completed. The selected areas to be completed are all assigned to the corresponding degenerate areas. The pixel boundaries of the degenerate areas are updated. During the completion process, only the category of the degenerate area is updated, while the original semantic category and unique pixel identifier of the area to be completed are retained. After the completion is completed, the final degenerate area is obtained.
[0010] Furthermore, semantic adaptive coefficients for each semantic category are introduced to optimize the attention weights of each degenerate region and output semantically enhanced features. The specific logic is as follows: The corresponding pixel data of the standardized image and the semantic partition mask are input into the linear projection layer to obtain a feature map that fuses semantic information. Based on the final degraded region boundary and semantic partition mask, a spatial mask corresponding to each degraded region category is generated. This spatial mask marks the pixel positions in the feature map that belong to the degraded region as 1 and the pixel positions that do not belong to the degraded region as 0, thereby locating the range of each degraded region in the feature map. The feature map, which incorporates semantic information, is input into the spatial attention module along with the aforementioned spatial mask. For the degenerate regions in the feature map marked with a spatial mask of 1, weight coefficients are assigned according to the following rules: Taking each pixel in the degradation region as the center pixel, select all pixels in the neighborhood with the center pixel as the origin and a preset size as the neighboring pixels, calculate the absolute difference between the feature channel mean values of the center pixel and the neighboring pixels, compare the absolute difference with the preset absolute difference threshold, and assign the corresponding weight coefficient to the center pixel. If the absolute difference of the feature channel means is greater than the absolute difference threshold, then the center pixel is assigned a weight coefficient. ; If the absolute difference of the feature channel means is less than or equal to the absolute difference threshold, then the center pixel is assigned a weight coefficient. ; Among them, On this basis, let ; For different semantic categories of degraded regions, semantic adaptive coefficients are introduced, and semantic adaptive coefficients are assigned to coral regions, rock regions, and water regions respectively. ; Among them, On this basis, let ; The weight coefficient of the center pixel of the degradation region under each semantic category is multiplied by the semantic adaptation coefficient of the corresponding semantic category to obtain the final attention weight of each center pixel. The formula is as follows: in, For the first The first degraded area, the first The semantic category under the first The final attention weights for each center pixel. For the first The first degraded region The weight coefficient of each center pixel, For the first The semantic category under the first The semantic adaptive coefficient of each center pixel For the index of the degenerate region, , The number of degraded areas, For semantic category indexes, , These correspond to the coral area, rock area, and water area, respectively. The index of the center pixel, , The number of center pixels; Based on the final attention weight adjustment of the feature map fused with semantic information, only the feature part corresponding to the degenerate region marked with 1 in the spatial mask is retained, and the features of the non-degenerate region marked with 0 are removed, and the semantic enhancement features of each degenerate region are output.
[0011] Furthermore, by combining the semantic adaptive coefficient and the gray-level variance, the fusion weight coefficient is obtained, and the specific logic is as follows: Based on the gray-level variance of each semantic category, the corresponding degradation correction coefficient is calculated using the following formula: in, For the first Degradation correction coefficients for each semantic category For the first Gray-level variance of each semantic category For low variance threshold, High variance threshold; The fusion weight coefficient is calculated by combining the semantic adaptation coefficient and degradation correction coefficient of each semantic category, based on the following formula: in, For the first The fusion weight coefficients of each semantic category, For the first Semantic adaptive coefficients for each semantic category.
[0012] Furthermore, the local low-frequency residual components are weighted and fused with the semantic enhancement features to generate fused features for each degraded region, based on the following formula: in, For the first The first degraded area, the first Fusion features under semantic categories For the first The first degraded area, the first Semantic enhancement features under each semantic category For the first The first degraded area, the first Local low-frequency residual components under each semantic category.
[0013] Compared with the prior art, the beneficial effects of the present invention are: This invention acquires low-frequency components from both degraded and clear underwater images within the same scene. A pre-trained encoder extracts the deep feature vectors corresponding to these low-frequency components, and the difference between the deep feature vectors of the two types of images is calculated to obtain global low-frequency residual components. This achieves precise quantification and frequency domain compensation of global degradation differences, fundamentally improving global structural distortion and ensuring the overall structural consistency of the enhanced underwater image. Simultaneously, by standardizing and grayscale the degraded image, semantic segmentation is used to generate a semantic partition mask. Combined with grayscale variance, a refined division of degraded, transition, and non-degraded regions is achieved. The final degraded region is completed using adjacent semantic degradation association rules. A semantic adaptive coefficient is introduced to optimize attention weights. Based on the semantic adaptive coefficient and grayscale variance, a fusion weight coefficient is constructed, and the semantic enhancement features and local low-frequency residual components are weighted and fused. This achieves dynamic adaptive allocation of enhancement weights for degraded regions, effectively balancing the enhancement effects of global structure and local details, solving the problem of global and local enhancement imbalance, and improving the integrity and consistency of underwater image enhancement. Attached Figure Description
[0014] Figure 1This is a schematic diagram of the overall method flow of the present invention. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.
[0016] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0017] Example: Please see Figure 1 The present invention provides a technical solution: A semantically driven frequency consistency underwater image enhancement method, comprising the following steps: S1. Acquire both degraded and clear underwater images of the same scene. Perform frequency domain decomposition using discrete wavelet transform to filter out high-frequency details and noise components, obtaining low-frequency components that characterize the overall image structure and global grayscale trend. Based on these low-frequency components, calculate the mean brightness of the region and extract the grayscale value of the target contour to construct a manual global feature. This manual global feature serves as a traditional global representation method and is used to form a comparison benchmark with deep features to verify the representational advantages of subsequent deep features. On the other hand, use a pre-trained encoder to extract deep feature vectors. Calculate the difference between the deep feature vectors of the clear and degraded images to obtain the global low-frequency residual component. This achieves accurate quantification and frequency domain compensation of global degradation differences, fundamentally improving global structural distortion and ensuring the overall structural consistency of the enhanced underwater image.
[0018] Based on the above embodiments, underwater degraded images and clear underwater images of the same scene are acquired, and the specific logic is as follows: At the same underwater monitoring point, under the same lighting conditions and water environment, the original underwater images with degradation problems such as scattering, attenuation, and color shift are first collected as underwater degraded images; then, by improving water turbidity, optimizing supplementary lighting, taking close-up shots, or using high-definition professional underwater acquisition equipment, images without obvious degradation of the same viewpoint and the same scene content are obtained as the corresponding clear underwater images.
[0019] Underwater degraded and clear underwater images of the same scene were acquired. To ensure the accuracy of the global low-frequency residual component calculation, this residual component was obtained by the difference of low-frequency deep feature vectors between the two types of images, aiming to quantify the global degradation differences caused by the underwater environment. By limiting both images to the same scene, interference from irrelevant factors such as scene content and target objects was eliminated, ensuring that the feature difference only reflects the structural distortion caused by underwater degradation. This guarantees that subsequent frequency domain compensation can accurately target the true degradation component, improving the reliability of global structure enhancement.
[0020] Based on the above embodiments, the encoder's complete fine-tuning training process and the input / output of the training phase are as follows: First, the encoder is pre-trained on a publicly available image dataset, such as ImageNet, to obtain initial network weights, laying the foundation for high-dimensional feature extraction and ensuring strong global feature representation capabilities. Then, a dataset of low-frequency components of underwater images processed by discrete wavelet transform is used as training data. This dataset contains low-frequency components corresponding to both degraded and clear underwater images of the same scene, requiring no additional manual annotation. During the fine-tuning training phase, the encoder input consists of low-frequency components of underwater images representing the overall image structure and global grayscale trend, along with the corresponding global structural features (or regions from manually generated global features). The feature vector constructed from the average brightness value and the gray value of the target contour is used as the supervision ground truth. The supervision ground truth is used to characterize the global structure and gray distribution core information of the low-frequency components, and matches the dimension and semantics of the deep feature vector output by the encoder. During training, the difference between the deep feature vector output by the encoder and the supervision ground truth is calculated using the mean square error loss function. The network parameters of the encoder are iteratively updated through the gradient descent algorithm to continuously optimize the encoder's extraction accuracy of the global features of the low-frequency components of underwater images until the feature representation error of the encoder on the validation set tends to be stable and the encoder converges. Finally, an encoder adapted to the low-frequency component feature extraction of underwater scenes is obtained.
[0021] Based on the above embodiments, the deep feature vector is a 1×512-dimensional high-dimensional feature vector output by the pre-trained encoder, and the parameters of each dimension in the vector jointly represent three types of information: First, global contour-related features reflect the integrity and continuity of the large-scale contour of the underwater target to be observed, and characterize the degree of preservation and smoothness of the target's main shape and overall edge under the influence of degradation factors such as water scattering and insufficient light. Second, global brightness-related features reflect the overall brightness distribution and changes in brightness gradient of the image. Third, semantic association-related features reflect the degree of feature association between different semantic regions; The deep feature vector discards redundant information at the original pixel level and can characterize the overall image contour, global structure, brightness distribution and large-scale semantic information contained in the low-frequency components. It can effectively reflect the essential differences between clear underwater images and degraded images in the same scene at the global structure level. Compared with the original low-frequency components, it has stronger feature discrimination and representation capabilities, and provides a reliable feature basis for subsequent accurate calculation of global low-frequency residual components.
[0022] Based on the above embodiments, the difference in deep feature vectors between the two types of images is calculated to obtain the global low-frequency residual component. The specific logic is as follows: First, forward inference is performed on the low-frequency components of the underwater degraded image and the low-frequency components of the clear underwater image using a pre-trained encoder with frozen parameters, and the corresponding deep feature vectors are output. The feature dimensions and dimensional order of the two sets of deep feature vectors are completely consistent, and they are both high-dimensional semantic feature vectors. Their dimensions are determined by the encoder network structure. Both types of feature vectors remove redundant information and high-frequency detail interference from the original pixels and are only used to represent the core information such as the global structure and overall contour contained in the low-frequency components of the corresponding image. Secondly, the difference is calculated by subtracting elements one by one, according to the "degraded image feature elements". The rule of "clear image feature elements" involves subtracting each feature dimension at the corresponding position of the two sets of feature vectors to obtain an intermediate difference feature vector composed of element-wise differences. Finally, the intermediate difference feature vectors are standardized to eliminate the influence of differences in feature dimensions and numerical distribution, ultimately yielding the global low-frequency residual component. This global low-frequency residual component is used to quantify the degree of global structural distortion of the image caused by degradation factors such as water scattering, light attenuation, and color cast under the same scene. The value of each feature element in the residual component corresponds to the degradation offset of a certain feature dimension of the global structure: the larger the absolute value of the difference, the more significant the degradation distortion of the global structure under that dimension. The global low-frequency residual component can provide accurate quantitative basis for subsequent frequency domain degradation compensation, enabling the compensation operation to be accurately applied to the real degradation component and specifically improve the global structural distortion problem of underwater images.
[0023] S2. Standardize the underwater degraded image to obtain standardized image and pixel data. Perform grayscale processing on the standardized image. Use a pre-trained semantic segmentation model to perform semantic segmentation on the grayscale processed image, divide it into multiple semantic categories and generate semantic partition masks. Based on the grayscale variance of each semantic category, divide it into degraded region, transition zone region and non-degraded region. Based on the adjacent semantic degradation association rules, filter the transition zone regions adjacent to each degraded region and complete it to obtain the final degraded region. Based on the above embodiments, the semantic segmentation model is built on the U-Net architecture, and its complete fine-tuning training process and the input and output of the training phase are as follows: First, the semantic segmentation model is pre-trained on a general public image dataset to obtain initial network weights, laying the foundation for feature extraction for subsequent adaptation to underwater scenarios. Then, an underwater degraded image dataset with pixel-level semantic annotations is used as training data. During the fine-tuning training phase, the model input is a standardized and grayscaled single-channel underwater grayscale image, while manually annotated pixel-level semantic partition masks are used as ground truth for supervision. The ground truth is a two-dimensional label map with the same size as the input single-channel underwater grayscale image, where the value of each pixel corresponds to a predefined underwater semantic category identifier. During training, the difference between the model's forward output and the ground truth is calculated using the cross-entropy loss function. The network parameters of the semantic segmentation model are iteratively updated using the gradient descent algorithm to continuously optimize the model's pixel-level semantic classification accuracy until the semantic segmentation model's evaluation metrics on the validation set, such as the intersection-union ratio (IU) stabilizing and the semantic segmentation model converging, are finally obtained. This semantic segmentation model adapted to underwater scenarios can accurately achieve pixel-level semantic region division of underwater degraded images, providing a reliable semantic partitioning foundation for subsequent division of degraded regions, transition zones, and non-degraded regions.
[0024] Based on the above embodiments, the semantic categories include coral regions, rock regions, and water regions. The semantic partition mask assigns a unique pixel identifier to multiple semantic categories, wherein the coral region corresponds to pixel value 1, the rock region corresponds to pixel value 2, and the water region corresponds to pixel value 3. Based on the gray-level variance of each semantic category, the region is divided into degenerate region, transition zone region, and non-degenerate region. The specific logic is as follows: The gray-level variance is calculated for each semantic category one by one. Based on the relationship between the gray-level variance and the preset high variance threshold and low variance threshold, the degradation region category corresponding to each semantic category is determined. The degradation region category includes degradation region, transition zone region and non-degradation region. If the gray-level variance of a semantic category is greater than the high variance threshold, the semantic category is determined to be a degenerate region. If the gray-level variance of a semantic category is greater than or equal to the low variance threshold and less than or equal to the high variance threshold, the semantic category is determined to be a transition zone region. If the gray-level variance of a semantic category is less than the low variance threshold, the semantic category is determined to be a non-degenerate region.
[0025] The low variance threshold and high variance threshold are both calculated and determined based on the upper quartile and lower quartile of historical sample data to ensure the rationality and suitability of the threshold settings. The specific calculation method is as follows: Multiple sets of historical sample images of similar underwater scenes were collected. The gray-level variance of the coral area, rock area, and water area in each sample image was extracted to construct a gray-level variance sample set. Quartile analysis was performed on the gray-level variance sample set to calculate the lower quartile and upper quartile values of the sample set. The lower quartile value was determined as the low variance threshold, and the upper quartile value was determined as the high variance threshold.
[0026] Based on the above, it should be noted that: Gray-level variance accurately quantifies the degree of degradation in semantic regions, aligning with the degradation characteristics of underwater images. Gray-level variance characterizes the dispersion of pixel gray-level values within a semantic category. Degradation in underwater images directly leads to a chaotic distribution of pixel gray-level values and increased dispersion within the region. The more severely degraded the region, the greater the fluctuation in gray-level values and the higher the gray-level variance; conversely, non-degraded regions have a uniform gray-level distribution and lower variance. Therefore, using gray-level variance as the basis for classification objectively and quantitatively distinguishes the degradation state of each semantic category, avoiding errors caused by subjective judgment and providing quantitative support for subsequent targeted enhancement.
[0027] The core of semantic segmentation, which divides the image into three semantic regions—coral, rock, and water—is to clarify the attribute differences between different regions. On the other hand, dividing the image into three degraded regions based on gray-level variance further distinguishes the degree of degradation of each region based on semantic attributes. This dual positioning solves the drawback of traditional enhancement methods that "only focus on global degradation and ignore the differences in degradation of local semantic regions," ensuring that subsequent enhancement operations are both consistent with the semantic characteristics of the region and match the degree of degradation of the region.
[0028] Based on the three types of regions divided by gray-scale variance, the degradation state of each semantic category is clearly defined, providing a foundation for the application of adjacent semantic degradation association rules. The clear division of the three types of regions can accurately define the boundaries of the degradation region, the transition zone region, and the non-degradation region. This can effectively avoid the non-degradation region being mistakenly included in the transition zone completion range and subsequent enhancement range, and prevent any degradation region from being missed or not included in the completion and enhancement process. This ensures the integrity and accuracy of the final degradation region, providing a reliable regional foundation for subsequent targeted enhancement.
[0029] Based on the above embodiments, according to the adjacent semantic degradation association rules, the transition zone regions adjacent to each degradation region are filtered out and the final degradation region is obtained. The specific logic is as follows: The core of the adjacent semantic degradation association rule is to determine the adjacency relationship and adjacent boundary pixel range of each semantic category based on the pixel identifier of the semantic partition mask, and then filter and complete the adjacent transition zone based on the degradation region. The specific logic is as follows: Based on the pixel identifiers of the semantic partition mask, the pixel boundaries and spatial distribution range of the corresponding regions are extracted to determine the adjacent boundary pixel range of each semantic category. Based on the determination results of degraded regions, transition zones, and non-degraded regions for each semantic category, and taking the degraded region as the benchmark, we traverse the range of adjacent boundary pixels that have been recorded for the degraded region, match the transition zone regions that are in direct contact with its boundary, and filter them as regions to be completed. The selected areas to be completed are all assigned to the corresponding degenerate areas. The pixel boundaries of the degenerate areas are updated. During the completion process, only the category of the degenerate area is updated, while the original semantic category and unique pixel identifier of the area to be completed are retained. After the completion is completed, the final degenerate area is obtained.
[0030] S3. Input the corresponding pixel data of the standardized image and the semantic partition mask into the linear projection layer, introduce the semantic adaptive coefficient of each semantic category, optimize the attention weight of each degraded region and output the semantic enhancement feature, combine the semantic adaptive coefficient and gray variance to obtain the fusion weight coefficient, simultaneously extract the local low frequency residual component corresponding to each degraded region, and fuse it with the semantic enhancement feature to generate the fusion feature of each degraded region. Based on the above embodiments, the corresponding pixel data of the standardized image and the semantic partition mask are input into the linear projection layer, and the specific logic is as follows: Based on the output standardized image corresponding pixel data and semantic partition mask, the pixel data of the standardized image retains the original pixel grayscale information of the underwater degraded image after standardization processing, and the semantic partition mask carries the semantic category identifier and region distribution information corresponding to each pixel. The region distribution information refers to the spatial location, coordinate range and connectivity information of all pixels corresponding to each semantic category in the image in the semantic partition mask. The two types of input data are preprocessed and adapted to convert the pixel data of the standardized image into pixel feature vectors of a preset dimension. At the same time, the semantic partition mask is encoded to map the semantic category identifier of each pixel to a semantic feature code with the same dimension as the pixel feature vector, so as to ensure that the two types of data have the same dimension and can be input collaboratively. The preprocessed standardized image pixel feature vectors and semantic partition mask encoded features are synchronously input into the linear projection layer; The linear projection layer uses a preset linear transformation matrix to fuse and map the two types of input features, eliminating the feature heterogeneity of the two types of data. It outputs a feature map with unified dimension, aligned features, and fused semantic information. This feature map retains the core pixel grayscale information of the standardized image and carries the semantic category information corresponding to each pixel, realizing the organic fusion of pixel grayscale features and semantic features.
[0031] Based on the above embodiments, semantic adaptive coefficients for each semantic category are introduced to optimize the attention weights of each degenerate region and output semantically enhanced features. The specific logic is as follows: Based on the final degraded region boundary and semantic partition mask, a spatial mask corresponding to each degraded region category is generated. This spatial mask marks the pixel positions in the feature map that belong to the degraded region as 1 and the pixel positions that do not belong to the degraded region as 0, thereby locating the range of each degraded region in the feature map. The feature map and the aforementioned spatial mask are input into the spatial attention module. For the degenerate regions in the feature map marked with a spatial mask of 1, weight coefficients are assigned according to the following rules: Using each pixel in the degraded region as the center pixel, select all pixels in the neighborhood with the center pixel as the origin and a preset size as the neighboring pixels. The preset size is usually 3×3 or 5×5. Calculate the absolute difference between the mean values of the feature channels of the center pixel and its neighboring pixels. The absolute difference between the mean values of the feature channels refers to the absolute value of the difference between the mean values of the center pixel and its neighboring pixels in the same feature channel of the feature map within the degradation region. This difference can be used to accurately determine the magnitude of the feature difference between the center pixel and its neighboring pixels, thereby determining the degree of degradation of the center pixel. The absolute difference of the mean values of the above feature channels is compared with a preset absolute difference threshold, and a corresponding weight coefficient is assigned to the center pixel: If the absolute difference of the feature channel means is greater than the preset absolute difference threshold, it indicates that the center pixel has a severe degradation degree, and a weight coefficient is assigned to it. ; If the absolute difference of the feature channel means is less than or equal to the preset absolute difference threshold, it indicates that the center pixel has a mild degradation degree, and a weight coefficient is assigned to it. ; exist On this basis, let This ensures that the weight allocation is reasonable, so that pixels with more obvious degradation receive higher enhancement weights, and subsequent enhancements can focus on making targeted corrections.
[0032] The absolute difference threshold is determined by calculating a baseline value for the absolute difference of the mean value of the feature channels based on historical image data of the same type of underwater scene, and then increasing the baseline value by 20% to obtain the preset absolute difference threshold.
[0033] Based on the above embodiments, semantic adaptive coefficients are introduced for different semantic categories of degraded regions, and semantic adaptive coefficients are assigned to coral regions, rock regions, and water regions respectively. ; Among them, On this basis, let ; Among them, the coral region typically has fine texture and rich details, and is a core area of concern in underwater scenes. Its degradation has the greatest impact on the clarity of details, so it needs to be given a higher enhancement weight. Therefore, it is assigned the largest semantic adaptation coefficient. ; The texture complexity of the rock area falls between that of the coral and the water body. Its impact on overall image quality after degradation is less than that of the coral area, so it does not require the highest enhancement weight, but it needs to be higher than that of the water body area. Therefore, an intermediate coefficient is assigned. ; Water areas have relatively simple textures and limited detail, and their degradation mainly manifests as overall grayscale shifts or slight scattering. Therefore, they require minimal enhancement precision; excessive enhancement can lead to image distortion. Thus, the smallest semantic adaptive coefficient is assigned. ; pass The settings, combined with the previous text It can achieve "focused enhancement of core semantic regions (coral), moderate enhancement of secondary semantic regions (rocks), and gentle enhancement of auxiliary semantic regions (water)," ensuring the enhancement effect of core regions while avoiding image distortion caused by excessive enhancement of non-core regions, and simultaneously meeting the requirements of... By constraining the coefficients, we can ensure that the weight allocation is reasonable and ultimately achieve semantic-driven differentiated weight optimization, thereby improving the overall quality of underwater enhanced images.
[0034] Based on the above embodiments, the weight coefficient of the center pixel of the degradation region under each semantic category is multiplied by the semantic adaptation coefficient of the corresponding semantic category to obtain the final attention weight of each center pixel. The formula is as follows: in, For the first The first degraded area, the first The semantic category under the first The final attention weights for each center pixel. For the first The first degraded region The weight coefficient of each center pixel, For the first The semantic category under the first The semantic adaptive coefficient of each center pixel For the index of the degenerate region, , The number of degraded areas, For semantic category indexes, , These correspond to the coral area, rock area, and water area, respectively. The index of the center pixel, , The number of center pixels; Based on the final attention weight adjustment of the feature map fused with semantic information, only the feature part corresponding to the degenerate region marked with 1 in the spatial mask is retained, and the features of the non-degenerate region marked with 0 are removed, and the semantic enhancement features of each degenerate region are output.
[0035] Based on the above, it should be noted that: The degradation of underwater images is essentially caused by pixel-level grayscale distortion and region-level texture blurring due to water scattering and light attenuation. This degradation exhibits significant differences in different semantic regions. Coral regions have fine textures and strong grayscale correlations between pixels, making pixel-level distortion caused by scattering attenuation more prominent. It is necessary to simultaneously address both "pixel-level distortion correction" and "region-level texture preservation." Rock regions have moderate texture roughness, with a balance between pixel distortion and region blurring. Water regions are mainly affected by overall light attenuation, with small differences in grayscale between pixels. Over-correction can easily introduce noise distortion. Essentially, it quantifies the degree to which a single pixel is affected by scattering attenuation. The essence is to quantify the texture complexity and light attenuation tolerance of different semantic regions, using Essentially, it involves synergistically coupling "pixel-level scattering distortion quantization values" with "region-level texture complexity and attenuation tolerance quantization values" to achieve the final attention weights. It can accurately match the actual degradation state of each pixel, ensuring that pixels severely affected by scattering receive sufficient correction intensity while avoiding image distortion caused by over-correction in areas with simple textures, thus conforming to the degradation patterns and correction needs of underwater images. Therefore, it adopts... This multiplication function expresses the final attention weight for each center pixel.
[0036] Based on the above embodiments, the fusion weight coefficient is obtained by combining the semantic adaptive coefficient and the gray-level variance. The specific logic is as follows: Based on the gray-level variance of each semantic category, the corresponding degradation correction coefficient is calculated using the following formula: in, For the first Degradation correction coefficients for each semantic category For the first Gray-level variance of each semantic category For low variance threshold, High variance threshold; Based on the above, it should be noted that: Gray-level variance of a certain semantic category in underwater images Essentially, it quantifies the dispersion of pixel grayscale within a semantic region. Its core is directly related to the degree of underwater degradation. The finer the texture and the more severely affected the semantic category is by scattering attenuation, the more chaotic the pixel grayscale will become due to scattering interference, and the greater the dispersion. The larger the value, the simpler the texture and the less affected the semantic category by degradation; the more uniform the pixel grayscale distribution and the smaller the dispersion. The smaller the value; Yes The purpose of normalization is to eliminate the magnitude differences in gray-level variance between different semantic categories, and to normalize all semantic categories. A uniform mapping to the [0,1] interval ensures the degradation correction coefficient is within this range. The value is controllable and comparable. Combined with the actual degradation patterns of underwater images, Set to the minimum grayscale variance among all semantic categories. Set to the maximum value of the grayscale variance among all semantic categories, through ( Calculate the variance difference between the current semantic category and the region with the least degradation, then divide by ( By using this method, we can obtain the normalized quantization value of the current semantic category relative to the overall degradation level. The larger the value, the more severe the overall degradation of the semantic category, and the higher the corresponding correction intensity required. The core function of "0.1" in the formula is to scale the normalized variance quantization value. The value range is further constrained to the interval [0, 0.1], as previously stated, the semantic adaptive coefficient. The value range of is (0,1), and the final attention weights Also within the (0,1) interval, if no scaling is applied, the normalized variance quantization value will be directly used as the correction coefficient, which will excessively dominate the value of the fusion weight coefficient and mask the true value of the fusion weight coefficient. (Semantic priority) and The core function of (pixel-level degradation) is to correct imbalances, and after scaling to the [0,0.1] range, It can accurately reflect the differences in degradation correction caused by the differences in grayscale variance of each semantic category, and can also serve as an "auxiliary correction term" with... Synergistic effects are achieved to avoid the drawbacks of a single parameter dominating the correction, ensuring that the fusion weight coefficients can match pixel-level and semantic-level degradation differences, as well as conform to the regional degradation patterns reflected by grayscale variance, ultimately achieving more accurate differentiation enhancement.
[0037] Based on the above embodiments, the fusion weight coefficient is calculated by combining the semantic adaptation coefficient and degradation correction coefficient of each semantic category, using the following formula: in, For the first The fusion weight coefficients of each semantic category, For the first Semantic adaptive coefficients for each semantic category; Based on the above, it should be noted that: The magnitude of the semantic adaptation coefficient is positively correlated with the texture richness of the semantic region, the importance of the target, and its visual priority. A higher semantic adaptation coefficient for a particular semantic category indicates that the region belongs to a core focus area and requires a higher enhancement weight to prioritize detail enhancement and feature strengthening. Conversely, a lower semantic adaptation coefficient indicates that the region is background or redundant, and its enhancement weight should be reduced. Therefore, based on the needs of underwater image enhancement, there is a positive correlation between the semantic adaptation coefficient and the fusion weight coefficient.
[0038] The magnitude of the degradation correction coefficient directly corresponds to the severity of optical degradation in the semantic region and the required correction intensity. A higher degradation correction coefficient indicates more significant regional degradation, requiring a higher enhancement weight to achieve high-intensity compensation and restoration; a lower degradation correction coefficient indicates a weaker degree of regional degradation, requiring a correspondingly lower correction weight. Therefore, based on the mechanism of underwater optical degradation and the compensation logic of image inpainting, there is also a positive correlation between the degradation correction coefficient and the fusion weight coefficient.
[0039] in addition, and Their functions complement each other, each with its own emphasis, jointly supporting the design goal of the fusion weighting coefficient. Among them, Its function is to quantify the enhancement priority of each semantic category. In essence, it is a "priority weight based on semantic characteristics" to solve the problem of "which semantic regions need to be enhanced first". Its function is to quantify the regional degradation correction intensity of each semantic category based on gray-level variance. Essentially, it is a "correction weight based on the degree of degradation" to solve the problem of "how much intensity enhancement is needed for a certain semantic region". The two work together to achieve the dual needs of "priority + targeting".
[0040] use The additive form is essentially a linear superposition of "priority weights" and "correction weights," achieving a synergistic balance between the needs of both dimensions. This superposition method ensures that core semantic regions receive higher base weights, highlighting their enhancement priority; it also allows severely degraded semantic regions to receive additional correction weights to match their actual correction needs, ultimately resulting in a higher fusion weight coefficient. It can not only reflect the priority differences of each semantic region, but also accurately match the differences in their regional degradation levels, perfectly meeting the correction requirements of underwater images: "prioritizing the enhancement of core regions and focusing on the correction of severely degraded regions".
[0041] Based on the above embodiments, the local low-frequency residual components corresponding to each degradation region are extracted simultaneously. The specific logic is as follows: The final degradation region mask is spatially aligned with the global low-frequency residual components to ensure a one-to-one correspondence between their size and pixel position. In the final degradation region mask, the pixel position marked as 1 corresponds to the degradation region, and the pixel position marked as 0 corresponds to the non-degradation region. A pixel-by-pixel masking operation is performed on the global low-frequency residual components using the final degradation region mask. The specific rules are as follows: For each pixel in the image, if the pixel is marked as a degradation region in the final degradation region mask, the global low-frequency residual value corresponding to the pixel is directly used as the local low-frequency residual value of the corresponding degradation region to which the pixel belongs; if the pixel is marked as a non-degradation region in the final degradation region mask, the local low-frequency residual value of the pixel is set to 0.
[0042] Wherein, the global low-frequency residual value is the feature value of the global low-frequency residual component at the current pixel; the local low-frequency residual value is the value of the first... The local low-frequency residual component feature value corresponding to the current pixel point in each degraded region.
[0043] Based on the above embodiments, local low-frequency residual components are weighted and fused with semantic enhancement features to generate fused features for each degraded region. The formula used is as follows: in, For the first The first degraded area, the first Fusion features under semantic categories For the first The first degraded area, the first Semantic enhancement features under each semantic category For the first The first degraded area, the first Local low-frequency residual components under each semantic category.
[0044] Based on the above, it should be noted that: The higher the representational strength of semantic enhancement features, the more fully the texture, contour, and category features corresponding to the semantic category in that region are extracted and enhanced, and the closer they are to the real form of objects in underwater scenes. This results in a greater contribution to improving the semantic clarity and regional recognizability of the image. As the core feature ultimately used for degraded region restoration, the fusion feature needs to fully inherit and carry effective information at the semantic structure level. Therefore, semantic enhancement features and fusion features show a significant positive correlation.
[0045] The magnitude of the local low-frequency residual components directly corresponds to the severity of low-frequency distortion in the degraded region. Higher intensity residual components indicate more significant low-frequency distortion caused by overall grayscale shift and light attenuation in that region, requiring more overall grayscale correction information to offset the overall quality degradation caused by water optical effects. The fusion feature must carry semantic details and perform overall grayscale correction, necessitating the full absorption of distortion compensation information carried by the low-frequency residuals. Therefore, the local low-frequency residual components and the fusion feature also exhibit a significant positive correlation.
[0046] Semantic enhancement features are responsible for enhancing and restoring the detailed structural features such as texture and contour of semantic regions, while local low-frequency residual components are responsible for compensating for low-frequency distortion in the overall grayscale and brightness trends of degraded regions. These two features correspond to two independent physical mechanisms of underwater image degradation, with no feature redundancy or mutual interference, and together serve the need for complete restoration of degraded regions. The fusion feature, through weighted coupling of the two, inherits both semantic structure enhancement information and low-frequency distortion compensation information, ensuring clear discernibility of regional details while correcting overall grayscale distortion, thus achieving a collaborative restoration logic of "detail restoration + global correction".
[0047] Based on the above, it should be noted that: By standardizing and grayscale processing the degraded image, semantic partitioning masks are generated using semantic segmentation. Combined with grayscale variance, refined division of degraded regions, transition zones, and non-degraded regions is achieved. The final degraded region is then completed using adjacent semantic degradation association rules. Simultaneously, semantic adaptive coefficients are introduced to optimize attention weights. Based on these coefficients and grayscale variance, a fusion weight coefficient is constructed, which weights and fuses semantic enhancement features with local low-frequency residual components. This achieves dynamic adaptive allocation of enhancement weights for degraded regions, effectively balancing the enhancement effects of global structure and local details, resolving the imbalance between global and local enhancements, and improving the integrity and consistency of underwater image enhancement.
[0048] S4. The standardized images of each degraded region are stitched together with the corresponding fusion features to form a combined feature map, which is then input into the trained image enhancement network model. The model outputs clear underwater image fragments of each degraded region and stitches them together with the original images of the non-degraded regions to obtain a complete underwater enhanced image.
[0049] Based on the above embodiments, the standardized images of each degraded region are concatenated with the corresponding fusion features to form a combined feature map. The specific logic is as follows: The standardized images corresponding to each degradation region are expanded in dimension, and the image data is upgraded in the channel dimension to match the channel dimension of the fused features. The normalized image retains only the pixel information of the corresponding degraded area, and sets the pixels of the non-degraded area to zero; The standardized image of the degraded region after dimensional adaptation is stitched and fused with the corresponding fusion feature in the same region in the channel dimension. The stitching process uses pixels as the basic unit to ensure that the original grayscale information of the standardized image corresponds one-to-one with the semantic enhancement information and degradation correction information of the fusion feature at the same spatial location, without changing the spatial size and pixel coordinate distribution of the image. A combined feature map is obtained that simultaneously carries the original pixel grayscale information, semantic enhancement features, and degradation correction information. This combined feature map not only retains the basic pixel information after the underwater degradation image has been standardized, but also integrates semantically driven attention weights and region-level degradation correction features.
[0050] The degradation correction information is based on the degradation correction coefficient and fusion weight coefficient obtained by calculating the gray-level variance of each semantic category, representing the prior information of regional degradation intensity and compensation intensity, and is used to quantify the degree of degradation of different semantic regions affected by water scattering and light attenuation.
[0051] Based on the above embodiments, the image enhancement network model is constructed using a deep learning network based on a multilayer perceptron. The deep neural network of the multilayer perceptron includes an input layer, a first hidden layer, a second hidden layer, a third hidden layer, and an output layer. The first hidden layer, the second hidden layer, and the third hidden layer each have at least two neurons and all use ReLU (Linear Rectified Unit) as the activation function. Multiple sets of standardized images of degraded regions and combined feature maps spliced with corresponding fusion features, as well as clear underwater image fragments of degraded regions, were pre-collected. The samples were divided into training set, validation set, and test set in a 7:2:1 ratio. The training set was used to learn the model parameters; the validation set was used to adjust hyperparameters during training to prevent overfitting; and the test set was used to evaluate the generalization ability of the model after training.
[0052] The structure of a deep learning network with a multilayer perceptron is as follows: Input layer: Used to receive a combined feature map by concatenating the normalized image of the degraded region with the corresponding fused features; The first hidden layer has 128 neurons and uses ReLU as the activation function. The second hidden layer has 64 neurons and also uses the ReLU activation function; The third hidden layer has 32 neurons and uses the ReLU activation function; Output layer: has 1 neuron, used to output clear underwater image fragments of degraded regions.
[0053] The process of training an image enhancement network model is as follows: The model input is a combined feature map composed of standardized images of multiple degraded regions and their corresponding fused features. Clear underwater image fragments of the degraded regions are used as ground truth supervision labels. The mean absolute error loss function is selected, and point-by-point difference calculations are performed on the pixel grayscale values between the model's predicted clear underwater image fragments and the ground truth clear image labels to obtain the global pixel-level difference loss value. The model parameters are iteratively updated using the backpropagation algorithm. When the pixel-level difference loss value is within a certain range... If the loss does not decrease significantly within the specified interval for 20 consecutive training rounds, the image enhancement network model is considered to have converged and training is stopped.
[0054] Based on the above embodiments, clear underwater image fragments from each degraded region are stitched and fused with the original image from the non-degraded region to obtain a complete enhanced underwater image. The specific logic is as follows: Based on the obtained final degraded region mask and semantic partition mask, the spatial coordinates and boundary range of clear underwater image fragments in each degraded region are located, while the distribution of non-degraded regions is determined to ensure that the two types of regions have no spatial overlap and no omissions, providing a positional reference for stitching. The clear underwater image segments of each degraded area are smoothed at the boundary. A pixel grayscale transition interpolation algorithm is used to achieve edge grayscale adaptation, eliminate grayscale abrupt changes and discontinuity traces at the stitching point, and ensure natural boundary transition. Based on the spatial relationship of the original underwater degraded image, the clear underwater image fragment replaces the corresponding degraded area in the original image in situ, while completely preserving the original pixel information of the non-degraded area, thus completing the spatial alignment and stitching. Finally, global grayscale normalization calibration is performed on the entire image to unify the grayscale and contrast of clear underwater image segments and non-degraded areas, eliminate visual differences, and obtain a complete and coherent underwater enhanced image.
[0055] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0056] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented by software, electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.
[0057] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0058] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A semantically driven frequency-consistency underwater image enhancement method, characterized in that, The specific steps include: S1. Collect underwater degraded images and clear underwater images of the same scene, obtain their low-frequency components, extract the deep feature vectors corresponding to the low-frequency components through a pre-trained encoder, calculate the difference between the deep feature vectors of the two types of images, and obtain the global low-frequency residual components. S2. Standardize the underwater degraded image to obtain standardized image and pixel data. Perform grayscale processing on the standardized image. Use a pre-trained semantic segmentation model to perform semantic segmentation on the grayscale processed image, divide it into multiple semantic categories and generate semantic partition masks. Based on the grayscale variance of each semantic category, divide it into degraded region, transition zone region and non-degraded region. Based on the adjacent semantic degradation association rules, filter the transition zone regions adjacent to each degraded region and complete it to obtain the final degraded region. S3. Input the corresponding pixel data of the standardized image and the semantic partition mask into the linear projection layer, introduce the semantic adaptive coefficient of each semantic category, optimize the attention weight of each degraded region and output the semantic enhancement feature, combine the semantic adaptive coefficient and gray variance to obtain the fusion weight coefficient, simultaneously extract the local low frequency residual component corresponding to each degraded region, and fuse it with the semantic enhancement feature to generate the fusion feature of each degraded region. S4. The standardized images of each degraded region are stitched together with the corresponding fusion features to form a combined feature map, which is then input into the trained image enhancement network model. The model outputs clear underwater image fragments of each degraded region and stitches them together with the original images of the non-degraded regions to obtain a complete underwater enhanced image.
2. The semantically driven frequency consistency underwater image enhancement method according to claim 1, characterized in that, The semantic categories include coral areas, rock areas, and water areas. The semantic partition mask assigns a unique pixel identifier to multiple semantic categories, where the coral area corresponds to pixel value 1, the rock area corresponds to pixel value 2, and the water area corresponds to pixel value 3. Based on the gray-level variance of each semantic category, the region is divided into degenerate region, transition zone region, and non-degenerate region. The specific logic is as follows: The gray-level variance is calculated for each semantic category one by one. Based on the relationship between the gray-level variance and the preset high variance threshold and low variance threshold, the degradation region category corresponding to each semantic category is determined. The degradation region category includes degradation region, transition zone region and non-degradation region. If the gray-level variance of a semantic category is greater than the high variance threshold, the semantic category is determined to be a degenerate region. If the gray-level variance of a semantic category is greater than or equal to the low variance threshold and less than or equal to the high variance threshold, the semantic category is determined to be a transition zone region. If the gray-level variance of a semantic category is less than the low variance threshold, the semantic category is determined to be a non-degenerate region.
3. The semantically driven frequency consistency underwater image enhancement method according to claim 2, characterized in that, Based on the adjacent semantic degradation association rules, the transition zone regions adjacent to each degradation region are selected and then completed to obtain the final degradation region. The specific steps are as follows: Based on the pixel identifiers of the semantic partition mask, the pixel boundaries and spatial distribution range of the corresponding regions are extracted to determine the adjacent boundary pixel range of each semantic category. When two boundary pixels of different semantic categories are in direct contact, i.e. there are no other semantic category pixels between them, they are determined to be adjacent semantic categories, and the range of their corresponding adjacent boundary pixels is recorded simultaneously. Based on the determination results of degraded regions, transition zones, and non-degraded regions for each semantic category, and taking the degraded region as the benchmark, we traverse the range of adjacent boundary pixels that have been recorded for the degraded region, match the transition zone regions that are in direct contact with its boundary, and filter them as regions to be completed. The selected areas to be completed are all assigned to the corresponding degenerate areas. The pixel boundaries of the degenerate areas are updated. During the completion process, only the category of the degenerate area is updated, while the original semantic category and unique pixel identifier of the area to be completed are retained. After the completion is completed, the final degenerate area is obtained.
4. The semantically driven frequency consistency underwater image enhancement method according to claim 3, characterized in that, We introduce semantic adaptive coefficients for each semantic category, optimize the attention weights for each degenerate region, and output semantically enhanced features. The specific logic is as follows: The corresponding pixel data of the standardized image and the semantic partition mask are input into the linear projection layer to obtain a feature map that fuses semantic information. Based on the final degraded region boundary and semantic partition mask, a spatial mask corresponding to each degraded region category is generated. This spatial mask marks the pixel positions in the feature map that belong to the degraded region as 1 and the pixel positions that do not belong to the degraded region as 0, thereby locating the range of each degraded region in the feature map. The feature map, which incorporates semantic information, is input into the spatial attention module along with the aforementioned spatial mask. For the degenerate regions in the feature map marked with a spatial mask of 1, weight coefficients are assigned according to the following rules: Taking each pixel in the degradation region as the center pixel, select all pixels in the neighborhood with the center pixel as the origin and a preset size as the neighboring pixels, calculate the absolute difference between the feature channel mean values of the center pixel and the neighboring pixels, compare the absolute difference with the preset absolute difference threshold, and assign the corresponding weight coefficient to the center pixel. If the absolute difference of the feature channel means is greater than the absolute difference threshold, then the center pixel is assigned a weight coefficient. ; If the absolute difference of the feature channel means is less than or equal to the absolute difference threshold, then the center pixel is assigned a weight coefficient. ; Among them, On this basis, let ; For different semantic categories of degraded regions, semantic adaptive coefficients are introduced, and semantic adaptive coefficients are assigned to coral regions, rock regions, and water regions respectively. ; Among them, On this basis, let ; The weight coefficient of the center pixel of the degradation region under each semantic category is multiplied by the semantic adaptation coefficient of the corresponding semantic category to obtain the final attention weight of each center pixel. The formula is as follows: in, For the first The first degraded area, the first The semantic category under the first The final attention weights for each center pixel. For the first The first degraded region The weight coefficient of each center pixel, For the first The semantic category under the first The semantic adaptive coefficient of each center pixel For the index of the degenerate region, , The number of degraded areas, For semantic category indexes, , These correspond to the coral area, rock area, and water area, respectively. The index of the center pixel, , The number of center pixels; Based on the final attention weight adjustment of the feature map fused with semantic information, only the feature part corresponding to the degenerate region marked with 1 in the spatial mask is retained, and the features of the non-degenerate region marked with 0 are removed, and the semantic enhancement features of each degenerate region are output.
5. The semantically driven frequency consistency underwater image enhancement method according to claim 4, characterized in that, By combining the semantic adaptive coefficient and the gray-level variance, the fusion weight coefficient is obtained. The specific logic is as follows: Based on the gray-level variance of each semantic category, the corresponding degradation correction coefficient is calculated using the following formula: in, For the first Degradation correction coefficients for each semantic category For the first Gray-level variance of each semantic category For low variance threshold, High variance threshold; The fusion weight coefficient is calculated by combining the semantic adaptation coefficient and degradation correction coefficient of each semantic category, based on the following formula: in, For the first The fusion weight coefficients of each semantic category, For the first Semantic adaptive coefficients for each semantic category.
6. The semantically driven frequency consistency underwater image enhancement method according to claim 5, characterized in that, The local low-frequency residual components are weighted and fused with semantic enhancement features to generate fused features for each degraded region. The formula used is as follows: in, For the first The first degraded area, the first Fusion features under semantic categories For the first The first degraded area, the first Semantic enhancement features under each semantic category For the first The first degraded area, the first Local low-frequency residual components under each semantic category.
Citation Information
Patent Citations
Underwater image restoration method based on ambient light and transmission image parallel estimation network
CN115205166A
Underwater image enhancement method based on semantic guidance and attention fusion
CN116596795A
Underwater image enhancement method based on cross-domain feature representation and semantic segmentation guidance
CN120259111A
Underwater video enhancement method based on semantic guidance
CN120318137A
Underwater image enhancement method based on frequency domain enhancement and edge guidance
CN121582088A